Codota Logo
IPath.lastSegment
Code IndexAdd Codota to your IDE (free)

How to use
lastSegment
method
in
org.eclipse.core.runtime.IPath

Best Java code snippets using org.eclipse.core.runtime.IPath.lastSegment (Showing top 20 results out of 855)

  • Common ways to obtain IPath
private void myMethod () {
IPath i =
  • Codota IconString fullPath;new Path(fullPath)
  • Codota IconIResource resource;resource.getLocation()
  • Codota IconIResource resource;resource.getFullPath()
  • Smart code suggestions by Codota
}
origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public String getElementName() {
  return this.externalPath.lastSegment();
}
/**
origin: org.eclipse/org.eclipse.jst.j2ee

protected boolean isSource(IPath path) {
  if (path == null)
    return false;
  return path.lastSegment().endsWith(JavaEEArchiveUtilities.DOT_JAVA) || path.lastSegment().endsWith(DOT_SQLJ);
}
origin: org.eclipse/org.eclipse.compare

private IPath getRejectFilePath(IPath path) {
  IPath pp= null;
  if (path.segmentCount() > 1) {
    pp= path.removeLastSegments(1);
    pp= pp.append(path.lastSegment() + REJECT_FILE_EXTENSION);
  } else
    pp= new Path(path.lastSegment() + REJECT_FILE_EXTENSION);
  return pp;
}

origin: org.eclipse/org.eclipse.jst.j2ee

/**
 * Retrieves the archive name for the specified classpath entry
 * @param entry The entry.
 * @return The archive name.
 */
public static String getArchiveName(final IClasspathEntry entry) {
  final IPath entryLocation = getEntryLocation(entry);
  return entryLocation.lastSegment();
}

origin: org.eclipse.equinox.frameworkadmin/equinox

public static File fromOSGiJarToOSGiInstallArea(String path) {
  IPath parentFolder = new Path(path).removeLastSegments(1);
  if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$
    return parentFolder.removeLastSegments(1).toFile();
  return parentFolder.toFile();
}
origin: org.eclipse.platform/org.eclipse.equinox.frameworkadmin.equinox

public static File fromOSGiJarToOSGiInstallArea(String path) {
  IPath parentFolder = new Path(path).removeLastSegments(1);
  if ("plugins".equalsIgnoreCase(parentFolder.lastSegment())) //$NON-NLS-1$
    return parentFolder.removeLastSegments(1).toFile();
  return parentFolder.toFile();
}
origin: org.eclipse.jdt/org.eclipse.jdt.core

@Override
public IPath[] enclosingProjectsAndJars() {
  IPath[] unfiltered = this.searchScope.enclosingProjectsAndJars();
  
  List<IPath> result = new ArrayList<>();
  
  for (IPath next : unfiltered) {
    if (isJarFile(next.lastSegment())) {
      continue;
    }
    result.add(next);
  }
  return result.toArray(new IPath[result.size()]);
}
origin: eclipse/buildship

private IRuntimeClasspathEntry[] resolveOptional(IRuntimeClasspathEntry entry) throws CoreException {
  if (isOptional(entry.getClasspathEntry())) {
    return EMPTY_RESULT;
  } else {
    throw new CoreException(new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID,
        String.format("The project: %s which is referenced by the classpath, does not exist", entry.getPath().lastSegment())));
  }
}
origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Returns the java project that corresponds to the given path.
 * Returns null if the path doesn't correspond to a project.
 */
private static IJavaProject getJavaProject(IPath path, IJavaModel model) {
  IJavaProject project = model.getJavaProject(path.lastSegment());
  if (project.exists()) {
    return project;
  }
  return null;
}

origin: org.eclipse/org.eclipse.jdt.ui

  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());
  }
});
origin: org.eclipse.platform/org.eclipse.core.resources

/**
 * Replaces the node at the specified key with the given node
 */
