Java Code Examples for org.eclipse.core.runtime.IPath#SEPARATOR
The following examples show how to use
org.eclipse.core.runtime.IPath#SEPARATOR .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModuleSpecifierSelectionDialog.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public String isValid(String newText) { IPath path = new Path(newText); String fileExtension = path.getFileExtension(); String moduleName = path.removeFileExtension().lastSegment(); if (path.removeFileExtension().segmentCount() < 1 || moduleName.isEmpty()) { return "The module name must not be empty."; } if (!isValidFolderName(path.removeFileExtension().toString())) { return "The module name is not a valid file system name."; } if (fileExtension == null) { return "The module name needs to have a valid N4JS file extension."; } if (!(fileExtension.equals(N4JSGlobals.N4JS_FILE_EXTENSION) || fileExtension.equals(N4JSGlobals.N4JSD_FILE_EXTENSION))) { return "Invalid file extension."; } if (!isModuleFileSpecifier(path)) { return "Invalid module file specifier."; } if (path.segmentCount() > 1) { return IPath.SEPARATOR + " is not allowed in a module file specifier."; } if (treeViewer.getStructuredSelection().getFirstElement() == null) { return "Please select a module container"; } return null; }
Example 2
Source File: CompareInputResourceProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected IResource getResource(ITypedElement typedElement) { if (typedElement == null) { return null; } IResource result = null; if (typedElement instanceof IResourceProvider) { IResourceProvider resourceProvider = (IResourceProvider) typedElement; result = resourceProvider.getResource(); } else if (typedElement instanceof org.eclipse.team.internal.ui.StorageTypedElement) { org.eclipse.team.internal.ui.StorageTypedElement storageTypedElement = (org.eclipse.team.internal.ui.StorageTypedElement) typedElement; IStorage bufferedStorage = storageTypedElement.getBufferedStorage(); result = getExistingFile(bufferedStorage != null ? bufferedStorage.getFullPath() : Path.EMPTY); } if (result == null) { IProject projectFromInput = getProjectFromInput(); List<String> path = getPath(typedElement); for (int i = 0; i < path.size() && result == null; i++) { IProject project = getWorkspaceRoot().getProject(path.get(i)); String subPath = IPath.SEPARATOR + Joiner.on(IPath.SEPARATOR).join(path.subList(i, path.size())); if (project.exists()) { result = getExistingFile(new Path(subPath)); } else if (projectFromInput != null) { String pathInProject = IPath.SEPARATOR + projectFromInput.getName() + subPath; result = getExistingFile(new Path(pathInProject)); } } } return result; }
Example 3
Source File: TracePackageTraceElement.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static String append(String path, String str) { if (!path.isEmpty()) { return path + IPath.SEPARATOR + str; } return str; }
Example 4
Source File: JDSourceMapper.java From jd-eclipse with GNU General Public License v3.0 | 5 votes |
@Override @SuppressWarnings("rawtypes") public char[] findSource(String javaSourcePath) { char[] source = null; // Search source file if (this.rootPaths == null) { source = super.findSource(javaSourcePath); } else { Iterator iterator = this.rootPaths.iterator(); while (iterator.hasNext() && (source == null)) { String sourcesRootPath = (String)iterator.next(); source = super.findSource(sourcesRootPath + IPath.SEPARATOR + javaSourcePath); } } if ((source == null) && javaSourcePath.toLowerCase().endsWith(JAVA_SOURCE_SUFFIX)) { String internalTypeName = javaSourcePath.substring(0, javaSourcePath.length()-JAVA_SOURCE_SUFFIX_LENGTH); // Decompile class file try { source = decompile(this.basePath.getAbsolutePath(), internalTypeName); } catch (Exception e) { JavaDecompilerPlugin.getDefault().getLog().log(new Status( Status.ERROR, JavaDecompilerPlugin.PLUGIN_ID, 0, e.getMessage(), e)); } } return source; }
Example 5
Source File: ExtLibDesignElementLookup.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public String getCode(int index) { DesignerDesignElement designElement = getDesignElement( index ); IPath desPath = designElement.getResource().getProjectRelativePath(); if (bStartResultWithSep) return IPath.SEPARATOR + desPath.removeFirstSegments(folderCount).toString(); else return desPath.removeFirstSegments(folderCount).toString(); }
Example 6
Source File: LanguageSettingsScannerInfoProvider.java From cdt-proc with Eclipse Public License 1.0 | 5 votes |
/** * Convert path delimiters to OS representation avoiding using org.eclipse.core.runtime.Path * being careful to preserve "../" segments and not let collapsing them which is not correct for symbolic links. */ private static String toOSString(String loc) { // use OS file separators (i.e. '\' on Windows) if (java.io.File.separatorChar != IPath.SEPARATOR) { loc = loc.replace(IPath.SEPARATOR, java.io.File.separatorChar); } return loc; }
Example 7
Source File: CompPlugin.java From junion with BSD 3-Clause "New" or "Revised" License | 4 votes |
protected void doFinish(IJavaProject project) { if(project != null ) { try { ProjectData data = cache.get(project); if(data == null) { log("Unexpected error: project data is null"); Thread.dumpStack(); return; } String genFolder = data.properties.getProperty(GEN_FOLDER).trim(); String projectName = project.getProject().getName(); char SEP = IPath.SEPARATOR; String genFolderPathRelative = SEP+projectName+SEP+genFolder; data.paths.clear(); PerProjectInfo info = ((JavaProject)project).getPerProjectInfo(); IClasspathEntry raw[] = info.rawClasspath; if(raw != null) { for(IClasspathEntry entry : raw) { if(entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { String srcPath = entry.getPath().toString(); if(srcPath.equals(genFolderPathRelative)) { setPaths(entry, ALL_PATHS); } else { setPaths(entry, NONE_PATHS); } } } } IFolder file = project.getProject().getFolder(genFolder); file.refreshLocal(IResource.DEPTH_INFINITE, null); } catch (Exception e) { e.printStackTrace(); } } }
Example 8
Source File: N4JSClassifierWizardModelValidator.java From n4js with Eclipse Public License 1.0 | 2 votes |
/** * Returns true if the given module specifier is specifying a file. * * Returns false for empty specifiers. * * @param specifier * The module specifier */ protected boolean isFileSpecifyingModuleSpecifier(String specifier) { return specifier.length() > 0 && specifier.charAt(specifier.length() - 1) != IPath.SEPARATOR; }