change YAMLKeyValue icon retrieval

This will help delegate to KV's icon easier as well as preserve an ability to overload it in IconProvider
This commit is contained in:
Valentin Fondaratov
2016-07-04 12:47:26 +03:00
parent 209ef1d51d
commit f719696715
2 changed files with 9 additions and 4 deletions
@@ -138,6 +138,12 @@ public class YAMLKeyValueImpl extends YAMLPsiElementImpl implements YAMLKeyValue
}
}
@NotNull
@Override
protected Icon getElementIcon(@IconFlags int flags) {
return PlatformIcons.PROPERTY_ICON;
}
@Override
public ItemPresentation getPresentation() {
final YAMLFile yamlFile = (YAMLFile)getContainingFile();
@@ -155,7 +161,7 @@ public class YAMLKeyValueImpl extends YAMLPsiElementImpl implements YAMLKeyValue
}
public Icon getIcon(boolean open) {
return PlatformIcons.PROPERTY_ICON;
return YAMLKeyValueImpl.this.getIcon(0);
}
};
}
@@ -2,7 +2,6 @@ package org.jetbrains.yaml.structureView;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.PsiElement;
import com.intellij.util.PlatformIcons;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -82,8 +81,8 @@ public class YAMLStructureViewElement implements StructureViewTreeElement {
}
public Icon getIcon(boolean open) {
final PsiElement value = kv.getValue();
return value instanceof YAMLScalar ? PlatformIcons.PROPERTY_ICON : PlatformIcons.XML_TAG_ICON;
final YAMLValue value = kv.getValue();
return value instanceof YAMLScalar ? kv.getIcon(0) : PlatformIcons.XML_TAG_ICON;
}
};
}