Package org.eclipse.core.runtime

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


            // TODO: URI validation?
            if (false && actualValue.indexOf('#') < 0 && actualValue.indexOf(":/") == -1 && CMUtil.isHTML(edec)) { //$NON-NLS-1$ //$NON-NLS-2$
              IStructuredDocumentRegion start = ((IDOMNode) node).getStartStructuredDocumentRegion();
              if (start != null && start.getFirstRegion().getTextLength() == 1) {
                IPath basePath = new Path(((IDOMNode) node).getModel().getBaseLocation());
                if (basePath.segmentCount() > 1) {
                  IPath path = ModuleCoreSupport.resolve(basePath, actualValue);
                  IResource found = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
                  if (found == null || !found.isAccessible()) {
                    rgnType = REGION_VALUE;
                    state = ErrorState.RESOURCE_NOT_FOUND;
View Full Code Here


              baseLocation = file.getAbsolutePath();
            }
            else {
              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) {
View Full Code Here

        }
      }
      else {
        // try to locate the file in the workspace
        IPath path = new Path(uriString);
        if (path.segmentCount() > 1) {
          IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
          if (file.getType() == IResource.FILE && file.isAccessible()) {
            if (node != null) {
              link = new TLDFileHyperlink(file, TAG, node.getLocalName(), hyperlinkRegion) {
                public String getHyperlinkText() {
View Full Code Here

    IResource baseResource = FileBuffers.getWorkspaceFileAtLocation(baseIPath);

    if (baseResource == null) {
      IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
      // Try the base path as a folder first
      if (baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFolder(baseIPath);
      }
      // If not a folder, then try base path as a file
      if (baseResource != null && !baseResource.exists() && baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFile(baseIPath);
View Full Code Here

      // Try the base path as a folder first
      if (baseIPath.segmentCount() > 1) {
        baseResource = workspaceRoot.getFolder(baseIPath);
      }
      // 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));
      }
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

          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 && !basePath.toFile().exists()) {
            file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
          }
        }
      }
      finally {
View Full Code Here

              baseLocation = file.getAbsolutePath();
            }
            else {
              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) {
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

  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

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.