use of org.openide.filesystems.FileObject in project cakephp-netbeans by cakephp.
the class CakePhpGoToViewAction method goToView.
@Override
public boolean goToView() {
EditorSupport editorSupport = Lookup.getDefault().lookup(EditorSupport.class);
PhpBaseElement phpElement = editorSupport.getElement(controller, offset);
if (phpElement == null) {
return false;
}
FileObject view = CakePhpUtils.getView(controller, phpElement);
if (view != null) {
UiUtils.open(view, DEFAULT_OFFSET);
return true;
}
return false;
}
use of org.openide.filesystems.FileObject in project enclojure by EricThorsen.
the class SourcePathProviderImpl method getURL.
/**
* Translates a relative path ("java/lang/Thread.java") to url
* ("file:///C:/Sources/java/lang/Thread.java"). Uses GlobalPathRegistry
* if global == true.
*
* @param relativePath a relative path (java/lang/Thread.java)
* @param global true if global path should be used
* @return url or <code>null</code>
*/
public String getURL(String relativePath, boolean global) {
if (verbose) {
System.out.println("SPPI: getURL " + relativePath + " global " + global);
// ET I seem to get explicit paths here for clojure files?
}
String cf = checkClojureFile(relativePath);
if (cf != null) {
return cf;
}
FileObject fo;
try {
LOG.log(Level.ALL, " SourcePathProviderImpl::getURL - " + relativePath);
if (originalSourcePath == null) {
fo = GlobalPathRegistry.getDefault().findResource(relativePath);
} else {
synchronized (this) {
if (!global) {
fo = smartSteppingSourcePath.findResource(relativePath);
if (verbose) {
System.out.println("SPPI: fo " + fo);
}
} else {
fo = originalSourcePath.findResource(relativePath);
if (verbose) {
System.out.println("SPPI: fo " + fo);
}
}
}
}
if (fo == null) {
LOG.log(Level.ALL, " SourcePathProviderImpl::getURL - NO GO for: " + relativePath);
return null;
}
return fo.getURL().toString();
} catch (FileStateInvalidException e) {
if (verbose) {
System.out.println("SPPI: FileStateInvalidException");
}
return null;
}
}
use of org.openide.filesystems.FileObject in project enclojure by EricThorsen.
the class ClojureToggleBreakpointActionProvider method propertyChange.
public void propertyChange(PropertyChangeEvent evt) {
String url = Context.getCurrentURL();
// #67910 - setting of a bp allowed only in JSP contained in some web module
FileObject fo = Utils.getFileObjectFromUrl(url);
boolean isClojure = Utils.isClojure(fo);
// #issue 65969 fix:
// we allow bp setting only if the file is JSP or TAG file and target server of it's module is NOT WebLogic 9;
// TODO it should be solved by adding new API into j2eeserver which should announce whether the target server
// supports JSP debugging or not
// String serverID = Utils.getTargetServerID(fo);
setEnabled(ActionsManager.ACTION_TOGGLE_BREAKPOINT, isClojure);
if (debugger != null && debugger.getState() == debugger.STATE_DISCONNECTED)
destroy();
}
use of org.openide.filesystems.FileObject in project enclojure by EricThorsen.
the class ClojureTemplateWizardIterator method instantiate.
public Set instantiate() throws /*ProgressHandle handle*/
IOException {
Set<FileObject> resultSet = new LinkedHashSet<FileObject>();
// File dirF = FileUtil.normalizeFile((File) wiz.getProperty("projdir"));
// dirF.mkdirs();
//
// FileObject template = Templates.getTemplate(wiz);
// FileObject dir = FileUtil.toFileObject(dirF);
File dirF = (File) wiz.getProperty("projdir");
dirF.mkdirs();
FileObject template = Templates.getTemplate(wiz);
// FileObject dir = FileUtil.toFileObject(dirF);
try {
// FF - exclide thie lib/clojure.jar if the user selects another clojure reference
// if( dir.getPath().startsWith(ClojureTemplatePanelVisual.getDefaultClojureReferencePath()))
ClojureTemplatePanelVisual component = (ClojureTemplatePanelVisual) current().getComponent();
unZipFile(template.getInputStream(), dirF, component.packageNameTextField.getText(), component.getProjectName());
} catch (Exception ex) {
Exceptions.printStackTrace(ex);
}
FileObject dir = FileUtil.toFileObject(dirF);
// Always open top dir as a project:
resultSet.add(dir);
// Look for nested projects to open as well:
Enumeration<? extends FileObject> e = dir.getFolders(true);
while (e.hasMoreElements()) {
FileObject subfolder = e.nextElement();
if (ProjectManager.getDefault().isProject(subfolder)) {
resultSet.add(subfolder);
}
}
File parent = dirF.getParentFile();
if (parent != null && parent.exists()) {
ProjectChooser.setProjectsFolder(parent);
}
// }
return resultSet;
}
Aggregations