Search in sources :

Example 1 with JarEntryResource

use of org.eclipse.jdt.internal.core.JarEntryResource in project che by eclipse.

the class JavaNavigation method convertToJarEntry.

private List<JarEntry> convertToJarEntry(Object[] rootContent, IPackageFragmentRoot root) throws JavaModelException {
    List<JarEntry> result = new ArrayList<>();
    for (Object o : rootContent) {
        if (o instanceof IPackageFragment) {
            JarEntry entry = DtoFactory.getInstance().createDto(JarEntry.class);
            IPackageFragment packageFragment = (IPackageFragment) o;
            entry.setName(getSpecificText((IJavaElement) o));
            entry.setPath(packageFragment.getElementName());
            entry.setType(JarEntryType.PACKAGE);
            result.add(entry);
        }
        if (o instanceof IClassFile) {
            JarEntry entry = getJarClass((IClassFile) o);
            result.add(entry);
        }
        if (o instanceof JarEntryResource) {
            result.add(getJarEntryResource((JarEntryResource) o));
        }
    }
    Collections.sort(result, comparator);
    return result;
}
Also used : IJavaElement(org.eclipse.jdt.core.IJavaElement) IPackageFragment(org.eclipse.jdt.core.IPackageFragment) IClassFile(org.eclipse.jdt.core.IClassFile) ArrayList(java.util.ArrayList) JarEntry(org.eclipse.che.ide.ext.java.shared.JarEntry) JarEntryResource(org.eclipse.jdt.internal.core.JarEntryResource) IJarEntryResource(org.eclipse.jdt.core.IJarEntryResource)

Aggregations

ArrayList (java.util.ArrayList)1 JarEntry (org.eclipse.che.ide.ext.java.shared.JarEntry)1 IClassFile (org.eclipse.jdt.core.IClassFile)1 IJarEntryResource (org.eclipse.jdt.core.IJarEntryResource)1 IJavaElement (org.eclipse.jdt.core.IJavaElement)1 IPackageFragment (org.eclipse.jdt.core.IPackageFragment)1 JarEntryResource (org.eclipse.jdt.internal.core.JarEntryResource)1