use of com.intellij.lang.ant.config.actions.TargetActionStub in project intellij-community by JetBrains.
the class AntToolwindowRegistrar method projectOpened.
@Override
public void projectOpened() {
final KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
final String prefix = AntConfiguration.getActionIdPrefix(myProject);
final ActionManager actionManager = ActionManager.getInstance();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
for (String id : keymap.getActionIdList()) {
if (id.startsWith(prefix) && actionManager.getAction(id) == null) {
actionManager.registerAction(id, new TargetActionStub(id, myProject));
}
}
}
final CompilerManager compilerManager = CompilerManager.getInstance(myProject);
compilerManager.addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
final AntConfiguration config = AntConfiguration.getInstance(myProject);
((AntConfigurationBase) config).ensureInitialized();
return config.executeTargetBeforeCompile(createDataContext(context));
}
});
compilerManager.addAfterTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
final AntConfigurationBase config = (AntConfigurationBase) AntConfiguration.getInstance(myProject);
config.ensureInitialized();
if (context.getMessageCount(CompilerMessageCategory.ERROR) > 0) {
final AntBuildTarget target = config.getTargetForEvent(ExecuteAfterCompilationEvent.getInstance());
if (target != null) {
context.addMessage(CompilerMessageCategory.INFORMATION, "Skipping ant target \"" + target.getDisplayName() + "\" because of compilation errors", null, -1, -1);
}
return true;
}
return config.executeTargetAfterCompile(createDataContext(context));
}
});
}
Aggregations