use of com.intellij.ui.LayeredIcon in project intellij-community by JetBrains.
the class FileTypeRenderer method customize.
@Override
public void customize(JList list, FileType type, int index, boolean selected, boolean hasFocus) {
LayeredIcon layeredIcon = new LayeredIcon(2);
layeredIcon.setIcon(EMPTY_ICON, 0);
final Icon icon = type.getIcon();
if (icon != null) {
layeredIcon.setIcon(icon, 1, (-icon.getIconWidth() + EMPTY_ICON.getIconWidth()) / 2, (EMPTY_ICON.getIconHeight() - icon.getIconHeight()) / 2);
}
setIcon(layeredIcon);
String description = type.getDescription();
String trimmedDescription = StringUtil.capitalizeWords(description.replaceAll("(?i)\\s*file(?:s)?$", ""), true);
if (isDuplicated(description)) {
setText(trimmedDescription + " (" + type.getName() + ")");
} else {
setText(trimmedDescription);
}
}
use of com.intellij.ui.LayeredIcon in project intellij-community by JetBrains.
the class TestIconProvider method getIcon.
@Override
public Icon getIcon(@NotNull PsiElement element, int flags) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
try {
if (framework.isIgnoredMethod(element)) {
final Icon ignoredTestIcon = AllIcons.RunConfigurations.IgnoredTest;
final LayeredIcon icon = new LayeredIcon(ignoredTestIcon, PlatformIcons.PUBLIC_ICON);
icon.setIcon(PlatformIcons.PUBLIC_ICON, 1, ignoredTestIcon.getIconWidth(), 0);
return icon;
}
} catch (AbstractMethodError ignored) {
}
}
for (TestFramework framework : testFrameworks) {
try {
if (framework.isTestMethod(element)) {
final LayeredIcon mark = new LayeredIcon(PlatformIcons.METHOD_ICON, AllIcons.RunConfigurations.TestMark, PlatformIcons.PUBLIC_ICON);
mark.setIcon(PlatformIcons.PUBLIC_ICON, 2, PlatformIcons.METHOD_ICON.getIconWidth(), 0);
return mark;
}
} catch (AbstractMethodError ignore) {
}
}
return null;
}
use of com.intellij.ui.LayeredIcon in project intellij-community by JetBrains.
the class XBreakpointBase method setIcon.
protected void setIcon(Icon icon) {
if (!XDebuggerUtilImpl.isEmptyExpression(getConditionExpression())) {
LayeredIcon newIcon = new LayeredIcon(2);
newIcon.setIcon(icon, 0);
newIcon.setIcon(AllIcons.Debugger.Question_badge, 1, 10, 6);
myIcon = JBUI.scale(newIcon);
} else {
myIcon = icon;
}
}
use of com.intellij.ui.LayeredIcon 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.LayeredIcon 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;
}
Aggregations