Package org.eclipse.core.runtime

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


        if(f == null) {
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86009
            // must have a project name as well
            // which would mean >= 2 path segments
            IPath path = new Path(filePath);
            if(path.segmentCount() >= 2) {
                f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
            }
        }
        return f;
    }
View Full Code Here


      final String baseLocation = ((IDOMDocument) document).getModel().getBaseLocation();
      if (baseLocation == null)
        return false;
      final IPath basePath = new Path(baseLocation);
      IFile file = null;
      if (basePath.segmentCount() > 1) {
        file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
      }
      final URI uri = (file == null || !file.isAccessible()) ? new File(baseLocation).toURI() : file.getLocationURI();
      if (uri != null) {
        IExternalSchemaLocationProvider[] providers = ExternalSchemaLocationProviderRegistry.getInstance().getProviders();
View Full Code Here

        if(f == null) {
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=86009
            // must have a project name as well
            // which would mean >= 2 path segments
            IPath path = new Path(filePath);
            if(path.segmentCount() >= 2) {
                f = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
            }
        }
        return f;
    }
View Full Code Here

      sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
      if (sModel != null) {
        result = sModel.getBaseLocation();
       
        IPath path = new Path(result);
        if (path.segmentCount() > 1) {
          IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
          if (file.exists()) {
            String baseLocation = null;
            if (file.getLocation() != null) {
              baseLocation = file.getLocation().toString();
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

      IFile currentFile = null;

      for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
        // might be called with just project path?
        IPath path = new Path(uris[i]);
        if (path.segmentCount() > 1) {
          currentFile = wsRoot.getFile(path);
          if (shouldValidate(currentFile, true)) {
            validateV1File(currentFile, reporter);
          }
        }
View Full Code Here

    if (document instanceof IDOMDocument) {
      final String baseLocation = ((IDOMDocument) document).getModel().getBaseLocation();
      if (baseLocation != null) {
        final IPath basePath = new Path(baseLocation);
        IFile file = null;
        if (basePath.segmentCount() > 1) {
          file = ResourcesPlugin.getWorkspace().getRoot().getFile(basePath);
        }
        final URI uri = (file == null || !file.isAccessible()) ? new File(baseLocation).toURI() : file.getLocationURI();
        if (uri != null) {
          IExternalSchemaLocationProvider[] providers = ExternalSchemaLocationProviderRegistry.getInstance().getProviders();
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

    if (fEntry.getURI().startsWith("file:")) { //$NON-NLS-1$
      return new ExternalFileHyperlink(fHyperlinkRegion, new File(fEntry.getURI().substring(5)));
    }
    else if (fEntry.getURI().startsWith("platform:/resource/")) { //$NON-NLS-1$
      IPath path = new Path(fEntry.getURI().substring(20));
      if (path.segmentCount() > 1)
        return new WorkspaceFileHyperlink(fHyperlinkRegion, ResourcesPlugin.getWorkspace().getRoot().getFile(path));
    }
    else {
      /*
       * the URL detector will already work on the literal text, so
View Full Code Here

      IFile currentFile = null;

      for (int i = 0; i < uris.length && !reporter.isCancelled(); i++) {
        // might be called with just project path?
        IPath path = new Path(uris[i]);
        if (path.segmentCount() > 1) {
          currentFile = wsRoot.getFile(path);
          if (shouldValidate(currentFile, true)) {
            validateV1File(currentFile, reporter);
          }
        }
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.