Java 类org.eclipse.jdt.core.IJarEntryResource 实例源码

项目:bts    文件:Storage2UriMapperJavaImpl.java   
@Override
protected URI internalGetUri(IStorage storage) {
    if (!uriValidator.isPossiblyManaged(storage))
        return null;
    URI uri = super.internalGetUri(storage);
    if (uri != null)
        return uri;
    if (storage instanceof IJarEntryResource) {
        final IJarEntryResource storage2 = (IJarEntryResource) storage;
        Map<URI, IStorage> data = getAllEntries(storage2.getPackageFragmentRoot());
        for (Map.Entry<URI, IStorage> entry : data.entrySet()) {
            if (entry.getValue().equals(storage2))
                return entry.getKey();
        }
    }
    return null;
}
项目:bts    文件:JarEntryLocator.java   
/**
 * @return a URI for the given jarEntry, can be <code>null</code>.
 */
public URI getURI(IPackageFragmentRoot root, IJarEntryResource jarEntry, TraversalState state) {
    if (root.isArchive()) {
        URI jarURI = JarEntryURIHelper.getUriForPackageFragmentRoot(root);
        URI storageURI = URI.createURI(jarEntry.getFullPath().toString());
        return createJarURI(root.isArchive(), jarURI, storageURI);
    } else if (root instanceof ExternalPackageFragmentRoot) {
        IResource resource = ((ExternalPackageFragmentRoot) root).resource();
        IPath result = resource.getFullPath();
        for(int i = 1; i < state.getParents().size(); i++) {
            Object obj = state.getParents().get(i);
            if (obj instanceof IPackageFragment) {
                result = result.append(new Path(((IPackageFragment) obj).getElementName().replace('.', '/')));
            } else if (obj instanceof IJarEntryResource) {
                result = result.append(((IJarEntryResource) obj).getName());
            }
        }
        result = result.append(jarEntry.getName());
        return URI.createPlatformResourceURI(result.toString(), true);          
    } else {
        throw new IllegalStateException("Unexpeced root type: " + root.getClass().getName());
    }
}
项目:bts    文件:SourceAttachmentPackageFragmentRootWalker.java   
/**
 * Converts the physical URI to a logic URI based on the bundle symbolic name.
 */