protected void replaceNode(IPath key, DataTreeNode node) {
  DataTreeNode found;
  if (key.isRoot()) {
    this.setRootNode(node);
  } else {
    found = this.findNodeAt(key.removeLastSegments(1));
    found.replaceChild(key.lastSegment(), node);
  }
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

public UnpackJarBuilder(JarPackageData jarPackage) {
  fSubfolder= jarPackage.getAbsoluteJarLocation().removeFileExtension().lastSegment() + SUBFOLDER_SUFFIX;
  fSubfolderPath= jarPackage.getAbsoluteJarLocation().removeLastSegments(1).append(fSubfolder);
  fJarPackage= jarPackage;
}
origin: org.eclipse/org.eclipse.jst.j2ee

protected boolean shouldSave(IArchiveResource aFile) {
  if (endsWithClassType(aFile.getPath().lastSegment())) {
    boolean shouldSave = isClassWithoutSource(aFile);
    if (shouldSave && !importedClassesFolderCreated) {
      createImportedClassesFolder();
    }
    return shouldSave;
  }
  return super.shouldSave(aFile);
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources

/**
 * @see AbstractDataTreeNode#compareWithParent(IPath, DeltaDataTree, IComparator)
 */
@Override
AbstractDataTreeNode compareWithParent(IPath key, DeltaDataTree parent, IComparator comparator) {
  AbstractDataTreeNode[] comparedChildren = compareWithParent(children, key, parent, comparator);
  Object oldData = parent.getData(key);
  return new DataTreeNode(key.lastSegment(), new NodeComparison(oldData, oldData, NodeComparison.K_CHANGED, 0), comparedChildren);
}
origin: at.bestsolution.efxclipse.eclipse/org.eclipse.core.resources

/**
 * Replaces the node at the specified key with the given node
 */
protected void replaceNode(IPath key, DataTreeNode node) {
  DataTreeNode found;
  if (key.isRoot()) {
    this.setRootNode(node);
  } else {
    found = this.findNodeAt(key.removeLastSegments(1));
    found.replaceChild(key.lastSegment(), node);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.core.resources

/**
 * Replaces the node at the specified key with the given node
 */
protected void replaceNode(IPath key, DataTreeNode node) {
  DataTreeNode found;
  if (key.isRoot()) {
    this.setRootNode(node);
  } else {
    found = this.findNodeAt(key.removeLastSegments(1));
    found.replaceChild(key.lastSegment(), node);
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private String getPathString(IPath path, boolean isExternal) {
  if (ArchiveFileFilter.isArchivePath(path, true)) {
    String appended= BasicElementLabels.getPathLabel(path.removeLastSegments(1), isExternal);
    String lastSegment= BasicElementLabels.getResourceName(path.lastSegment());
    return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { lastSegment, appended });
  } else {
    return BasicElementLabels.getPathLabel(path, isExternal);
  }
}
origin: org.eclipse/org.eclipse.jst.jsf.core

public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
  if (isJSFLibraryContainer(containerPath)) {
    String libId= containerPath.lastSegment();
          
    JSFLibrary ref= JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(libId);
    if (ref != null) {
      JSFLibraryClasspathContainer container= new JSFLibraryClasspathContainer(ref);
      JavaCore.setClasspathContainer(containerPath, new IJavaProject[] { project }, 	new IClasspathContainer[] { container }, null);
    }
  }
}

origin: org.eclipse.jdt/org.eclipse.jdt.ui

private String getPathString(IPath path, boolean isExternal) {
  if (ArchiveFileFilter.isArchivePath(path, true)) {
    String appended= BasicElementLabels.getPathLabel(path.removeLastSegments(1), isExternal);
    String lastSegment= BasicElementLabels.getResourceName(path.lastSegment());
    return Messages.format(NewWizardMessages.CPListLabelProvider_twopart, new String[] { lastSegment, appended });
  } else {
    return BasicElementLabels.getPathLabel(path, isExternal);
  }
}
origin: org.eclipse.pde/org.eclipse.pde.ui

@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();
}
org.eclipse.core.runtimeIPathlastSegment

Javadoc

Returns the last segment of this path, or null if it does not have any segments.

Popular methods of IPath

  • toString
    Returns a string representation of this path, including its device id. The same separator, "/", is u
  • toFile
    Returns a java.io.File corresponding to this path.
  • toOSString
    Returns a string representation of this path which uses the platform-dependent path separator define
  • append
    Returns the canonicalized path obtained from the concatenation of the given path's segments to the e
  • segmentCount
    Returns the number of segments in this path. Note that both root and empty paths have 0 segments.
  • removeLastSegments
    Returns a copy of this path with the given number of segments removed from the end. The device id is
  • removeFirstSegments
    Returns a copy of this path with the given number of segments removed from the beginning. The device
  • segment
    Returns the specified segment of this path, ornull if the path does not have such a segment.
  • equals
    Returns whether this path equals the given object. Equality for paths is defined to be: same sequenc
  • isAbsolute
    Returns whether this path is an absolute path (ignoring any device id). Absolute paths start with a
  • isPrefixOf
    Returns whether this path is a prefix of the given path. To be a prefix, this path's segments must a
  • toPortableString
    Returns a platform-neutral string representation of this path. The format is not specified, except t
  • isPrefixOf,
  • toPortableString,
  • makeRelative,
  • makeAbsolute,
  • getDevice,
  • isEmpty,
  • addTrailingSeparator,
  • getFileExtension,
  • setDevice

Popular in Java

  • Parsing JSON documents to java classes using gson
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getApplicationContext (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now