Search in sources :

Example 11 with Project

use of org.netbeans.api.project.Project 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)

Example 12 with Project

use of org.netbeans.api.project.Project in project enclojure by EricThorsen.

the class MainProjectManager method enable.

public boolean enable(Project p) {
    if (mainProject == p)
        return true;
    Project o = mainProject;
    mainProject = p;
    pcs.firePropertyChange("mainProject", o, mainProject);
    return true;
}
Also used : Project(org.netbeans.api.project.Project)

Example 13 with Project

use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.

the class MMDEditorSupport method getProjectDirectory.

public File getProjectDirectory() {
    File result = null;
    final Project project = getProject();
    if (project != null) {
        final FileObject projDir = project.getProjectDirectory();
        if (projDir != null) {
            return FileUtil.toFile(projDir);
        }
    }
    return result;
}
Also used : Project(org.netbeans.api.project.Project) FileObject(org.openide.filesystems.FileObject) File(java.io.File)

Example 14 with Project

use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.

the class MMDGraphEditor method getProjectFolderAsFileObject.

@Nullable
public FileObject getProjectFolderAsFileObject() {
    final Project proj = this.editorSupport.getProject();
    FileObject result = null;
    if (proj != null) {
        result = proj.getProjectDirectory();
    }
    return result;
}
Also used : Project(org.netbeans.api.project.Project) FileObject(org.openide.filesystems.FileObject) Nullable(javax.annotation.Nullable)

Example 15 with Project

use of org.netbeans.api.project.Project in project netbeans-mmd-plugin by raydac.

the class AbstractPlugin method prepare.

@Override
public final Problem prepare(final RefactoringElementsBag session) {
    if (isCanceled()) {
        return null;
    }
    final Collection<? extends FileObject> files = findFileObjectInLookup(this.refactoring.getRefactoringSource());
    fireProgressListenerStart(RenameRefactoring.PREPARE, files.size());
    Problem result = null;
    try {
        for (final FileObject fileObject : findFileObjectInLookup(this.refactoring.getRefactoringSource())) {
            if (isCanceled()) {
                return null;
            }
            if (result != null) {
                break;
            }
            final Project project = FileOwnerQuery.getOwner(fileObject);
            result = processFileObject(project, fileObject);
            fireProgressListenerStep(1);
        }
    } finally {
        synchronized (this.elements) {
            LOGGER.info("Detected " + this.elements.size() + " elements for refactoring");
            if (!isCanceled()) {
                session.addAll(refactoring, this.elements);
            }
        }
        fireProgressListenerStop();
    }
    return result;
}
Also used : Project(org.netbeans.api.project.Project) Problem(org.netbeans.modules.refactoring.api.Problem) FileObject(org.openide.filesystems.FileObject)

Aggregations

Project (org.netbeans.api.project.Project)16 FileObject (org.openide.filesystems.FileObject)6 File (java.io.File)5 ArrayList (java.util.ArrayList)3 Nullable (javax.annotation.Nullable)2 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 Problem (org.netbeans.modules.refactoring.api.Problem)2 DataObject (org.openide.loaders.DataObject)2 Node (org.openide.nodes.Node)2 PersistentArrayMap (clojure.lang.PersistentArrayMap)1 AsposeMavenProjectManager (com.aspose.barcode.maven.utils.AsposeMavenProjectManager)1 AsposeMavenProjectManager (com.aspose.cells.maven.utils.AsposeMavenProjectManager)1 DataFlavor (java.awt.datatransfer.DataFlavor)1 ItemEvent (java.awt.event.ItemEvent)1 ItemListener (java.awt.event.ItemListener)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 Hashtable (java.util.Hashtable)1 Iterator (java.util.Iterator)1 List (java.util.List)1