protected URI getLogicalURI(URI uri, IStorage storage, TraversalState state) {
    if (bundleSymbolicName != null) {
        URI logicalURI = URI.createPlatformResourceURI(bundleSymbolicName, false);
        List<?> parents = state.getParents();
        for (int i = 1; i < parents.size(); i++) {
            Object obj = parents.get(i);
            if (obj instanceof IPackageFragment) {
                logicalURI = logicalURI.appendSegments(((IPackageFragment) obj).getElementName().split("\\."));
            } else if (obj instanceof IJarEntryResource) {
                logicalURI = logicalURI.appendSegment(((IJarEntryResource) obj).getName());
            } else if (obj instanceof IFolder) {
                logicalURI = logicalURI.appendSegment(((IFolder) obj).getName());
            }
        }
        return logicalURI.appendSegment(uri.lastSegment());
    }
    return uri;
}
项目:bts    文件:PackageFragmentRootWalker.java   
public T traverse(IPackageFragmentRoot root, boolean stopOnFirstResult) throws JavaModelException {
    T result = null;
    if (root.exists()) {
        Object[] resources = root.getNonJavaResources();
        TraversalState state = new TraversalState(root);
        for (Object object : resources) {
            if (object instanceof IJarEntryResource) {
                result = traverse((IJarEntryResource) object, stopOnFirstResult, state);
                if (stopOnFirstResult && result != null)
                    return result;
            }
        }

        IJavaElement[] children = root.getChildren();
        for (IJavaElement javaElement : children) {
            if (javaElement instanceof IPackageFragment) {
                result = traverse((IPackageFragment) javaElement, stopOnFirstResult, state);
                if (stopOnFirstResult && result != null)
                    return result;
            }
        }
    }
    return result;
}
项目:bts    文件:PackageFragmentRootWalker.java   
protected T traverse(IPackageFragment pack, boolean stopOnFirstResult, TraversalState state) throws JavaModelException {
    T result = null;
    state.push(pack);
    IJavaElement[] children = pack.getChildren();
    for (IJavaElement iJavaElement : children) {
        if (iJavaElement instanceof IPackageFragment) {
            result = traverse((IPackageFragment) iJavaElement, stopOnFirstResult, state);
            if (stopOnFirstResult && result!=null)
                return result;
        }
    }
    Object[] resources = pack.getNonJavaResources();
    for (Object object : resources) {
        if (object instanceof IJarEntryResource) {
            result = traverse((IJarEntryResource) object, stopOnFirstResult, state);
            if (stopOnFirstResult && result!=null)
                return result;
        }
    }
    state.pop();
    return result;
}
项目:bts    文件:PackageFragmentRootWalker.java   
protected T traverse(IJarEntryResource jarEntry, boolean stopOnFirstResult, TraversalState state) {
    T result = null;
    if (jarEntry.isFile()) {
        result = handle(jarEntry, state);
    } else {
        state.push(jarEntry);
        IJarEntryResource[] children = jarEntry.getChildren();
        for (IJarEntryResource child : children) {
            result = traverse(child, stopOnFirstResult, state);
            if (stopOnFirstResult && result!=null)
                return result;
        }
        state.pop();
    }
    return result;
}
项目:bts    文件:JavaProjectsStateHelper.java   
protected IPackageFragmentRoot getJarWithEntry(URI uri) {
    Iterable<Pair<IStorage, IProject>> storages = getStorages(uri);
    IPackageFragmentRoot result = null;
    for (Pair<IStorage, IProject> storage2Project : storages) {
        IStorage storage = storage2Project.getFirst();
        if (storage instanceof IJarEntryResource) {
            IPackageFragmentRoot fragmentRoot = ((IJarEntryResource) storage).getPackageFragmentRoot();
            if (fragmentRoot != null) {
                IJavaProject javaProject = fragmentRoot.getJavaProject();
                if (isAccessibleXtextProject(javaProject.getProject()))
                    return fragmentRoot;
                if (result != null)
                    result = fragmentRoot;
            }
        }
    }
    return result;
}
项目:che    文件:JavaNavigation.java   
private Object[] findJarDirectoryChildren(JarEntryDirectory directory, String path) {
  String directoryPath = directory.getFullPath().toOSString();
  if (directoryPath.equals(path)) {
    return directory.getChildren();
  }
  if (path.startsWith(directoryPath)) {
    for (IJarEntryResource resource : directory.getChildren()) {
      String childrenPath = resource.getFullPath().toOSString();
      if (childrenPath.equals(path)) {
        return resource.getChildren();
      }
      if (path.startsWith(childrenPath) && resource instanceof JarEntryDirectory) {
        findJarDirectoryChildren((JarEntryDirectory) resource, path);
      }
    }
  }
  return null;
}
项目:gwt-eclipse-plugin    文件:ModuleSelectionDialog.java   
@Override
public String getText(Object element) {
  if (!(element instanceof IModule)) {
    return super.getText(element);
  }
  String text = null;

  IModule module = (IModule) element;
  String packageName = module.getPackageName();

  if (!module.isBinary()) {
    ModuleFile moduleFile = (ModuleFile) module;
    IFile file = moduleFile.getFile();
    String modulePath = file.getFullPath().makeRelative().toString();
    text = packageName + " - " + modulePath;
  } else {
    ModuleJarResource moduleJarResource = (ModuleJarResource) module;
    IJarEntryResource jarEntryResource = moduleJarResource.getJarEntryResource();
    String jarPath = jarEntryResource.getPackageFragmentRoot().getPath().makeRelative().toString();
    text = packageName + " - " + jarPath;
  }

  return text;
}
项目:gwt-eclipse-plugin    文件:ModuleSelectionDialog.java   
/**
 * Helper method to return the absolute workspace path of a GWT Module.
 * 
 * If the module file is located in a JAR, then the absolute path of the JAR
 * on the file system is returned.
 */
private static IPath getPathForModule(IModule module) {

  if (module == null) {
    return null;
  }

  if (!module.isBinary()) {
    ModuleFile moduleFile = (ModuleFile) module;
    IFile file = moduleFile.getFile();
    return file.getFullPath();
  }

  ModuleJarResource moduleJarResource = (ModuleJarResource) module;
  IJarEntryResource jarEntryResource = moduleJarResource.getJarEntryResource();
  return jarEntryResource.getPackageFragmentRoot().getPath();
}
项目:SecureBPMN    文件:ExtensionUtil.java   
/**
 * @param packageFragmentRoot
 * @throws JavaModelException
 * @throws CoreException
 */
