2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.lang
.properties
.structureView
;
18 import com
.intellij
.ide
.structureView
.StructureViewTreeElement
;
19 import com
.intellij
.lang
.properties
.psi
.Property
;
20 import com
.intellij
.navigation
.ItemPresentation
;
21 import com
.intellij
.navigation
.NavigationItem
;
22 import com
.intellij
.openapi
.editor
.colors
.TextAttributesKey
;
23 import com
.intellij
.openapi
.util
.Iconable
;
28 * Created by IntelliJ IDEA.
32 * To change this template use File | Settings | File Templates.
34 public class PropertiesStructureViewElement
implements StructureViewTreeElement
{
35 private final Property myProperty
;
36 private String myPresentableName
;
38 public PropertiesStructureViewElement(final Property element
) {
42 public Property
getValue() {
46 public void navigate(boolean requestFocus
) {
47 ((NavigationItem
)myProperty
).navigate(requestFocus
);
50 public boolean canNavigate() {
51 return ((NavigationItem
)myProperty
).canNavigate();
54 public boolean canNavigateToSource() {
55 return ((NavigationItem
)myProperty
).canNavigateToSource();
58 public StructureViewTreeElement
[] getChildren() {
62 public ItemPresentation
getPresentation() {
63 return new ItemPresentation() {
64 public String
getPresentableText() {
65 if (myPresentableName
== null) {
66 return myProperty
.getUnescapedKey();
69 return myPresentableName
;
73 public TextAttributesKey
getTextAttributesKey() {
77 public String
getLocationString() {
81 public Icon
getIcon(boolean open
) {
82 return myProperty
.getIcon(Iconable
.ICON_FLAG_OPEN
);
87 public void setPresentableName(final String presentableName
) {
88 myPresentableName
= presentableName
;