use of com.intellij.lang.ant.config.impl.MetaTarget 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);
}
Aggregations