public static IPath filePathFromURI(String uriStr) { URI uri = URI.create(uriStr); if ("file".equals(uri.getScheme())) { return Path.fromOSString(Paths.get(uri).toString()); } return null; }
public static IPath canonicalFilePathFromURI(String uriStr) { URI uri = URI.create(uriStr); if ("file".equals(uri.getScheme())) { return FileUtil.canonicalPath(Path.fromOSString(Paths.get(uri).toString())); } return null; }
/** * Helper method - returns whether an object is a file (i.e., it returns <code>true</code> * to {@link File#isFile()}. */ public static boolean isFile(Object target) { if (target instanceof File) { IPath path = Path.fromOSString(((File) target).getPath()); return isExternalFile(path); } return false; }
/** * Helper method - returns whether an object is a file (i.e., it returns <code>true</code> * to {@link File#isFile()}. */ public static boolean isFile(Object target) { if (target instanceof File) { IPath path = Path.fromOSString(((File) target).getPath()); return isExternalFile(path); } return false; }
/** * Helper method - returns whether an object is a file (i.e., it returns <code>true</code> * to {@link File#isFile()}. */ public static boolean isFile(Object target) { if (target instanceof File) { IPath path = Path.fromOSString(((File) target).getPath()); return isExternalFile(path); } return false; }
/** * Helper method - returns whether an object is a file (i.e., it returns <code>true</code> * to {@link File#isFile()}. */ public static boolean isFile(Object target) { if (target instanceof File) { IPath path = Path.fromOSString(((File) target).getPath()); return isExternalFile(path); } return false; }
public static boolean isJmod(File file) { IPath path = Path.fromOSString(file.getPath()); if (path.getFileExtension().equalsIgnoreCase(SuffixConstants.EXTENSION_jmod)) { return true; } return false; }
/** * Helper method - returns whether an object is a file (i.e., it returns <code>true</code> * to {@link File#isFile()}. */ public static boolean isFile(Object target) { if (target instanceof File) { IPath path = Path.fromOSString(((File) target).getPath()); return isExternalFile(path); } return false; }
@Override public Optional<IProjectDescription> findProjectDescriptor(File location, IProgressMonitor monitor) { IPath descriptorLocation = Path.fromOSString(location.getPath()).append(".project"); IWorkspace workspace = ResourcesPlugin.getWorkspace(); try { IProjectDescription projectDescription = workspace.loadProjectDescription(descriptorLocation); return Optional.of(projectDescription); } catch (CoreException e) { return Optional.absent(); } }
public static SourceMap createFrom(File file) throws IOException { String contents = Streams.loadAndClose(new InputStreamReader(new FileInputStream(file), "UTF-8")); try { return createFrom(Path.fromOSString(file.getAbsolutePath()), contents); } catch (JSONException e) { throw new IOException(e); } }
public IStatus validatePath(String path, int type) { /* path must not be null */ if (path == null) { String message = Messages.resources_pathNull; return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); } return validatePath(Path.fromOSString(path), type, false); }
public IStatus validatePath(String path, int type) { /* path must not be null */ if (path == null) { String message = Messages.resources_pathNull; return new ResourceStatus(IResourceStatus.INVALID_VALUE, null, message); } return validatePath(Path.fromOSString(path), type, false); }
private boolean isDirectChildOfWorkspaceRootFolder(File location) { IWorkspace workspace = ResourcesPlugin.getWorkspace(); IPath rootLocationPath = workspace.getRoot().getLocation(); IPath locationPath = Path.fromOSString(location.getPath()); return rootLocationPath.equals(locationPath) || rootLocationPath.equals(locationPath.removeLastSegments(1)); }
public void widgetSelected(SelectionEvent event) { String temp= fAntText.getText(); IPath path= Path.fromOSString(temp); String file= path.lastSegment(); if (file == null) file= "javadoc.xml";//$NON-NLS-1$ path= path.removeLastSegments(1); String selected= handleFolderBrowseButtonPressed(path.toOSString(), JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbrowsedialog_title, JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbrowsedialog_label); path= Path.fromOSString(selected).append(file); fAntText.setText(path.toOSString()); } });
/** * Returns the path of the location chosen by the user. According to the user input, the path either points to the * workspace or to a valid user specified location on the filesystem. * * @return The path of the location chosen by the user. Is never <code>null</code>. */ public IPath getLocationPath() { if(isInWorkspace()) { return Platform.getLocation(); } return Path.fromOSString(locationCombo.getText().trim()); }
public IPath getLocation() { if (isUseDefaultSelected()) { return Platform.getLocation(); } return Path.fromOSString(fLocation.getText().trim()); }
private void addFileIfMatch(File file, FileToPathMap result, IPath baseDir, IPath destination) { IPath relativePath = Path.fromOSString(file.getAbsolutePath()).makeRelativeTo(baseDir); IPath destinationPath = destination.append(relativePath); if (matches(relativePath)) { result.put(file, destinationPath); } } }
/** * Stores the widget values in the JAR package. */ @Override protected void updateModel() { super.updateModel(); String comboText= fAntScriptNamesCombo.getText(); IPath path= Path.fromOSString(comboText); if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null) path= path.addFileExtension(ANTSCRIPT_EXTENSION); fAntScriptLocation= getAbsoluteLocation(path); }
/** * Stores the widget values in the JAR package. */ @Override protected void updateModel() { super.updateModel(); String comboText= fAntScriptNamesCombo.getText(); IPath path= Path.fromOSString(comboText); if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null) path= path.addFileExtension(ANTSCRIPT_EXTENSION); fAntScriptLocation= getAbsoluteLocation(path); }
/** * Stores the widget values in the JAR package. */ @Override protected void updateModel() { super.updateModel(); String comboText= fAntScriptNamesCombo.getText(); IPath path= Path.fromOSString(comboText); if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null) path= path.addFileExtension(ANTSCRIPT_EXTENSION); fAntScriptLocation= getAbsoluteLocation(path); }