Package org.eclipse.core.runtime

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


        dialog.showClosedProjects(false);
        dialog.open();
        Object[] results = dialog.getResult();
        if ((results != null) && (results.length > 0) && (results[0] instanceof IPath)) {
            IPath path = (IPath) results[0];
            String containerName = path.makeRelative().toString();
            setOtherWorkingDirectoryText("${workspace_loc:" + containerName + "}"); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    /**
 
View Full Code Here


      p = new Path(path);
    }
    if (!p.hasTrailingSeparator()){
      p = p.uptoSegment(p.segmentCount() - 1);
    }
    return p.makeRelative().addTrailingSeparator().toOSString();
  }

  /**
   * Gets the full path from the supplied path by removing any trailing path
   * segments that do not have a trailing separator.
View Full Code Here

      // 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

      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));
    }
    if (this.sourceAttachmentRootPath != null) {
View Full Code Here

        parameters.put(tagName, tagValue);
      }

    if (this.specificOutputLocation != null) {
      IPath outputLocation = this.specificOutputLocation.removeFirstSegments(1);
      outputLocation = outputLocation.makeRelative();
      parameters.put(TAG_OUTPUT, String.valueOf(outputLocation));
    }

    boolean hasExtraAttributes = this.extraAttributes.length != 0;
    boolean hasRestrictions = getAccessRuleSet() != null; // access rule set is null if no access rules
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

        if (index == 0) {
          // custom output is nested in project's output: need to check if all source entries have a custom
          // output before complaining
          if (potentialNestedOutput == null) potentialNestedOutput = customOutput;
        } else {
          return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestOutputInOutput, new String[] {customOutput.makeRelative().toString(), outputLocations[index].makeRelative().toString()}));
        }
      }
    }
    // allow custom output nesting in project's output if all source entries have a custom output
    if (sourceEntryCount <= outputCount-1) {
View Full Code Here

      // no further check if entry coincidates with project or output location
      if (entryPath.equals(projectPath)){
        // complain if self-referring project entry
        if (kind == IClasspathEntry.CPE_PROJECT){
          return new JavaModelStatus(IJavaModelStatusConstants.INVALID_PATH, Messages.bind(Messages.classpath_cannotReferToItself, entryPath.makeRelative().toString()));
        }
        // tolerate nesting output in src if src==prj
        continue;
      }
View Full Code Here

      for (int j = 0; j < outputCount; j++){
        IPath currentOutput = outputLocations[j];
        if (entryPath.equals(currentOutput)) continue;
        if (entryPath.isPrefixOf(currentOutput)) {
            if (kind != IClasspathEntry.CPE_SOURCE || !Util.isExcluded(currentOutput, inclusionPatterns, exclusionPatterns, true)) {
            return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestOutputInEntry, new String[] {currentOutput.makeRelative().toString(), entryPath.makeRelative().toString()}));
            }
        }
      }

      // prevent nesting entry inside output location - when distinct from project or a source folder
View Full Code Here

      // prevent nesting entry inside output location - when distinct from project or a source folder
      for (int j = 0; j < outputCount; j++){
        if (allowNestingInOutputLocations[j]) continue;
        IPath currentOutput = outputLocations[j];
        if (currentOutput.isPrefixOf(entryPath)) {
          return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_cannotNestEntryInOutput, new String[] {entryPath.makeRelative().toString(), currentOutput.makeRelative().toString()}));
        }
      }
    }
    // ensure that no specific output is coincidating with another source folder (only allowed if matching current source folder)
    // 36465 - for 2.0 backward compatibility, only check specific output locations (the default can still coincidate)
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.