String msg = NLS.bind(PrefsMessages.preferences_fileNotFound, path.toOSString()); throw new CoreException(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, 1, msg, null)); service.importPreferences(input); } catch (FileNotFoundException e) { String msg = NLS.bind(PrefsMessages.preferences_fileNotFound, path.toOSString()); throw new CoreException(new Status(IStatus.ERROR, PrefsMessages.OWNER_NAME, 1, msg, e)); } finally {
private static String toOSString(IPath path) { if (path == null) { return Utilities.EMPTY_STRING; } return path.toOSString(); }
public void map(IPath file, IPath aLocation) { if (aLocation == null) table.remove(file); else table.setProperty(file.toOSString(), aLocation.toOSString()); }
/** * Creates the specified file system directory at <code>destinationPath</code>. * This creates a new file system directory. * * @param destinationPath location to which files will be written */ public void createFolder(IPath destinationPath) { new File(destinationPath.toOSString()).mkdir(); }
private String flatPathList(IPath[] paths) { StringBuffer buf= new StringBuffer(); for (int i= 0; i < paths.length; i++) { if (i > 0) { buf.append(File.pathSeparatorChar); } buf.append(paths[i].toOSString()); } return buf.toString(); }
private String flatPathList(IPath[] paths) { StringBuffer buf= new StringBuffer(); for (int i= 0; i < paths.length; i++) { if (i > 0) { buf.append(File.pathSeparatorChar); } buf.append(paths[i].toOSString()); } return buf.toString(); }
@Override public int compare(IProject p1, IProject p2) { return p2.getLocation().toOSString().length() - p1.getLocation().toOSString().length(); } }).collect(Collectors.toList());
private void processLibraryLocation(LibraryLocation[] libLocations, String label) { for (int l= 0; l < libLocations.length; l++) { LibraryLocation location= libLocations[l]; fLib2Name.put(location.getSystemLibraryPath().toOSString(), label); } }
protected String getDestination() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path.length() > 0) { path = new Path(path).removeLastSegments(1).toOSString(); return new File(path).getAbsolutePath(); } return ""; //$NON-NLS-1$ } File dir = new File(fDirectoryCombo.getText().trim()); return dir.getAbsolutePath(); }
private String getExternalAnnotationPath(IClasspathEntry entry) { if (entry == null) return null; IPath path = ClasspathEntry.getExternalAnnotationPath(entry, this.project.getProject(), true); if (path == null) return null; return path.toOSString(); }
private String getExternalAnnotationPath(IClasspathEntry entry) { if (entry == null) return null; IPath path = ClasspathEntry.getExternalAnnotationPath(entry, this.project.getProject(), true); if (path == null) return null; return path.toOSString(); }
protected String getArchiveURI() { String archiveURI = null; VirtualArchiveComponent archiveComp = (VirtualArchiveComponent) getComponent(); java.io.File diskFile = archiveComp.getUnderlyingDiskFile(); if (diskFile.exists()) archiveURI = diskFile.getAbsolutePath(); else { IFile iFile = archiveComp.getUnderlyingWorkbenchFile(); archiveURI = iFile.getRawLocation().toOSString(); } return archiveURI; }
private String getDefaultLocation() { IPath path = getRootLocation(); String projectName = (String) getProperty(PROJECT_NAME); if (projectName != null) path = path.append(projectName); return path.toOSString(); }
private String getDefaultAntPath(IJavaProject project) { if (project != null) { // The Javadoc.xml file can only be stored locally. So if // the project isn't local then we can't provide a good // default location. IPath path= project.getProject().getLocation(); if (path != null) return path.append("javadoc.xml").toOSString(); //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
private String createFileName() { String suggestedFileName = getCommit() != null ? CreatePatchOperation .suggestFileName(getCommit()) : getRepository().getWorkTree() .getName().concat(".patch"); //$NON-NLS-1$ String path = getDialogSettings().get(PATH_KEY); if (path != null) return Path.fromPortableString(path).append(suggestedFileName).toOSString(); return (new File(System.getProperty("user.dir", ""), suggestedFileName)).getPath(); //$NON-NLS-1$ //$NON-NLS-2$ }
private String getVariableString(IPath path) { String name= path.makeRelative().toString(); IPath entryPath= JavaCore.getClasspathVariable(path.segment(0)); if (entryPath != null) { String appended= entryPath.append(path.removeFirstSegments(1)).toOSString(); return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { name, appended }); } else { return name; } }
public void setLocation(IPath path) { fUseDefaults.setSelection(path == null); if (path != null) { fLocation.setText(path.toOSString()); } else { fLocation.setText(getDefaultPath(fNameGroup.getName())); } fireEvent(); }
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } /*
@Override public String getText(Object obj) { IClasspathEntry entry = (IClasspathEntry) obj; int kind = entry.getEntryKind(); if (kind == IClasspathEntry.CPE_PROJECT) return entry.getPath().segment(0); IPath path = entry.getPath(); String name = path.lastSegment(); return name + " - " //$NON-NLS-1$ + path.uptoSegment(path.segmentCount() - 1).toOSString(); }
SourceMapper createSourceMapper(IPath sourcePath, IPath rootPath) throws JavaModelException { IClasspathEntry entry = ((JavaProject) getParent()).getClasspathEntryFor(getPath()); String encoding = (entry== null) ? null : ((ClasspathEntry) entry).getSourceAttachmentEncoding(); SourceMapper mapper = new SourceMapper( sourcePath, rootPath == null ? null : rootPath.toOSString(), getJavaProject().getOptions(true),// cannot use workspace options if external jar is 1.5 jar and workspace options are 1.4 options encoding); return mapper; } /*