use of org.netbeans.spi.project.ActionProvider in project enclojure by EricThorsen.
the class ClojureRunToCursorActionProvider method shouldBeEnabled.
private boolean shouldBeEnabled() {
if (/* some module disabled? */
editorContext == null || !Utils.isClojure(editorContext.getCurrentURL())) {
return false;
}
// check if current project supports this action
Project p = MainProjectManager.getDefault().getMainProject();
if (p == null)
return false;
ActionProvider actionProvider = (ActionProvider) p.getLookup().lookup(ActionProvider.class);
if (actionProvider == null)
return false;
String[] sa = actionProvider.getSupportedActions();
int i, k = sa.length;
for (i = 0; i < k; i++) {
if (ActionProvider.COMMAND_DEBUG.equals(sa[i])) {
break;
}
}
if (i == k) {
return false;
}
// check if this action should be enabled
return ((ActionProvider) p.getLookup().lookup(ActionProvider.class)).isActionEnabled(ActionProvider.COMMAND_DEBUG, p.getLookup());
}
Aggregations