예제 #1
0
 /** @see IModelElement#getPath() */
 public IPath getPath() {
   ProjectFragment root = this.getProjectFragment();
   if (root.isArchive()) {
     // Ebay MOD to support js file in jar
     return new Path(root.getPath().toPortableString() + "!").append(path);
     // Ebay MOD
   } else {
     return root.getPath().append(path);
   }
 }
예제 #2
0
 /** @see IModelElement#getResource() */
 public IResource getResource() {
   ProjectFragment root = this.getProjectFragment();
   if (root.isArchive()) {
     return root.getResource();
   } else {
     if (path.segmentCount() == 0) return root.getResource();
     IContainer container = (IContainer) root.getResource();
     if (container != null) {
       return container.getFolder(path);
     }
     return null;
   }
 }
예제 #3
0
  protected boolean buildStructure(
      OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource)
      throws ModelException {
    // check whether this folder can be opened
    if (!underlyingResource.isAccessible()) throw newNotPresentException();

    int kind = getKind();

    if (kind == IProjectFragment.K_SOURCE && Util.isExcluded(this)) throw newNotPresentException();

    // add modules from resources
    HashSet vChildren = new HashSet();
    try {
      ProjectFragment root = getProjectFragment();
      char[][] inclusionPatterns = root.fullInclusionPatternChars();
      char[][] exclusionPatterns = root.fullExclusionPatternChars();
      IResource[] members = ((IContainer) underlyingResource).members();
      for (int i = 0, max = members.length; i < max; i++) {
        IResource child = members[i];
        if (child.getType() != IResource.FOLDER
            && !Util.isExcluded(child, inclusionPatterns, exclusionPatterns)) {
          IModelElement childElement;
          if (kind == IProjectFragment.K_SOURCE && Util.isValidSourceModule(this, child)) {
            childElement = getSourceModule(child.getName());
            vChildren.add(childElement);
          }
        }
      }
    } catch (CoreException e) {
      throw new ModelException(e);
    }

    if (kind == IProjectFragment.K_SOURCE) {
      // add primary source modules
      ISourceModule[] primarySourceModules = getSourceModules(DefaultWorkingCopyOwner.PRIMARY);
      for (int i = 0, length = primarySourceModules.length; i < length; i++) {
        ISourceModule primary = primarySourceModules[i];
        vChildren.add(primary);
      }
    }

    IModelElement[] children = new IModelElement[vChildren.size()];
    vChildren.toArray(children);
    info.setChildren(children);
    return true;
  }
예제 #4
0
 private Object[] computeForeignResources(
     IScriptProject scriptProject, IResource underlyingResource, ProjectFragment handle) {
   Object[] nonScriptResources = NO_NON_SCRIPT_RESOURCES;
   try {
     // the underlying resource may be a folder or a project (in the case
     // that the project folder
     // is actually the package fragment root)
     if (underlyingResource.getType() == IResource.FOLDER
         || underlyingResource.getType() == IResource.PROJECT) {
       nonScriptResources =
           computeFolderForeignResources(
               (ScriptProject) scriptProject,
               (IContainer) underlyingResource,
               handle.fullInclusionPatternChars(),
               handle.fullExclusionPatternChars());
     }
   } catch (ModelException e) {
     // ignore
   }
   return nonScriptResources;
 }