@SuppressWarnings("restriction")
private static Manifest extractManifest(IPackageFragmentRoot packageFragmentRoot) throws JavaModelException {

  Manifest result = null;
  final Object[] nonJavaResources = packageFragmentRoot.getNonJavaResources();

  for (Object obj : nonJavaResources) {
    if (obj instanceof JarEntryDirectory) {
      final JarEntryDirectory jarEntryDirectory = (JarEntryDirectory) obj;
      final IJarEntryResource[] jarEntryResources = jarEntryDirectory.getChildren();
      for (IJarEntryResource jarEntryResource : jarEntryResources) {
        if ("MANIFEST.MF".equals(jarEntryResource.getName())) {
          try {
            final InputStream stream = jarEntryResource.getContents();
            result = new Manifest(stream);
          } catch (Exception e) {
            // no manifest as result
          }
        }
      }
    }
  }
  return result;
}
项目:strutsclipse    文件:ProjectUtil.java   
private static void collectNonJavaResources(Object[] nonJavaResources,
        IPath rootPath, List<JarEntryStorage> list,
        JarEntryPredicate jarEntryPredicate) {
    for (Object nonJavaRes : nonJavaResources) {
        if (nonJavaRes instanceof IJarEntryResource) {
            IJarEntryResource jarEntry = (IJarEntryResource) nonJavaRes;

            boolean addToList = jarEntryPredicate == null ? true
                    : jarEntryPredicate.test(jarEntry);

            if (addToList) {
                list.add(new JarEntryStorage(rootPath.append(jarEntry
                        .getFullPath()), jarEntry));
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:PropertyKeyHyperlinkDetector.java   
private static boolean isEclipseNLSAvailable(IStorageEditorInput editorInput) {
    IStorage storage;
    try {
        storage= editorInput.getStorage();
    } catch (CoreException ex) {
        return false;
    }
    if (!(storage instanceof IJarEntryResource))
        return false;

    IJavaProject javaProject= ((IJarEntryResource) storage).getPackageFragmentRoot().getJavaProject();

    if (javaProject == null || !javaProject.exists())
        return false;

    try {
        return javaProject.findType("org.eclipse.osgi.util.NLS") != null; //$NON-NLS-1$
    } catch (JavaModelException e) {
        return false;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CopyQualifiedNameAction.java   
private String getQualifiedName(Object element) throws JavaModelException {
    if (element instanceof IResource)
        return ((IResource)element).getFullPath().toString();

    if (element instanceof IJarEntryResource)
        return ((IJarEntryResource)element).getFullPath().toString();

    if (element instanceof LogicalPackage)
        return ((LogicalPackage)element).getElementName();

    if (element instanceof IJavaProject || element instanceof IPackageFragmentRoot || element instanceof ITypeRoot) {
        IResource resource= ((IJavaElement)element).getCorrespondingResource();
        if (resource != null)
            return getQualifiedName(resource);
    }

    if (element instanceof IBinding)
        return BindingLabelProvider.getBindingLabel((IBinding)element, LABEL_FLAGS);

    return TextProcessor.deprocess(JavaElementLabels.getTextLabel(element, LABEL_FLAGS));
}
项目:Eclipse-Postfix-Code-Completion    文件:NonJavaResource.java   
public IJarEntryResource[] getChildren() {
    if (this.resource instanceof IContainer) {
        IResource[] members;
        try {
            members = ((IContainer) this.resource).members();
        } catch (CoreException e) {
            Util.log(e, "Could not retrieve children of " + this.resource.getFullPath()); //$NON-NLS-1$
            return NO_CHILDREN;
        }
        int length = members.length;
        if (length == 0)
            return NO_CHILDREN;
        IJarEntryResource[] children = new IJarEntryResource[length];
        for (int i = 0; i < length; i++) {
            children[i] = new NonJavaResource(this, members[i]);
        }
        return children;
    }
    return NO_CHILDREN;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CopyQualifiedNameAction.java   
private String getQualifiedName(Object element) throws JavaModelException {
    if (element instanceof IResource)
        return ((IResource)element).getFullPath().toString();

    if (element instanceof IJarEntryResource)
        return ((IJarEntryResource)element).getFullPath().toString();

    if (element instanceof LogicalPackage)
        return ((LogicalPackage)element).getElementName();

    if (element instanceof IJavaProject || element instanceof IPackageFragmentRoot || element instanceof ITypeRoot) {
        IResource resource= ((IJavaElement)element).getCorrespondingResource();
        if (resource != null)
            return getQualifiedName(resource);
    }

    if (element instanceof IBinding)
        return BindingLabelProvider.getBindingLabel((IBinding)element, LABEL_FLAGS);

    return TextProcessor.deprocess(JavaElementLabels.getTextLabel(element, LABEL_FLAGS));
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:NonJavaResource.java   
public IJarEntryResource[] getChildren() {
    if (this.resource instanceof IContainer) {
        IResource[] members;
        try {
            members = ((IContainer) this.resource).members();
        } catch (CoreException e) {
            Util.log(e, "Could not retrieve children of " + this.resource.getFullPath()); //$NON-NLS-1$
            return NO_CHILDREN;
        }
        int length = members.length;
        if (length == 0)
            return NO_CHILDREN;
        IJarEntryResource[] children = new IJarEntryResource[length];
        for (int i = 0; i < length; i++) {
            children[i] = new NonJavaResource(this, members[i]);
        }
        return children;
    }
    return NO_CHILDREN;
}
项目:eclipse-tapestry5-plugin    文件:JarFileLookup.java   
private TapestryFile searchNonJavaResources(IParent root, String path) throws JavaModelException
{
    String[] segments = path.split("/");

    if (root instanceof IPackageFragmentRoot)
    {
        for (Object nonJava : ((IPackageFragmentRoot) root).getNonJavaResources())
        {
            if (nonJava instanceof IJarEntryResource)
            {
                IJarEntryResource resource = (IJarEntryResource) nonJava;

                if (StringUtils.equals(segments[0], resource.getName()))
                {
                    return searchRecursively(resource, path, segments, 1);
                }
            }
        }
    }

    return null;
}
项目:thymeleaf-eclipse-plugin    文件:ProcessorCache.java   
/**
 * Initialize the processor cache from JAR resources.
 * 
 * @param jarEntryResources A list of JAR entries describing the dialects and their
 *              processors to store.
 * @throws CoreException 
 * @throws XMLException 
 */
public static void initializeFromResources(List<IJarEntryResource> jarEntryResources) throws XMLException, CoreException {

    XMLReader<Dialect> xmlreader = new XMLReader<Dialect>(Dialect.class);

    for (IJarEntryResource jarEntry: jarEntryResources) {

        // Get default file as stream
        Dialect dialect = xmlreader.readXMLData(jarEntry.getContents());

        // Link the processor with it's dialect
        for (Processor processor: dialect.getProcessors()) {
            processor.setDialect(dialect);
            processors.add(processor);
        }

        // Ensure processors are in alphabetical order
        Collections.sort(processors, new Comparator<Processor>() {
            @Override
            public int compare(Processor p1, Processor p2) {
                return p1.getName().compareTo(p2.getName());
            }
        });
    }
}
项目:bts    文件:SourceAttachmentPackageFragmentRootWalker.java   
/**
 * Delegate to
 * {@link #handle(URI, IStorage, org.eclipse.xtext.ui.resource.PackageFragmentRootWalker.TraversalState)}.
 */
@Override
protected T handle(IJarEntryResource jarEntry, TraversalState state) {
    URI uri = getURI(jarEntry, state);
    if (isValid(uri, jarEntry)) {
        return handle(getLogicalURI(uri, jarEntry, state), jarEntry, state);
    }
    return null;
}
项目:bts    文件:JavaClassPathResourceForIEditorInputFactory.java   
@Override
protected Resource createResource(IStorage storage) throws CoreException {
    if (storage instanceof IJarEntryResource) {
        return createResourceFor((IJarEntryResource) storage);
    }
    return super.createResource(storage);
}
项目:bts    文件:JavaClassPathResourceForIEditorInputFactory.java   
protected Resource createResourceFor(IJarEntryResource storage) {
    ResourceSet resourceSet = getResourceSet(storage);
    URI uri = storageToUriMapper.getUri(storage);
    configureResourceSet(resourceSet, uri);
    XtextResource resource = createResource(resourceSet, uri);
    resource.setValidationDisabled(isValidationDisabled(storage));
    return resource;
}
项目:bts    文件:JavaClassPathResourceForIEditorInputFactory.java   
/**
 * @since 2.4
 */
@Override
protected boolean isValidationDisabled(IStorage storage) {
    if (storage instanceof IJarEntryResource) {
        return true;
    }
    return super.isValidationDisabled(storage);
}
项目:bts    文件:JavaClassPathResourceForIEditorInputFactory.java   
@Override
protected ResourceSet getResourceSet(IStorage storage) {
    if (storage instanceof IJarEntryResource) {
        IPackageFragmentRoot root = ((IJarEntryResource) storage).getPackageFragmentRoot();
        if (root != null) {
            IJavaProject project = root.getJavaProject();
            if (project != null)
                return getResourceSetProvider().get(project.getProject());
        }
    } 
    return super.getResourceSet(storage);
}
项目:che    文件:JavaNavigation.java   
private JarEntryFile findJarFile(JarEntryDirectory directory, String path) {
  for (IJarEntryResource children : directory.getChildren()) {
    if (children.isFile() && children.getFullPath().toOSString().equals(path)) {
      return (JarEntryFile) children;
    }
    if (!children.isFile()) {
      JarEntryFile file = findJarFile((JarEntryDirectory) children, path);
      if (file != null) {
        return file;
      }
    }
  }
  return null;
}
项目:che    文件:StandardJavaElementContentProvider.java   
public Object[] getChildren(Object element) {
  if (!exists(element)) return NO_CHILDREN;

  try {
    if (element instanceof IJavaModel) return getJavaProjects((IJavaModel) element);

    if (element instanceof IJavaProject) return getPackageFragmentRoots((IJavaProject) element);

    if (element instanceof IPackageFragmentRoot)
      return getPackageFragmentRootContent((IPackageFragmentRoot) element);

    if (element instanceof IPackageFragment) return getPackageContent((IPackageFragment) element);

    if (element instanceof IFolder) return getFolderContent((IFolder) element);

    if (element instanceof IJarEntryResource) {
      return ((IJarEntryResource) element).getChildren();
    }

    if (getProvideMembers()
        && element instanceof ISourceReference
        && element instanceof IParent) {
      return ((IParent) element).getChildren();
    }
  } catch (CoreException e) {
    return NO_CHILDREN;
  }
  return NO_CHILDREN;
}
项目:che    文件:ReorgUtils.java   
/**
 * Returns the jar entry resources from the list of elements.
 *
 * @param elements the list of elements
 * @return the array of jar entry resources
 * @since 3.6
 */
public static IJarEntryResource[] getJarEntryResources(List<?> elements) {
  List<IJarEntryResource> resources = new ArrayList<IJarEntryResource>(elements.size());
  for (Iterator<?> iter = elements.iterator(); iter.hasNext(); ) {
    Object element = iter.next();
    if (element instanceof IJarEntryResource) resources.add((IJarEntryResource) element);
  }
  return resources.toArray(new IJarEntryResource[resources.size()]);
}
项目:che    文件:ParentChecker.java   
public ParentChecker(
    IResource[] resources, IJavaElement[] javaElements, IJarEntryResource[] jarResources) {
  Assert.isNotNull(resources);
  Assert.isNotNull(javaElements);
  Assert.isNotNull(jarResources);
  fResources = resources;
  fJavaElements = javaElements;
  fJarResources = jarResources;
}
项目:che    文件:JavadocContentAccess2.java   
private static String getHTMLContent(IJarEntryResource jarEntryResource, String encoding)
    throws CoreException {
  InputStream in = jarEntryResource.getContents();
  try {
    return getContentsFromInputStream(in, encoding);
  } finally {
    if (in != null) {
      try {
        in.close();
      } catch (IOException e) {
        // ignore
      }
    }
  }
}
项目:gwt-eclipse-plugin    文件:ModuleUtils.java   
/**
 * Returns the module corresponding to the given JAR resource.
 *
 * @param jarResource the module JAR resource
 * @return the module, or <code>null</code> if unable to associate the given JAR resource with a
 *         module
 */
public static ModuleJarResource create(IJarEntryResource jarResource) {
  if (!isModuleXml(jarResource)) {
    return null;
  }

  return new ModuleJarResource(jarResource);
}
项目:gwt-eclipse-plugin    文件:ModuleUtils.java   
private static IModule create(Object resource, boolean allowModulesInJars) {
  IFile file = AdapterUtilities.getAdapter(resource, IFile.class);
  if (file != null) {
    return create(file);
  } else {
    IJarEntryResource jarEntryRes = AdapterUtilities.getAdapter(resource, IJarEntryResource.class);
    if (jarEntryRes != null && allowModulesInJars) {
      return create(jarEntryRes);
    }
  }

  return null;
}
项目:PDFReporter-Studio    文件:ResourceBundle.java   
public boolean isReadOnly() {
    if (resource instanceof IJarEntryResource)
        return true;
    if (resource instanceof IFile) {
        IFile file = (IFile) resource;
        return file.isReadOnly() || file.isLinked();
    }
    return false;
}
项目:strutsclipse    文件:ProjectUtil.java   
private static JarEntryStorage findJarEntry(final IDocument document,
        final String packageName, final String name) {
    IJavaProject javaProject = getCurrentJavaProject(document);

    if (javaProject != null && javaProject.exists()) {
        try {
            IPackageFragmentRoot[] roots = javaProject
                    .getPackageFragmentRoots();
            for (IPackageFragmentRoot root : roots) {
                if (root.isArchive()) {
                    IPackageFragment p = root
                            .getPackageFragment(packageName);
                    if (p != null && p.exists()) {
                        Object[] o = p.getNonJavaResources();
                        for (Object nonJavaRes : o) {
                            if (nonJavaRes instanceof IJarEntryResource) {
                                IJarEntryResource jarEntry = (IJarEntryResource) nonJavaRes;
                                if (jarEntry.getName() != null
                                        && jarEntry.getName().equals(name)) {
                                    return new JarEntryStorage(
                                            root.getPath().append(
                                                    jarEntry.getFullPath()),
                                            jarEntry);
                                }
                            }
                        }
                    }
                }
            }
        } catch (JavaModelException e) {
            e.printStackTrace();
        }
    }
    return null;
}
项目:strutsclipse    文件:ProjectUtil.java   
@Override
public boolean test(IJarEntryResource jarEntryResource) {
    return jarEntryResource.isFile()
            && (StrutsXmlConstants.STRUTS_DEFAULT_FILE_NAME
                    .equals(jarEntryResource.getName()) || StrutsXmlConstants.STRUTS_PLUGIN_FILE_NAME
                    .equals(jarEntryResource.getName()));
}
项目:strutsclipse    文件:ProjectUtil.java   
@Override
public boolean test(IJarEntryResource jarEntryResource) {
    return jarEntryResource.isFile()
            && jarEntryResource.getName() != null
            && jarEntryResource.getName().endsWith(
                    PROPERTIES_FILE_EXTENSION)
            && compare(bundleNames, jarEntryResource.getName());
}
项目:mytourbook    文件:ResourceBundle.java   
public boolean isReadOnly() {
    if (resource instanceof IJarEntryResource)
        return true;
    if (resource instanceof IFile) {
        IFile file = (IFile) resource;
        return file.isReadOnly() || file.isLinked();
    }
    return false;
}
项目:mytourbook    文件:ResourceBundle.java   
public boolean isReadOnly() {
    if (resource instanceof IJarEntryResource)
        return true;
    if (resource instanceof IFile) {
        IFile file = (IFile) resource;
        return file.isReadOnly() || file.isLinked();
    }
    return false;
}
项目:mytourbook    文件:ResourceBundle.java   
public boolean isReadOnly() {
    if (resource instanceof IJarEntryResource)
        return true;
    if (resource instanceof IFile) {
        IFile file = (IFile) resource;
        return file.isReadOnly() || file.isLinked();
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ReorgUtils.java   
/**
 * Returns the jar entry resources from the list of elements.
 * 
 * @param elements the list of elements
 * @return the array of jar entry resources
 * @since 3.6
 */
public static IJarEntryResource[] getJarEntryResources(List<?> elements) {
    List<IJarEntryResource> resources= new ArrayList<IJarEntryResource>(elements.size());
    for (Iterator<?> iter= elements.iterator(); iter.hasNext();) {
        Object element= iter.next();
        if (element instanceof IJarEntryResource)
            resources.add((IJarEntryResource) element);
    }
    return resources.toArray(new IJarEntryResource[resources.size()]);
}
项目:Eclipse-Postfix-Code-Completion    文件:ParentChecker.java   
public ParentChecker(IResource[] resources, IJavaElement[] javaElements, IJarEntryResource[] jarResources) {
    Assert.isNotNull(resources);
    Assert.isNotNull(javaElements);
    Assert.isNotNull(jarResources);
    fResources= resources;
    fJavaElements= javaElements;
    fJarResources= jarResources;
}