Examples of IPath


Examples of org.eclipse.core.runtime.IPath

    private static void getClassURLs(IJavaProject javaProject, List urls) {
        IProject project = javaProject.getProject();
        IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();

        IClasspathEntry[] paths = null;
        IPath defaultOutputLocation = null;
        try {
            paths = javaProject.getResolvedClasspath(true);
            defaultOutputLocation = javaProject.getOutputLocation();
        } catch (JavaModelException e) {
            // don't show message to user neither log it
            // BytecodeOutlinePlugin.log(e, IStatus.ERROR);
        }
        if (paths != null) {
            IPath projectPath = javaProject.getProject().getLocation();
            for (int i = 0; i < paths.length; ++i) {
                IClasspathEntry cpEntry = paths[i];
                IPath p = null;
                if (cpEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                    // filter out source container - there are unused for class
                    // search - add bytecode output location instead
                    p = cpEntry.getOutputLocation();
                    if (p == null) {
                        // default output used:
                        p = defaultOutputLocation;
                    }
                } else if (cpEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
                    String projName = cpEntry.getPath().toPortableString()
                        .substring(1);
                    IProject proj = workspaceRoot.getProject(projName);
                    IJavaProject projj = JavaCore.create(proj);
                    getClassURLs(projj, urls);
                    continue;
                } else {
                    p = cpEntry.getPath();
                }

                if (p == null) {
                    continue;
                }
                if (!p.toFile().exists()) {
                    // removeFirstSegments: remove project from relative path
                    p = projectPath.append(p.removeFirstSegments(1));
                    if (!p.toFile().exists()) {
                        continue;
                    }
                }
                try {
                    urls.add(p.toFile().toURI().toURL());
                } catch (MalformedURLException e) {
                    // don't show message to user
                    BytecodeOutlinePlugin.log(e, IStatus.ERROR);
                }
            }
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

        IJavaProject project = getJavaProject();
        if (project == null) {
            return null;
        }
        IPath path = new Path(rootPath);
        if (path.isAbsolute()) {
            IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace()
                .getRoot();
            IResource resource = workspaceRoot.findMember(path);
            IPackageFragmentRoot root1;
            if (resource == null) {
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

                // set java nature
                addJavaNature(projectName);

                // create classpath entries
                IProject project = root.getProject(projectName);
                IPath projectPath = project.getFullPath();
                int sourceLength = sourceFolders.length;
                int libLength = libraries.length;

                IClasspathEntry[] entries = new IClasspathEntry[sourceLength
                    + libLength];
                for (int i = 0; i < sourceLength; i++) {
                    IPath sourcePath = new Path(sourceFolders[i]);
                    int segmentCount = sourcePath.segmentCount();
                    if (segmentCount > 0) {
                        // create folder and its parents
                        IContainer container = project;
                        for (int j = 0; j < segmentCount; j++) {
                            IFolder folder = container.getFolder(new Path(
                                sourcePath.segment(j)));
                            if (!folder.exists()) {
                                folder.create(true, true, null);
                            }
                            container = folder;
                        }
                    }

                    // create source entry
                    entries[i] = JavaCore.newSourceEntry(
                        projectPath.append(sourcePath), new IPath[0],
                        new IPath[0], null);
                }

                for (int i = 0; i < libLength; i++) {
                    String lib = libraries[i];
                    if (lib.startsWith("JCL")) {
                        // ensure JCL variables are set
                         try {
                            setUpJCLClasspathVariables(compliance);
                        } catch (IOException e) {
                            e.printStackTrace();
                        }
                    }

                    if (lib.indexOf(File.separatorChar) == -1
                        && lib.charAt(0) != '/'
                        && lib.equals(lib.toUpperCase())) { // all upper case is a var
                        char[][] vars = CharOperation.splitOn(',', lib
                            .toCharArray());
                        entries[sourceLength + i] = JavaCore.newVariableEntry(
                            new Path(new String(vars[0])), vars.length > 1
                                ? new Path(new String(vars[1]))
                                : null, vars.length > 2
                                ? new Path(new String(vars[2]))
                                : null);
                    } else {
                        IPath libPath = new Path(lib);
                        if (!libPath.isAbsolute() && libPath.segmentCount() > 0
                            && libPath.getFileExtension() == null) {
                            project.getFolder(libPath).create(true, true, null);
                            libPath = projectPath.append(libPath);
                        }
                        entries[sourceLength + i] = JavaCore.newLibraryEntry(
                            libPath, null, null, ClasspathEntry.getAccessRules(
                                new IPath[0], new IPath[0]),
                            new IClasspathAttribute[0], false);
                    }
                }

                // create project's output folder
                IPath outputPath = new Path(projectOutput);
                if (outputPath.segmentCount() > 0) {
                    IFolder output = project.getFolder(outputPath);
                    if (!output.exists()) {
                        output.create(true, true, null);
                    }
                }
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

        options.put(CompilerOptions.OPTION_TargetPlatform, version);
        javaProject.setOptions(options);

        // replace JCL_LIB with JCL15_LIB, and JCL_SRC with JCL15_SRC
        IClasspathEntry[] classpath = javaProject.getRawClasspath();
        IPath jclLib = new Path(jclLibString);
        for (int i = 0, length = classpath.length; i < length; i++) {
            IClasspathEntry entry = classpath[i];
            if (entry.getPath().equals(jclLib)) {
                classpath[i] = JavaCore.newVariableEntry(
                    new Path(newJclLibString), null, entry
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

            return newProject;
        }
        final IProject newProjectHandle = mainPage.getProjectHandle();

        // get a project descriptor
        IPath newPath = null;
        if (!mainPage.useDefaults())
            newPath = mainPage.getLocationPath();

        IWorkspace workspace = ResourcesPlugin.getWorkspace();
        final IProjectDescription description = workspace
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

   
    private void createOutputLocation(IJavaProject project)
            throws JavaModelException, CoreException {
        IFolder ifolder = project.getProject().getFolder("bin");
        createFolder(ifolder);
        IPath ipath = ifolder.getFullPath();
        project.setOutputLocation(ipath, null);
    }
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

                        URL url = getRawLocationURL(path.getPath());
                        pathElements.add(url);
                    }
                }
            }
            IPath location = getProjectLocation(project.getProject());
            IPath outputPath = location.append(project.getOutputLocation()
                    .removeFirstSegments(1));
            pathElements.add(outputPath.toFile().toURL());
           
            // also add classpath of required projects
            String[] names = project.getRequiredProjectNames();
            for ( int i = 0; i < names.length; i++ ) {
                String projectName = names[i];
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

   
      // filter out unmodified variables
      int discardCount = 0;
      for (int i = 0; i < varLength; i++){
        String variableName = this.variableNames[i];
        IPath oldPath = manager.variableGet(variableName); // if reentering will provide previous session value
        if (oldPath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS) {
          oldPath = null//33695 - cannot filter out restored variable, must update affected project to reset cached CP
        }
        if (oldPath != null && oldPath.equals(this.variablePaths[i])){
          this.variableNames[i] = null;
          discardCount++;
        }
      }
      if (discardCount > 0){
        if (discardCount == varLength) return;
        int changedLength = varLength - discardCount;
        String[] changedVariableNames = new String[changedLength];
        IPath[] changedVariablePaths = new IPath[changedLength];
        for (int i = 0, index = 0; i < varLength; i++){
          if (this.variableNames[i] != null){
            changedVariableNames[index] = this.variableNames[i];
            changedVariablePaths[index] = this.variablePaths[i];
            index++;
          }
        }
        this.variableNames = changedVariableNames;
        this.variablePaths = changedVariablePaths;
        varLength = changedLength;
      }
     
      if (isCanceled())
        return;
 
      IJavaProject[] projects = model.getJavaProjects();
      nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){
        JavaProject project = (JavaProject) projects[i];
           
        // check to see if any of the modified variables is present on the classpath
        IClasspathEntry[] classpath = project.getRawClasspath();
        for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
         
          IClasspathEntry entry = classpath[j];
          for (int k = 0; k < varLength; k++){
 
            String variableName = this.variableNames[k];           
            if (entry.getEntryKind() ==  IClasspathEntry.CPE_VARIABLE){
 
              if (variableName.equals(entry.getPath().segment(0))){
                affectedProjectClasspaths.put(project, project.getResolvedClasspath());
                continue nextProject;
              }
              IPath sourcePath, sourceRootPath;
              if (((sourcePath = entry.getSourceAttachmentPath()) != null  && variableName.equals(sourcePath.segment(0)))
                || ((sourceRootPath = entry.getSourceAttachmentRootPath()) != null  && variableName.equals(sourceRootPath.segment(0)))) {
 
                affectedProjectClasspaths.put(project, project.getResolvedClasspath());
                continue nextProject;
              }
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

      ArrayList collector) {
    for (int i = 0, max = nonJavaResources.length; i < max; i++) {
      Object nonJavaResource = nonJavaResources[i];
      if (nonJavaResource instanceof IFile) {
        IFile file = (IFile) nonJavaResource;
        IPath path = file.getFullPath().removeFirstSegments(rootPathSegmentCounts);
        IResource member = container.findMember(path);
        if (member != null && member.exists()) {
          collector.add(member);
        }
      } else if (nonJavaResource instanceof IFolder) {
View Full Code Here

Examples of org.eclipse.core.runtime.IPath

   * @see #setClasspathVariable(String, IPath)
   */
  public static IPath getClasspathVariable(final String variableName) {

      JavaModelManager manager = JavaModelManager.getJavaModelManager();
    IPath variablePath = manager.variableGet(variableName);
    if (variablePath == JavaModelManager.VARIABLE_INITIALIZATION_IN_PROGRESS){
        return manager.getPreviousSessionVariable(variableName);
    }

    if (variablePath != null) {
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.