final boolean hasFlowCompleted (final FileObject fo) { if (fo == null) { return false; } else { try { return this.flowCompleted.contains(fo.getURL().toURI()); } catch (Exception e) { return false; } } }
public URL getCatalog() { try { FileObject catalog = getCatalogFileObject(); return catalog==null?null:catalog.getURL(); } catch (FileStateInvalidException ex) { return null; } }
public static NewJ2SEPlatform create (FileObject installFolder) throws IOException { assert installFolder != null; Map<String,String> platformProperties = new HashMap<String,String> (); return new NewJ2SEPlatform (null,Collections.singletonList(installFolder.getURL()),platformProperties,Collections.<String,String>emptyMap()); }
private static URL createURL(FileSystem fs, String fileName) throws IOException { String root = fs.getRoot().getURL().toExternalForm(); if (!root.endsWith("/")) { root += "/"; } root += fileName.replace('\\', '/'); return new URL(root); }
/** Gets value of property. Overrides superclass method. */ public Object getValue() throws InvocationTargetException { try { return new ImageIcon(obj.getPrimaryFile().getURL()); } catch (FileStateInvalidException fsie) { throw new InvocationTargetException(fsie); } }
public static boolean isDisasm(String url) { //TODO: optimize try { return getFileObject().getURL().toString().equals(url); } catch (FileStateInvalidException fsi) { Exceptions.printStackTrace(fsi); } return false; }
public synchronized URI toUri () { if (this.uri == null) { try { this.uri = URI.create(this.file.getURL().toExternalForm()); } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(e); } } return this.uri; }
@Override public void fileDeleted(FileEvent fe) { try { if (fe.getFile().getURL().equals(url)) { remove(); } } catch (FileStateInvalidException ex) { //ignore } } });
public static Work compile (final FileObject file, final URL root, CountDownLatch[] latch) throws FileStateInvalidException { assert file != null && root != null; assert latch != null && latch.length == 1 && latch[0] == null; latch[0] = new CountDownLatch (1); return new SingleRootWork (WorkType.COMPILE, file.getURL(), root, file.isFolder(),latch[0]); }
protected URI getProjectDirectoryUri() { try { URI projectDirectoryUri = new URI(getProject().getProjectDirectory().getURL().toExternalForm()); return projectDirectoryUri; } catch (URISyntaxException e) { assert Trace.trace(this.getClass(), e); return null; } catch (FileStateInvalidException e) { assert Trace.trace(this.getClass(), e); return null; } }
private void writeObject(ObjectOutputStream oos) throws IOException { fsname = f.getFileSystem().getSystemName(); path = f.getPath(); url = f.getURL(); assert url != null : "No URL for " + path; oos.defaultWriteObject(); }
private void writeObject(ObjectOutputStream oos) throws IOException { fsname = f.getFileSystem().getSystemName(); path = f.getPath(); url = f.getURL(); assert url != null : "No URL for " + path; oos.defaultWriteObject(); }
private void checkLibraryFolder (FileObject fo) { if (!FileUtil.isArchiveFile(fo)) { return; } if (fo.getParent ().equals (libFolder)) { try { classPathModifier.addRoots(new URL[] {FileUtil.getArchiveRoot(fo.getURL())}, ProjectProperties.JAVAC_CLASSPATH); } catch (IOException e) { Exceptions.printStackTrace(e); } } }
public URL resolveResource(String resource) { try { URL fileUrl = file.getURL(); return new URL(fileUrl, resource); } catch (java.net.MalformedURLException mue) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, mue); } catch(FileStateInvalidException fsie) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, fsie); } return null; }
private void checkLibraryFolder (FileObject fo) { if (!FileUtil.isArchiveFile(fo)) { return; } if (fo.getParent ().equals (libFolder)) { try { cpMod.getClassPathModifier().addRoots(new URL[] {FileUtil.getArchiveRoot(fo.getURL())}, ProjectProperties.JAVAC_CLASSPATH); } catch (IOException e) { Exceptions.printStackTrace(e); } } }
static void createFileWithSubstitutions( final FileObject sourceFO, final FileObject targetFO, final Map<String,String> tokens) throws IOException { FileLock lock = targetFO.lock(); try { copyAndSubstituteTokens(sourceFO.getURL(), lock, targetFO, tokens); } finally { lock.releaseLock(); } }
private void tryUpdate() throws IOException { URL url = readURL(getPrimaryFile ()); if (url.equals(original.getPrimaryFile().getURL())) { return; } writeOriginal (null, null, getPrimaryFile (), original); }
/** Find (maybe cached) CRC for a file, using a preexisting input stream (not closed by this method). */ private static String getCrc32(InputStream is, FileObject fo) throws IOException { URL u = fo.getURL(); fo.refresh(); // in case was written on disk and we did not notice yet... long footprint = fo.lastModified().getTime() ^ fo.getSize(); String crc = findCachedCrc32(u, footprint); if (crc == null) { crc = computeCrc32(is); cacheCrc32(crc, u, footprint); } return crc; }
public synchronized NbProjectHandleImpl getProjectHandle(URL url, SourceHandleImpl src) throws FileStateInvalidException, IOException { for (Project p : OpenProjects.getDefault().getOpenProjects()) { if (p.getProjectDirectory().getURL().equals(url)) { return new NbProjectHandleImpl(p, src); } } for (UnloadedProjectInformation i : RecentProjects.getDefault().getRecentProjectInformation()) { if (i.getURL().equals(url)) { return new NbProjectHandleImpl(i, src); } } return null; }