summaryrefslogtreecommitdiff
path: root/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView')
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java13
-rw-r--r--plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java18
2 files changed, 14 insertions, 17 deletions
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
index b67f6bfbea3f..efdbeaf3e863 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
@@ -16,6 +16,7 @@
package com.intellij.lang.properties.structureView;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.ide.util.treeView.smartTree.*;
import com.intellij.lang.properties.IProperty;
@@ -65,14 +66,14 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
parentPrefixLength = 0;
}
for (TreeElement element : children) {
- String text = null;
- if (element instanceof PropertiesStructureViewElement) {
- IProperty property = ((PropertiesStructureViewElement)element).getValue();
- text = property.getUnescapedKey();
+ if (!(element instanceof StructureViewTreeElement)) {
+ continue;
}
- else if (element instanceof ResourceBundlePropertyStructureViewElement) {
- text = ((ResourceBundlePropertyStructureViewElement)element).getValue();
+ final Object value = ((StructureViewTreeElement)element).getValue();
+ if (!(value instanceof IProperty)) {
+ continue;
}
+ final String text = ((IProperty) value).getUnescapedKey();
if (text == null) continue;
LOG.assertTrue(text.startsWith(parentPrefix) || text.startsWith(mySeparator));
List<String> words = StringUtil.split(text, mySeparator);
diff --git a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
index 61b3c0202619..c4958502c25a 100644
--- a/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
+++ b/plugins/properties/properties-psi-impl/src/com/intellij/lang/properties/structureView/PropertiesPrefixGroup.java
@@ -16,11 +16,13 @@
package com.intellij.lang.properties.structureView;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.util.treeView.smartTree.Group;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.lang.properties.IProperty;
import com.intellij.lang.properties.editor.ResourceBundleEditorViewElement;
import com.intellij.lang.properties.editor.ResourceBundlePropertyStructureViewElement;
+import com.intellij.lang.properties.psi.Property;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
@@ -90,20 +92,14 @@ public class PropertiesPrefixGroup implements Group, ResourceBundleEditorViewEle
Collection<TreeElement> result = new ArrayList<TreeElement>();
List<String> prefixWords = StringUtil.split(myPrefix, mySeparator);
for (TreeElement treeElement : myProperties) {
- String key;
- if (treeElement instanceof PropertiesStructureViewElement) {
- PropertiesStructureViewElement propertiesElement = (PropertiesStructureViewElement)treeElement;
- IProperty property = propertiesElement.getValue();
-
- key = property.getUnescapedKey();
- }
- else if (treeElement instanceof ResourceBundlePropertyStructureViewElement) {
- key = ((ResourceBundlePropertyStructureViewElement)treeElement).getValue();
+ if (!(treeElement instanceof StructureViewTreeElement)) {
+ continue;
}
- else {
+ final Object value = ((StructureViewTreeElement)treeElement).getValue();
+ if (!(value instanceof IProperty)) {
continue;
}
-
+ final String key = ((IProperty) value).getUnescapedKey();
if (key == null || key.equals(myPrefix)) {
continue;
}