Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.Path.segment()


      try {

        IJavaProject project = JavaCore.create(Util.getProject(projectText));
        IPath moduleXmlPath = new Path(moduleText);
        root = project.findPackageFragmentRoot(new Path("/").append(projectText).append(moduleXmlPath.segment(0)));//$NON-NLS-1$

      } catch (JavaModelException e) {
        Activator.logException(e);
      }
    }
View Full Code Here


      IStructuredModel model = ((IDOMNode) node).getModel();
      String baseLocation = model.getBaseLocation();
      if (!baseLocation.equals(IModelManager.UNMANAGED_MODEL)) {
        IPath path = new Path(baseLocation);
        if (path.segmentCount() > 1) {
          IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(path.segment(0));
          if (project.isAccessible()) {
            String key = createPreferenceKey(path);
            IEclipsePreferences preferences = new ProjectScope(project).getNode(JSPCorePlugin.getDefault().getBundle().getSymbolicName());
            type = preferences.get(key, DEFAULT_MIMETYPE);
          }
View Full Code Here

              IPath basePath = new Path(model.getBaseLocation());
              IResource derivedResource = null;
              if (basePath.segmentCount() > 1)
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
              else
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0));
              IPath derivedPath = derivedResource.getLocation();
              if (derivedPath != null) {
                baseLocation = derivedPath.toString();
              }
              else {
View Full Code Here

      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
      }
      if (baseResource == null && baseIPath.segmentCount() == 1) {
        baseResource = workspaceRoot.getProject(baseIPath.segment(0));
      }
    }

    if (baseResource == null) {
      /*
 
View Full Code Here

      IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(baseIPath);
      if (files.length > 0)
        baseResource = files[0];
    }
    if (baseResource != null) {
      project = ResourcesPlugin.getWorkspace().getRoot().getProject(baseIPath.segment(0));
      if (project.isAccessible()) {
        ProjectDescription description = createDescription(project);
        resolved = description.resolve(basePath, reference);
      }
    }
View Full Code Here

              IPath basePath = new Path(model.getBaseLocation());
              IResource derivedResource = null;
              if (basePath.segmentCount() > 1)
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
              else
                derivedResource = ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0));
              IPath derivedPath = derivedResource.getLocation();
              if (derivedPath != null) {
                baseLocation = derivedPath.toString();
              }
              else {
View Full Code Here

      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=79686
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      IPath filePath = new Path(baseLocation);
      IProject project = null;
      if (filePath.segmentCount() > 0) {
        project = root.getProject(filePath.segment(0));
      }
//      IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(baseLocation));
//      for (int i = 0; project == null && i < files.length; i++) {
//        if (files[i].getType() != IResource.PROJECT) {
//          project = files[i].getProject();
View Full Code Here

          }
        }
        else {
          IPath basePath = new Path(baseLocation);
          if (basePath.segmentCount() > 1) {
            return createJavaElementHyperlink(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0))), elementName, region);
          }
        }
      }
    }
    finally {
View Full Code Here

          }
        }
        else {
          IPath basePath = new Path(baseLocation);
          if (basePath.segmentCount() > 1) {
            return createJavaElementHyperlink(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0))), elementName, region);
          }
        }
      }

    }
View Full Code Here

      // https://bugs.eclipse.org/bugs/show_bug.cgi?id=79686
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      IPath filePath = new Path(baseLocation);
      IProject project = null;
      if (filePath.segmentCount() > 0) {
        project = root.getProject(filePath.segment(0));
      }
//      IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(baseLocation));
//      for (int i = 0; project == null && i < files.length; i++) {
//        if (files[i].getType() != IResource.PROJECT) {
//          project = files[i].getProject();
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.