Package org.eclipse.core.runtime

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


  private IFile getFile(String fileString) {
    IFile file = null;

    if (fileString != null) {
      Path filePath = new Path(fileString);
      if (filePath.segmentCount() > 1 && ResourcesPlugin.getWorkspace().getRoot().getFile(filePath).exists()) {
        return ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
      }
      IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(filePath);
      for (int i = 0; i < files.length && file == null; i++)
        if (files[i].exists())
View Full Code Here


      // because of FileBuffers, so this code had to be updated
      // 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) {
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

  private IFile getFile(IStructuredModel model) {
    String location = model.getBaseLocation();
    if (location != null) {
      IPath path = new Path(location);
      if (path.segmentCount() > 1) {
        return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      }
    }
    return null;
  }
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

      // copied from JSPTranslationAdapter#getJavaProject
      IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
      IPath filePath = new Path(baselocation);
      IFile file = null;

      if (filePath.segmentCount() > 1) {
        file = root.getFile(filePath);
      }
      if (file != null) {
        resource = file.getProject();
      }
View Full Code Here

      // because of FileBuffers, so this code had to be updated
      // 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) {
View Full Code Here

        String baseLocation = model.getBaseLocation();
        // The baseLocation may be a path on disk or relative to the
        // workspace root. Don't translate on-disk paths to
        // in-workspace resources.
        IPath basePath = new Path(baseLocation);
        if (basePath.segmentCount() > 1) {
          file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
          /*
           * If the IFile doesn't exist, make sure it's not returned
           */
          if (!file.exists())
View Full Code Here

        String baseLocation = model.getBaseLocation();
        // The baseLocation may be a path on disk or relative to the
        // workspace root. Don't translate on-disk paths to
        // in-workspace resources.
        IPath basePath = new Path(baseLocation);
        if (basePath.segmentCount() > 1) {
          file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
          /*
           * If the IFile doesn't exist, make sure it's not returned
           */
          if (!file.exists())
View Full Code Here

            }
          }
        }
        else {
          IPath basePath = new Path(baseLocation);
          if (basePath.segmentCount() > 1) {
            IJavaProject javaProject = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(basePath.segment(0)));
            if (javaProject.exists()) {
              try {
                // TLDs don't reference method names
                IType type = javaProject.findType(elementName);
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.