@Override public IAdaptable[] getChildren() { List<IAdaptable> list= new ArrayList<>(); IPackageFragmentRoot[] roots= getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { list.add(roots[i]); } if (fContainer != null) { IClasspathEntry[] classpathEntries= fContainer.getClasspathEntries(); if (classpathEntries == null) { // invalid implementation of a classpath container JavaPlugin.log(new IllegalArgumentException("Invalid classpath container implementation: getClasspathEntries() returns null. " + fContainer.getPath())); //$NON-NLS-1$ } else { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); for (int i= 0; i < classpathEntries.length; i++) { IClasspathEntry entry= classpathEntries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IResource resource= root.findMember(entry.getPath()); if (resource instanceof IProject) list.add(new RequiredProjectWrapper(this, JavaCore.create((IProject) resource))); } } } } return list.toArray(new IAdaptable[list.size()]); }
public WorkingSetCompareEntry(IAdaptable a) { if (a instanceof IJavaElement) { init((IJavaElement) a); } else if (a instanceof IResource) { init((IResource) a); } else if (a instanceof RequiredProjectWrapper) { RequiredProjectWrapper wrapper= (RequiredProjectWrapper) a; IJavaProject proj= wrapper.getParentClassPathContainer().getJavaProject(); // the project reference is treated like an internal JAR. // that means it will only appear if the parent container project is in the working set IResource fakeInternal= proj.getProject().getFile(wrapper.getProject().getElementName() + "-fake-jar.jar"); //$NON-NLS-1$ init(proj.getPackageFragmentRoot(fakeInternal)); } else if (a instanceof IJarEntryResource) { init((IJarEntryResource)a); } else { IJavaElement je= a.getAdapter(IJavaElement.class); if (je != null) { init(je); } else { IResource resource= a.getAdapter(IResource.class); if (resource != null) { init(resource); } else { fResourcePath= null; fJavaElement= null; } } } }
public WorkingSetCompareEntry(IAdaptable a) { if (a instanceof IJavaElement) { init((IJavaElement) a); } else if (a instanceof IResource) { init((IResource) a); } else if (a instanceof RequiredProjectWrapper) { RequiredProjectWrapper wrapper= (RequiredProjectWrapper) a; IJavaProject proj= wrapper.getParentClassPathContainer().getJavaProject(); // the project reference is treated like an internal JAR. // that means it will only appear if the parent container project is in the working set IResource fakeInternal= proj.getProject().getFile(wrapper.getProject().getElementName() + "-fake-jar.jar"); //$NON-NLS-1$ init(proj.getPackageFragmentRoot(fakeInternal)); } else { IJavaElement je= (IJavaElement) a.getAdapter(IJavaElement.class); if (je != null) { init(je); } else { IResource resource= (IResource) a.getAdapter(IResource.class); if (resource != null) { init(resource); } else { fResourcePath= null; fJavaElement= null; } } } }
public IAdaptable[] getChildren() { List list= new ArrayList(); IPackageFragmentRoot[] roots= getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { list.add(roots[i]); } if (fContainer != null) { IClasspathEntry[] classpathEntries= fContainer.getClasspathEntries(); if (classpathEntries == null) { // invalid implementation of a classpath container JavaPlugin.log(new IllegalArgumentException("Invalid classpath container implementation: getClasspathEntries() returns null. " + fContainer.getPath())); //$NON-NLS-1$ } else { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); for (int i= 0; i < classpathEntries.length; i++) { IClasspathEntry entry= classpathEntries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IResource resource= root.findMember(entry.getPath()); if (resource instanceof IProject) list.add(new RequiredProjectWrapper(this, JavaCore.create((IProject) resource))); } } } } return (IAdaptable[]) list.toArray(new IAdaptable[list.size()]); }
@Override public IAdaptable[] getChildren() { List<IAdaptable> list= new ArrayList<>(); IPackageFragmentRoot[] roots= getPackageFragmentRoots(); for (int i= 0; i < roots.length; i++) { list.add(roots[i]); } if (fContainer != null) { IClasspathEntry[] classpathEntries= fContainer.getClasspathEntries(); if (classpathEntries == null) { // invalid implementation of a classpath container JavaPlugin.log(new IllegalArgumentException("Invalid classpath container implementation: getClasspathEntries() returns null. " + fContainer.getPath())); //$NON-NLS-1$ } else { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); for (int i= 0; i < classpathEntries.length; i++) { IClasspathEntry entry= classpathEntries[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) { IResource resource= root.findMember(entry.getPath()); if (resource instanceof IProject) list.add(new RequiredProjectWrapper(this, JavaCore.create((IProject) resource), entry)); } } } } return list.toArray(new IAdaptable[list.size()]); }
public WorkingSetCompareEntry(IAdaptable a) { if (a instanceof IJavaElement) { init((IJavaElement) a); } else if (a instanceof IResource) { init((IResource) a); } else if (a instanceof RequiredProjectWrapper) { RequiredProjectWrapper wrapper= (RequiredProjectWrapper) a; IJavaProject proj= wrapper.getParentClassPathContainer().getJavaProject(); // the project reference is treated like an internal JAR. // that means it will only appear if the parent container project is in the working set IResource fakeInternal= proj.getProject().getFile(wrapper.getProject().getElementName() + "-fake-jar.jar"); //$NON-NLS-1$ init(proj.getPackageFragmentRoot(fakeInternal)); } else if (a instanceof IJarEntryResource) { init((IJarEntryResource)a); } else { IJavaElement je= a.getAdapter(IJavaElement.class); if (je != null) { init(je); } else { IResource resource= a.getAdapter(IResource.class); if (resource != null) { init(resource); } else { fResourcePath= null; fJavaElement= null; } } } }
@Override public void decorate(Object element, IDecoration decoration) { if (element instanceof ClassPathContainer) { ClassPathContainer classPathContainer= (ClassPathContainer) element; IClasspathEntry classpathEntry= classPathContainer.getClasspathEntry(); decorateClassPathEntry(classpathEntry, decoration); } else if (element instanceof RequiredProjectWrapper) { RequiredProjectWrapper requiredProjectWrapper= (RequiredProjectWrapper) element; IClasspathEntry classpathEntry= requiredProjectWrapper.getClasspathEntry(); decorateClassPathEntry(classpathEntry, decoration); } else { IClasspathEntry classpathEntry= determineClassPathEntry(element); decorateClassPathEntry(classpathEntry, decoration); } }
@Override public void run() { IStructuredSelection selection= (IStructuredSelection)fPackageExplorer.getSite().getSelectionProvider().getSelection(); Object element= selection.getFirstElement(); if (element instanceof ClassPathContainer.RequiredProjectWrapper) { ClassPathContainer.RequiredProjectWrapper wrapper= (ClassPathContainer.RequiredProjectWrapper) element; fPackageExplorer.tryToReveal(wrapper.getProject()); } } }
@Override public void run() { IStructuredSelection selection= (IStructuredSelection)fPackageExplorer.getSite().getSelectionProvider().getSelection(); Object element= selection.getFirstElement(); if (element instanceof ClassPathContainer.RequiredProjectWrapper) { ClassPathContainer.RequiredProjectWrapper wrapper= (ClassPathContainer.RequiredProjectWrapper) element; fPackageExplorer.tryToReveal(wrapper.getProject()); } } }
public void run() { IStructuredSelection selection= (IStructuredSelection)fPackageExplorer.getSite().getSelectionProvider().getSelection(); Object element= selection.getFirstElement(); if (element instanceof ClassPathContainer.RequiredProjectWrapper) { ClassPathContainer.RequiredProjectWrapper wrapper= (ClassPathContainer.RequiredProjectWrapper) element; fPackageExplorer.tryToReveal(wrapper.getProject()); } } }