Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IPath.removeFirstSegments()


  private void openDialog(Shell shell){
    ImageSelectionDialog isd = new ImageSelectionDialog(shell);
    if (isd.open() == Window.OK) {
      IFile file = isd.getImageFile();
      IPath location = file.getFullPath();
      location = location.removeFirstSegments(2);
      String path = location.toString();
      if (!path.startsWith("/"))
        path += "/" + path;
      try {
        ImageIcon icon = new ImageIcon(location.toFile()
View Full Code Here


    if (this.entryKind != IClasspathEntry.CPE_VARIABLE && this.entryKind != IClasspathEntry.CPE_CONTAINER) {
      // translate to project relative from absolute (unless a device path)
      if (xmlPath.isAbsolute()) {
        if (projectPath != null && projectPath.isPrefixOf(xmlPath)) {
          if (xmlPath.segment(0).equals(projectPath.segment(0))) {
            xmlPath = xmlPath.removeFirstSegments(1);
            xmlPath = xmlPath.makeRelative();
          } else {
            xmlPath = xmlPath.makeAbsolute();
          }
        }
View Full Code Here

    if (this.sourceAttachmentPath != null) {
      xmlPath = this.sourceAttachmentPath;
      // translate to project relative from absolute
      if (this.entryKind != IClasspathEntry.CPE_VARIABLE && projectPath != null && projectPath.isPrefixOf(xmlPath)) {
        if (xmlPath.segment(0).equals(projectPath.segment(0))) {
          xmlPath = xmlPath.removeFirstSegments(1);
          xmlPath = xmlPath.makeRelative();
        }
      }
      parameters.put(TAG_SOURCEPATH, String.valueOf(xmlPath));
    }
View Full Code Here

    int rawLength = rawClasspath.length;
    HashSet pathes = new HashSet(rawLength);
    for (int i = 0 ; i < rawLength; i++) {
      IPath entryPath = rawClasspath[i].getPath();
      if (!pathes.add(entryPath)){
        String entryPathMsg = projectName.equals(entryPath.segment(0)) ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();
        return new JavaModelStatus(IJavaModelStatusConstants.NAME_COLLISION, Messages.bind(Messages.classpath_duplicateEntryPath, new String[] {entryPathMsg, projectName}));
      }
    }

    // retrieve resolved classpath
View Full Code Here

      IPath entryPath = entry.getPath();
      int kind = entry.getEntryKind();

      // Build some common strings for status message
      boolean isProjectRelative = projectName.equals(entryPath.segment(0));
      String entryPathMsg = isProjectRelative ? entryPath.removeFirstSegments(1).toString() : entryPath.makeRelative().toString();

      if (kind == IClasspathEntry.CPE_SOURCE) {
        IPath output = entry.getOutputLocation();
        if (output == null) continue; // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
        // if (output == null) output = projectOutputLocation; // if no specific output, still need to check using default output (this line would check default output)
View Full Code Here

    IPath path = entry.getPath();

    // Build some common strings for status message
    String projectName = project.getElementName();
    String entryPathMsg = projectName.equals(path.segment(0)) ? path.removeFirstSegments(1).makeRelative().toString() : path.toString();

    switch(entry.getEntryKind()){

      // container entry check
      case IClasspathEntry.CPE_CONTAINER :
View Full Code Here

        IFile file = isd.getImageFile();
        if (file == null) {
          return "";
        } else {
          IPath location = file.getFullPath();
          location = location.removeFirstSegments(2);
          String path = location.toString();
          if (path.startsWith("/"))
            return path;
          else
            return "/" + path;
View Full Code Here

  }

  public static Icon getIconFromFile(IFile file) {
    if (file != null) {
      IPath location = file.getFullPath();
      location = location.removeFirstSegments(2);
      String path = location.toString();
      if (!path.startsWith("/"))
        path = "/" + path;
      ImageIcon imgIcon;
      try {
View Full Code Here

     * of the creationPage. The first segment of the container full path
     * is the project. The rest is the policy source.
     */
    private String getPolicySource() {
        IPath fullPath = creationPage.getContainerFullPath();
        fullPath = fullPath.removeFirstSegments(1);
        fullPath = fullPath.makeRelative();
        return fullPath.toOSString();
    }

    /**
 
View Full Code Here

    tInfoLabelData.horizontalAlignment = GridData.FILL;
    tInfoLabelData.horizontalSpan = 1;
    tInfoPanel.setLayoutData(tInfoLabelData);

    IPath path = script.getFullPath().removeFileExtension();
    String pathString = path.removeFirstSegments(2).toPortableString().replaceAll("[/]", ".");
    tInfoPanel.setFilename(pathString);

    sash = new SashForm(overlay, SWT.HORIZONTAL);
    sash.setLayoutData(new GridData(GridData.FILL_BOTH));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.