/** * Returns the last segment of the given URI. For a hierarchical URL this returns * the last segment of the path. For opaque URIs this treats the scheme-specific * part as a path and returns the last segment. Returns <code>null</code> for * a hierarchical URI with an empty path, and for opaque URIs whose scheme-specific * part cannot be interpreted as a path. */ public static String lastSegment(URI location) { String path = location.getPath(); if (path == null) return new Path(location.getSchemeSpecificPart()).lastSegment(); return new Path(path).lastSegment(); }
/** * Returns the last segment of the given URI. For a hierarchical URL this returns * the last segment of the path. For opaque URIs this treats the scheme-specific * part as a path and returns the last segment. Returns <code>null</code> for * a hierarchical URI with an empty path, and for opaque URIs whose scheme-specific * part cannot be interpreted as a path. */ public static String lastSegment(URI location) { String path = location.getPath(); if (path == null) return new Path(location.getSchemeSpecificPart()).lastSegment(); return new Path(path).lastSegment(); }
/** * Returns the last segment of the given URI. For a hierarchical URL this returns * the last segment of the path. For opaque URIs this treats the scheme-specific * part as a path and returns the last segment. Returns <code>null</code> for * a hierarchical URI with an empty path, and for opaque URIs whose scheme-specific * part cannot be interpreted as a path. */ public static String lastSegment(URI location) { String path = location.getPath(); if (path == null) return new Path(location.getSchemeSpecificPart()).lastSegment(); return new Path(path).lastSegment(); }
@Override public String getLabel(Object element) { if (element.equals(root)) { return ((ZipEntry) element).getName(); } return new Path(((ZipEntry) element).getName()).lastSegment(); }
@Override public String getLabel(Object element) { if (element.equals(root)) { return ((ZipEntry) element).getName(); } return stripPath(new Path(((ZipEntry) element).getName()).lastSegment()); }
protected String validateAntCombo() { String path = new Path(fAntCombo.getText()).lastSegment(); if ("build.xml".equals(path)) //$NON-NLS-1$ return PDEUIMessages.ExportOptionsTab_antReservedMessage; return null; }
protected String getFileName() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path != null && path.length() > 0) { String fileName = new Path(path).lastSegment(); if (!fileName.endsWith(ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } } return null; }
protected String getFileName() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path != null && path.length() > 0) { String fileName = new Path(path).lastSegment(); if (!fileName.endsWith(ZIP_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } } return null; }
protected String getFileName() { if (fArchiveFileButton.getSelection()) { String path = fArchiveCombo.getText(); if (path != null && path.length() > 0) { String fileName = new Path(path).lastSegment(); if (!fileName.endsWith(ZIP_EXTENSION) && !fileName.endsWith(WAR_EXTENSION)) { fileName += ZIP_EXTENSION; } return fileName; } } return null; }
/** * Returns the simple name of the feature image file. * * @return the simple name of the feature image file, * or <code>null</code> if none */ public String getFeatureImageName() { if (bundleGroupProperties == null) { return null; } URL url = bundleGroupProperties.getFeatureImageUrl(); return url == null ? null : new Path(url.getPath()).lastSegment(); }
private boolean isProjectFile(Path path) { if (path == null || path.isEmpty()) { return false; } else if (!path.lastSegment().matches("(.*\\.csproj|project.json)")) { //$NON-NLS-1$ return false; } else if (!path.toFile().isFile()) { return false; } return true; }
private boolean isProjectFile(Path path) { if (path == null || path.isEmpty()) { return false; } else if (!path.lastSegment().matches("(.*\\.csproj|project.json)")) { //$NON-NLS-1$ return false; } else if (!path.toFile().isFile()) { return false; } return true; }
public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
@Override public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
@Override public IPath removeFileExtension() { String extension = getFileExtension(); if (extension == null || extension.equals("")) { //$NON-NLS-1$ return this; } String lastSegment = lastSegment(); int index = lastSegment.lastIndexOf(extension) - 1; return removeLastSegments(1).append(lastSegment.substring(0, index)); }
@Override public String getLabel(Object element) { if (element.equals(root)) { return ((TarEntry) element).getName(); } return stripPath(new Path(((TarEntry) element).getName()).lastSegment()); }
private Image getEditorImage(StagingEntry diff) { if (diff.isSubmodule()) return SUBMODULE; Image image = DEFAULT; String name = new Path(diff.getPath()).lastSegment(); if (name != null) { ImageDescriptor descriptor = PlatformUI.getWorkbench() .getEditorRegistry().getImageDescriptor(name); image = (Image) this.resourceManager.get(descriptor); } return image; }
public ImageDescriptor getImageDescriptor(Object object) { String name = new org.eclipse.core.runtime.Path(path).lastSegment(); if (name != null) { return PlatformUI.getWorkbench().getEditorRegistry() .getImageDescriptor(name); } else return PlatformUI.getWorkbench().getSharedImages() .getImageDescriptor(ISharedImages.IMG_OBJ_FILE); }
public String getName() { if (getMarker().getResource() instanceof IFile) { return ((IFile) getMarker().getResource()).getName(); } try { Path path = new Path((String) getMarker().getAttribute(FILE_PATH)); return path.lastSegment(); } catch (CoreException e) { SDBGDebugCorePlugin.logError(e); } return null; }