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());
}
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;
}
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;
}
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;
}
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;
}
Aggregations