use of com.intellij.openapi.roots.ui.util.CompositeAppearance in project intellij-community by JetBrains.
the class AntBuildFileNodeDescriptor method update.
public boolean update() {
CompositeAppearance oldAppearance = myAppearance;
myAppearance = new CompositeAppearance();
myAppearance.getEnding().addText(myBuildFile.getPresentableName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
final AntBuildModelBase buildModel = myBuildFile.getModelIfRegistered();
if (buildModel != null) {
AntTargetNodeDescriptor.addShortcutText(buildModel.getDefaultTargetActionId(), myAppearance);
}
myAppearance.setIcon(AntIcons.Build);
myName = myBuildFile.getPresentableName();
return !Comparing.equal(myAppearance, oldAppearance);
}
use of com.intellij.openapi.roots.ui.util.CompositeAppearance in project intellij-community by JetBrains.
the class AntTargetNodeDescriptor method update.
public boolean update() {
final CompositeAppearance oldText = myHighlightedText;
final boolean isMeta = myTarget instanceof MetaTarget;
setIcon(isMeta ? AntIcons.MetaTarget : AntIcons.Target);
myHighlightedText = new CompositeAppearance();
final AntBuildFile buildFile = isMeta ? ((MetaTarget) myTarget).getBuildFile() : myTarget.getModel().getBuildFile();
final Color color = buildFile.isTargetVisible(myTarget) ? UIUtil.getLabelForeground() : UIUtil.getLabelDisabledForeground();
TextAttributes nameAttributes = new TextAttributes(color, null, null, EffectType.BOXED, myTarget.isDefault() ? Font.BOLD : Font.PLAIN);
myHighlightedText.getEnding().addText(myTarget.getDisplayName(), nameAttributes);
AntConfigurationBase antConfiguration = AntConfigurationBase.getInstance(myProject);
final ArrayList<String> addedNames = new ArrayList<>(4);
for (final ExecutionEvent event : antConfiguration.getEventsForTarget(myTarget)) {
final String presentableName;
if ((event instanceof ExecuteCompositeTargetEvent)) {
presentableName = ((ExecuteCompositeTargetEvent) event).getMetaTargetName();
if (presentableName.equals(myTarget.getName())) {
continue;
}
} else {
presentableName = event.getPresentableName();
}
if (!addedNames.contains(presentableName)) {
addedNames.add(presentableName);
myHighlightedText.getEnding().addText(" (" + presentableName + ')', ourPostfixAttributes);
}
}
final RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
final VirtualFile vFile = buildFile.getVirtualFile();
if (vFile != null) {
for (AntBeforeRunTask task : runManager.getBeforeRunTasks(AntBeforeRunTaskProvider.ID)) {
if (task.isRunningTarget(myTarget)) {
myHighlightedText.getEnding().addText(" (Before Run/Debug)", ourPostfixAttributes);
break;
}
}
}
myName = myHighlightedText.getText();
final AntBuildTargetBase target = getTarget();
if (!addShortcutText(target.getActionId())) {
if (target.isDefault()) {
addShortcutText(((AntBuildModelBase) target.getModel()).getDefaultTargetActionId());
}
}
return !Comparing.equal(myHighlightedText, oldText);
}
use of com.intellij.openapi.roots.ui.util.CompositeAppearance in project intellij-plugins by JetBrains.
the class DartHierarchyNodeDescriptor method update.
@Override
public boolean update() {
boolean changes = super.update();
final CompositeAppearance oldText = myHighlightedText;
myHighlightedText = new CompositeAppearance();
NavigatablePsiElement element = (NavigatablePsiElement) getPsiElement();
if (element == null) {
return invalidElement();
}
final ItemPresentation presentation = element.getPresentation();
if (presentation != null) {
if (element instanceof DartMethodDeclaration) {
if (DartComponentType.typeOf(element) != DartComponentType.CONSTRUCTOR) {
// Do not print constructors as Class.Class.Class(args) Class
final DartClass cls = PsiTreeUtil.getParentOfType(element, DartClass.class);
if (cls != null) {
myHighlightedText.getEnding().addText(cls.getName() + ".");
}
}
}
myHighlightedText.getEnding().addText(presentation.getPresentableText());
PsiFile file = element.getContainingFile();
if (file != null) {
myHighlightedText.getEnding().addText(" (" + file.getName() + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
}
}
myName = myHighlightedText.getText();
if (!Comparing.equal(myHighlightedText, oldText)) {
changes = true;
}
return changes;
}
use of com.intellij.openapi.roots.ui.util.CompositeAppearance 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.openapi.roots.ui.util.CompositeAppearance in project intellij-plugins by JetBrains.
the class DartTypeHierarchyNodeDescriptor method update.
public final boolean update() {
boolean changes = super.update();
final DartClass dartClass = getDartClass();
if (dartClass == null) {
final String invalidPrefix = IdeBundle.message("node.hierarchy.invalid");
if (!myHighlightedText.getText().startsWith(invalidPrefix)) {
myHighlightedText.getBeginning().addText(invalidPrefix, HierarchyNodeDescriptor.getInvalidPrefixAttributes());
}
return true;
}
if (changes && myIsBase) {
final LayeredIcon icon = new LayeredIcon(2);
icon.setIcon(getIcon(), 0);
icon.setIcon(AllIcons.Hierarchy.Base, 1, -AllIcons.Hierarchy.Base.getIconWidth() / 2, 0);
setIcon(icon);
}
final CompositeAppearance oldText = myHighlightedText;
myHighlightedText = new CompositeAppearance();
TextAttributes classNameAttributes = null;
if (myColor != null) {
classNameAttributes = new TextAttributes(myColor, null, null, null, Font.PLAIN);
}
final String libraryName = DartResolveUtil.getLibraryName(dartClass.getContainingFile());
myHighlightedText.getEnding().addText(dartClass.getName(), classNameAttributes);
myHighlightedText.getEnding().addText(" (" + libraryName + ")", HierarchyNodeDescriptor.getPackageNameAttributes());
myName = myHighlightedText.getText();
if (!Comparing.equal(myHighlightedText, oldText)) {
changes = true;
}
return changes;
}
Aggregations