Search in sources :

Example 1 with ActionProvider

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());
}
Also used : Project(org.netbeans.api.project.Project) ActionProvider(org.netbeans.spi.project.ActionProvider) ClojureLineBreakpoint(org.enclojure.ide.debugger.breakpoints.ClojureLineBreakpoint) Breakpoint(org.netbeans.api.debugger.Breakpoint)

Aggregations

ClojureLineBreakpoint (org.enclojure.ide.debugger.breakpoints.ClojureLineBreakpoint)1 Breakpoint (org.netbeans.api.debugger.Breakpoint)1 Project (org.netbeans.api.project.Project)1 ActionProvider (org.netbeans.spi.project.ActionProvider)1