use of com.intellij.ui.RowIcon in project intellij-community by JetBrains.
the class GrLightMethodBuilder method getElementIcon.
@Override
public Icon getElementIcon(final int flags) {
Icon methodIcon = myBaseIcon != null ? myBaseIcon : hasModifierProperty(PsiModifier.ABSTRACT) ? PlatformIcons.ABSTRACT_METHOD_ICON : PlatformIcons.METHOD_ICON;
RowIcon baseIcon = ElementPresentationUtil.createLayeredIcon(methodIcon, this, false);
return ElementPresentationUtil.addVisibilityIcon(this, flags, baseIcon);
}
use of com.intellij.ui.RowIcon in project intellij-plugins by JetBrains.
the class FlexStructureViewTest method testBug3.
public void testBug3() throws Exception {
configureByFiles(null, BASE_PATH + "22.js2", BASE_PATH + "22_2.js2");
final Object[] items = getTopLevelItems();
assertEquals(2, items.length);
assertEquals("XXX", getText(items[0]));
assertEquals("YYY", getText(items[1]));
List<? extends AbstractTreeNode> treeNodes = getChildren(items[0]);
assertEquals(3 + OBJECT_METHODS_COUNT, treeNodes.size());
assertEquals("constructor():*", getText(treeNodes.get(0)));
assertEquals("aaa", getText(treeNodes.get(OBJECT_METHODS_COUNT + 1)));
assertEquals("bbb", getText(treeNodes.get(OBJECT_METHODS_COUNT + 2)));
AbstractTreeNode node = treeNodes.get(OBJECT_METHODS_COUNT - 5);
assertEquals("staticFun()", getText(node));
Icon icon = getIcon(node);
assertTrue(icon instanceof RowIcon);
// static mark blended in
assertTrue(((RowIcon) icon).getIcon(0) instanceof LayeredIcon);
treeNodes = getChildren(items[1]);
assertEquals(2 + OBJECT_METHODS_COUNT, treeNodes.size());
assertEquals("aaa", getText(treeNodes.get(OBJECT_METHODS_COUNT)));
assertEquals("bbb", getText(treeNodes.get(OBJECT_METHODS_COUNT + 1)));
}
use of com.intellij.ui.RowIcon in project intellij-plugins by JetBrains.
the class DartServerCompletionContributor method applyVisibility.
private static Icon applyVisibility(Icon base, boolean isPrivate) {
RowIcon result = new RowIcon(2);
result.setIcon(base, 0);
Icon visibility = isPrivate ? PlatformIcons.PRIVATE_ICON : PlatformIcons.PUBLIC_ICON;
result.setIcon(visibility, 1);
return result;
}
use of com.intellij.ui.RowIcon in project intellij-plugins by JetBrains.
the class DartMethodHierarchyNodeDescriptor method update.
public final boolean update() {
boolean changes = super.update();
final CompositeAppearance oldText = myHighlightedText;
myHighlightedText = new CompositeAppearance();
DartClass dartClass = getType();
if (dartClass == null) {
if (!myHighlightedText.getText().startsWith(INVALID_PREFIX)) {
myHighlightedText.getBeginning().addText(INVALID_PREFIX, HierarchyNodeDescriptor.getInvalidPrefixAttributes());
}
return true;
}
final ItemPresentation presentation = dartClass.getPresentation();
Icon baseIcon = null;
Icon stateIcon = null;
if (presentation != null) {
myHighlightedText.getEnding().addText(presentation.getPresentableText());
PsiFile file = dartClass.getContainingFile();
if (file != null) {
myHighlightedText.getEnding().addText(" (" + file.getName() + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
}
baseIcon = presentation.getIcon(false);
stateIcon = calculateStateIcon(dartClass);
}
if (changes || baseIcon != myRawIcon || stateIcon != myStateIcon) {
changes = true;
Icon newIcon = myRawIcon = baseIcon;
myStateIcon = stateIcon;
if (myIsBase) {
final LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(newIcon, 0);
newIcon = icon;
icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0);
}
if (myStateIcon != null) {
newIcon = new RowIcon(myStateIcon, newIcon);
}
setIcon(newIcon);
}
myName = myHighlightedText.getText();
if (!Comparing.equal(myHighlightedText, oldText)) {
changes = true;
}
return changes;
}
use of com.intellij.ui.RowIcon in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoNamedElementImpl method getIcon.
@Nullable
@Override
public Icon getIcon(int flags) {
Icon icon = null;
if (this instanceof GoMethodDeclaration)
icon = GoIcons.METHOD;
else if (this instanceof GoFunctionDeclaration)
icon = GoIcons.FUNCTION;
else if (this instanceof GoTypeSpec)
icon = GoIcons.TYPE;
else if (this instanceof GoVarDefinition)
icon = GoIcons.VARIABLE;
else if (this instanceof GoConstDefinition)
icon = GoIcons.CONSTANT;
else if (this instanceof GoFieldDefinition)
icon = GoIcons.FIELD;
else if (this instanceof GoMethodSpec)
icon = GoIcons.METHOD;
else if (this instanceof GoAnonymousFieldDefinition)
icon = GoIcons.FIELD;
else if (this instanceof GoParamDefinition)
icon = GoIcons.PARAMETER;
else if (this instanceof GoLabelDefinition)
icon = GoIcons.LABEL;
if (icon != null) {
if ((flags & Iconable.ICON_FLAG_VISIBILITY) != 0) {
RowIcon rowIcon = ElementBase.createLayeredIcon(this, icon, flags);
rowIcon.setIcon(isPublic() ? PlatformIcons.PUBLIC_ICON : PlatformIcons.PRIVATE_ICON, 1);
return rowIcon;
}
return icon;
}
return super.getIcon(flags);
}
Aggregations