Java Code Examples for org.eclipse.jdt.core.IJavaModel#getNonJavaResources()
The following examples show how to use
org.eclipse.jdt.core.IJavaModel#getNonJavaResources() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaEditorBreadcrumb.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Returns all accessible projects of the given Java model. * * @param model the Java model * @return the accessible projects of the given model */ private Object[] getAccessibleProjects(IJavaModel model) { IJavaProject[] javaProjects; Object[] nonJavaResources; try { javaProjects= model.getJavaProjects(); nonJavaResources= model.getNonJavaResources(); } catch (JavaModelException e) { return fParent.getChildren(model); } ArrayList<IAdaptable> result= new ArrayList<IAdaptable>(javaProjects.length + nonJavaResources.length); for (int i= 0; i < nonJavaResources.length; i++) { IProject project= (IProject)nonJavaResources[i]; if (project.isAccessible()) result.add(project); } for (int i= 0; i < javaProjects.length; i++) { IJavaProject javaProject= javaProjects[i]; if (javaProject.getProject().isAccessible()) result.add(javaProject); } return result.toArray(new Object[result.size()]); }
Example 2
Source File: DestinationContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private static Object[] getOpenNonJavaProjects(IJavaModel model) throws JavaModelException { Object[] nonJavaProjects= model.getNonJavaResources(); ArrayList<IProject> result= new ArrayList<IProject>(nonJavaProjects.length); for (int i= 0; i < nonJavaProjects.length; i++) { IProject project = (IProject) nonJavaProjects[i]; if (project.isOpen()) result.add(project); } return result.toArray(); }
Example 3
Source File: OthersWorkingSetUpdater.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public void updateElements() { Assert.isTrue(fWorkingSet != null && fWorkingSetModel != null); // init and addWorkingSet have happend IWorkingSet[] activeWorkingSets= fWorkingSetModel.getActiveWorkingSets(); List<IAdaptable> result= new ArrayList<IAdaptable>(); Set<IResource> projects= new HashSet<IResource>(); for (int i= 0; i < activeWorkingSets.length; i++) { if (activeWorkingSets[i] == fWorkingSet) continue; IAdaptable[] elements= activeWorkingSets[i].getElements(); for (int j= 0; j < elements.length; j++) { IAdaptable element= elements[j]; IResource resource= (IResource)element.getAdapter(IResource.class); if (resource != null && resource.getType() == IResource.PROJECT) { projects.add(resource); } } } IJavaModel model= JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); try { IJavaProject[] jProjects= model.getJavaProjects(); for (int i= 0; i < jProjects.length; i++) { if (!projects.contains(jProjects[i].getProject())) result.add(jProjects[i]); } Object[] rProjects= model.getNonJavaResources(); for (int i= 0; i < rProjects.length; i++) { if (!projects.contains(rProjects[i])) result.add((IProject) rProjects[i]); } } catch (JavaModelException e) { JavaPlugin.log(e); } fWorkingSet.setElements(CollectionsUtil.toArray(result, IAdaptable.class)); }
Example 4
Source File: PackageExplorerContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Object[] getNonJavaProjects(IJavaModel model) throws JavaModelException { return model.getNonJavaResources(); }
Example 5
Source File: JavaWorkingSetPageContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
private Object[] getNonJavaProjects(IJavaModel model) throws JavaModelException { return model.getNonJavaResources(); }