本文整理汇总了Java中org.eclipse.jdt.core.IJavaModel.getNonJavaResources方法的典型用法代码示例。如果您正苦于以下问题:Java IJavaModel.getNonJavaResources方法的具体用法?Java IJavaModel.getNonJavaResources怎么用?Java IJavaModel.getNonJavaResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.IJavaModel
的用法示例。
在下文中一共展示了IJavaModel.getNonJavaResources方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAccessibleProjects
import org.eclipse.jdt.core.IJavaModel; //导入方法依赖的package包/类
/**
* 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()]);
}
示例2: getOpenNonJavaProjects
import org.eclipse.jdt.core.IJavaModel; //导入方法依赖的package包/类
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();
}
示例3: updateElements
import org.eclipse.jdt.core.IJavaModel; //导入方法依赖的package包/类
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));
}
示例4: getNonJavaProjects
import org.eclipse.jdt.core.IJavaModel; //导入方法依赖的package包/类
private Object[] getNonJavaProjects(IJavaModel model) throws JavaModelException {
return model.getNonJavaResources();
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:4,代码来源:PackageExplorerContentProvider.java