@Override public URI toUri () { if (this.uriCache == null) { this.uriCache = f.toURI(); } return this.uriCache; }
/** * Check whether an existing file is sharable. * @param fo a file or directory; should be normalized. * @return an answer or {@code UNKNOWN} * @since 1.27 */ public static Sharability getSharability(FileObject fo) { return getSharability(fo.toURI()); } }
@Override public int hashCode() { int res = 17; final FileObject projDir = antProjectHelper.getProjectDirectory(); res = res * 31 + (projDir == null ? 0 : projDir.toURI().hashCode()); res = res * 31 + currentProfile.hashCode(); return res; }
public static URI toURI(VCSFileProxy file) { File javaFile = file.toFile(); if (javaFile != null) { return javaFile.toURI(); } try { List<String> segments = new ArrayList<>(); FileObject fo = findExistingParent(file, segments); URI res = fo.toURI(); for (int i = segments.size() - 1; i >= 0; i--) { String path; if (res.getPath().endsWith("/")) { //NOI18N path = res.getPath()+segments.get(i); } else { path = res.getPath()+"/"+segments.get(i); //NOI18N } res = new URI(res.getScheme(), res.getUserInfo(), res.getHost(), res.getPort(), path, res.getQuery(), res.getFragment()); } return res; } catch (URISyntaxException ex) { LOG.log(Level.INFO, null, ex); } catch (FileNotFoundException ex) { LOG.log(Level.INFO, null, ex); } return null; }
@Override public FileObject run() throws IOException { URI uri = fo.toURI(); Path path = Paths.get(uri); for (int i = 0; i < 5; i++) { if (Files.isSymbolicLink(path)) { Path to = Files.readSymbolicLink(path); if (!to.isAbsolute()) { to = path.getParent().resolve(to).normalize(); } if (Files.isRegularFile(to)) { return FileUtil.toFileObject(to.toFile()); } path = to; } else { return null; } } return null; } });
private void pingNBRepository(FileObject referenceFile) { String url = VersioningQuery.getRemoteLocation(referenceFile.toURI()); if (url != null) { if(NBBugzillaUtils.isNbRepository(url)) { BugtrackingUtil.findNBRepository(); // ensure repository exists } } }
private boolean isModifiedByWorkingCopy() { final FileObject file = handle.resolveFileObject(false); if (file == null) { return false; } return SourceFileManager.getModifiedFiles().isModified(file.toURI()); }
Collection<String> controllersForTemplate = index.getControllersForTemplate(fo.toURI()); for (String controllerName : controllersForTemplate) { Collection<AngularJsController> controllers = index.getControllers(controllerName, true);
protected TestMethodNode(final Testcase testcase, Project project, Lookup lookup) { super(testcase.getTrouble() != null ? new TestMethodNodeChildren(testcase) : Children.LEAF, lookup); this.testcase = testcase; this.project = new WeakReference<Project>(project); this.projectURI = project.getProjectDirectory().toURI(); setDisplayName(); if (TestsuiteNode.DISPLAY_TOOLTIPS) { setShortDescription(TestsuiteNode.toTooltipText(testcase.getOutput())); } }
@CheckForNull Key createKey(@NonNull final URL rootURL) { final URL fileURL = FileUtil.getArchiveFile(rootURL); if (fileURL == null) { //Not an archive return null; } final FileObject fileFo = URLMapper.findFileObject(fileURL); if (fileFo == null) { return null; } return new Key( fileFo.toURI(), fileFo.lastModified().getTime(), fileFo.getSize()); }
LOGGER.log(Level.FINE, "FileObject ({0}) passed to JavaSource.forFileObject is invalid", fileObject.toURI().toString()); return null; && fileObject.getAttribute("javax.script.ScriptEngine") != null && fileObject.getAttribute("template") == Boolean.TRUE) { LOGGER.log(Level.FINE, "FileObject ({0}) passed to JavaSource.forFileObject is a template", fileObject.toURI().toString()); return null; srcPath).findOwnerRoot(fileObject); if (root == null) { LOGGER.log(Level.FINE, "FileObject ({0}) passed to JavaSource.forFileObject of mimeType classfile does not have a corresponding root", fileObject.toURI().toString()); return null; LOGGER.log(Level.FINE, "FileObject ({0}) passed to JavaSource.forFileObject is not a Java source file (mimetype: {1})", new Object[] {fileObject.toURI().toString(), mimeType}); return null;
String url = VersioningQuery.getRemoteLocation(fileObject.toURI());
@Override public void intercept(String name, JsObject globalObject, DeclarationScope scope, ModelElementFactory factory, Collection<FunctionArgument> args) { if (!AngularJsIndexer.isScannerThread()) { return; } for (FunctionArgument arg : args) { if (arg.getKind() == FunctionArgument.Kind.ANONYMOUS_OBJECT) { JsObject aObject = (JsObject) arg.getValue(); JsObject url = aObject.getProperty(TEMPLATE_URL_PROP); JsObject controller = aObject.getProperty(CONTROLLER_PROP); FileObject fo = globalObject.getFileObject(); if (url != null && controller != null && fo != null) { String content = null; Source source = Source.create(fo); content = source.createSnapshot().getText().toString(); if (content != null) { String template = getStringValueAt(content, url.getOffsetRange().getStart()); String controllerName = getStringValueAt(content, controller.getOffsetRange().getStart()); if (template != null && controllerName != null) { AngularJsIndexer.addTemplateController(fo.toURI(), Utils.cutQueryFromTemplateUrl(template), controllerName); } } } } } }
FileObject fo = globalObject.getFileObject(); if (fo != null) { AngularJsIndexer.addController(fo.toURI(), new AngularJsController(controllerName, fqnOfController, fo.toURL(), nameOffset));