org.eclipse.core.resources.IProject Java Examples
The following examples show how to use
org.eclipse.core.resources.IProject.
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: M2DocNewProjectWizard.java From M2Doc with Eclipse Public License 1.0 | 6 votes |
/** * Creates the sample template. * * @param templateName * the template name * @param variableName * the variable name * @param variableValue * the variable value * @param monitor * the {@link IProgressMonitor} * @param project * the {@link IllegalPropertySetDataException} * @return * @throws IOException * if the template file can't be saved * @throws CoreException * if the template file can't be saved * @throws InvalidFormatException * if the sample template can't be read * @return the template {@link URI} */ private URI createSampleTemplate(final String templateName, final String variableName, final EObject variableValue, IProgressMonitor monitor, final IProject project) throws IOException, CoreException, InvalidFormatException { final URI res; final URIConverter uriConverter = new ExtensibleURIConverterImpl(); final MemoryURIHandler handler = new MemoryURIHandler(); uriConverter.getURIHandlers().add(0, handler); try (XWPFDocument sampleTemplate = M2DocUtils.createSampleTemplate(variableName, variableValue.eClass());) { final URI memoryURI = URI .createURI(MemoryURIHandler.PROTOCOL + "://resources/temp." + M2DocUtils.DOCX_EXTENSION_FILE); POIServices.getInstance().saveFile(uriConverter, sampleTemplate, memoryURI); try (InputStream source = uriConverter.createInputStream(memoryURI)) { final IFile templateFile = project.getFile(templateName); templateFile.create(source, true, monitor); res = URI.createPlatformResourceURI(templateFile.getFullPath().toString(), true); } } return res; }
Example #2
Source File: JarRefactoringDialog.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void buttonPressed(final int buttonId) { if (buttonId == IDialogConstants.OK_ID) { fData.setRefactoringAware(true); final RefactoringDescriptorProxy[] descriptors= fHistoryControl.getCheckedDescriptors(); Set<IProject> set= new HashSet<IProject>(); IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); for (int index= 0; index < descriptors.length; index++) { final String project= descriptors[index].getProject(); if (project != null && !"".equals(project)) //$NON-NLS-1$ set.add(root.getProject(project)); } fData.setRefactoringProjects(set.toArray(new IProject[set.size()])); fData.setRefactoringDescriptors(descriptors); fData.setExportStructuralOnly(fExportStructural.getSelection()); final IDialogSettings settings= fSettings; if (settings != null) settings.put(SETTING_SORT, fHistoryControl.isSortByProjects()); } super.buttonPressed(buttonId); }
Example #3
Source File: ResolveMainMethodHandler.java From java-debug with Eclipse Public License 1.0 | 6 votes |
private static MainMethod extractMainMethodInfo(ICompilationUnit typeRoot, IMethod method) throws JavaModelException { final Range range = getRange(typeRoot, method); IResource resource = typeRoot.getResource(); if (resource != null) { IProject project = resource.getProject(); if (project != null) { String mainClass = method.getDeclaringType().getFullyQualifiedName(); IJavaProject javaProject = JdtUtils.getJavaProject(project); if (javaProject != null) { String moduleName = JdtUtils.getModuleName(javaProject); if (moduleName != null) { mainClass = moduleName + "/" + mainClass; } } String projectName = ProjectsManager.DEFAULT_PROJECT_NAME.equals(project.getName()) ? null : project.getName(); return new MainMethod(range, mainClass, projectName); } } return null; }
Example #4
Source File: XtendLibClasspathAdderTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testAddToJavaProject() throws Exception { javaProjectFactory.setProjectName("test"); javaProjectFactory.addFolders(Collections.singletonList("src")); javaProjectFactory.addBuilderIds(JavaCore.BUILDER_ID, XtextProjectHelper.BUILDER_ID); javaProjectFactory.addProjectNatures(JavaCore.NATURE_ID, XtextProjectHelper.NATURE_ID); IProject project = javaProjectFactory.createProject(null, null); IJavaProject javaProject = JavaCore.create(project); JavaProjectSetupUtil.makeJava8Compliant(javaProject); IFile file = project.getFile("src/Foo.xtend"); file.create(new StringInputStream("import org.eclipse.xtend.lib.annotations.Accessors class Foo { @Accessors int bar }"), true, null); syncUtil.waitForBuild(null); markerAssert.assertErrorMarker(file, IssueCodes.XBASE_LIB_NOT_ON_CLASSPATH); adder.addLibsToClasspath(javaProject, null); waitForAutoBuild(); syncUtil.waitForBuild(null); markerAssert.assertNoErrorMarker(file); }
Example #5
Source File: Importer.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
private void addHybrisNature(IProject project, IProgressMonitor monitor) throws CoreException { IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); for (int i = 0; i < natures.length; ++i) { if (HYBRIS_NATURE_ID.equals(natures[i])) { return; } } // Add the nature String[] newNatures = new String[natures.length + 1]; System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = HYBRIS_NATURE_ID; description.setNatureIds(newNatures); project.setDescription(description, monitor); }
Example #6
Source File: JavaWorkingSetPageContentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public Object[] getChildren(Object parentElement) { try { if (parentElement instanceof IJavaModel) return concatenate(super.getChildren(parentElement), getNonJavaProjects((IJavaModel)parentElement)); if (parentElement instanceof IProject) { IProject project= (IProject) parentElement; if (project.isAccessible()) { return project.members(); } return NO_CHILDREN; } return super.getChildren(parentElement); } catch (CoreException e) { return NO_CHILDREN; } }
Example #7
Source File: JavaModelInfo.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * Compute the non-java resources contained in this java project. */ private Object[] computeNonJavaResources() { IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); int length = projects.length; Object[] resources = null; int index = 0; for (int i = 0; i < length; i++) { IProject project = projects[i]; if (!JavaProject.hasJavaNature(project)) { if (resources == null) { resources = new Object[length]; } resources[index++] = project; } } if (index == 0) return NO_NON_JAVA_RESOURCES; if (index < length) { System.arraycopy(resources, 0, resources = new Object[index], 0, index); } return resources; }
Example #8
Source File: TsvBuilder.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 6 votes |
@Override protected IProject[] build(int kind, @SuppressWarnings("rawtypes") Map args, IProgressMonitor monitor) throws CoreException { //TODO find referenced extensions and their eclipse projects and return them if (kind == CLEAN_BUILD) { clean(monitor); } else if (kind == FULL_BUILD) { fullBuild(monitor); } else { IResourceDelta delta = getDelta(getProject()); if (delta == null) { fullBuild(monitor); } else { incrementalBuild(delta, monitor); } } return null; }
Example #9
Source File: WorkspaceClassPathFinder.java From birt with Eclipse Public License 1.0 | 6 votes |
private String getFullPath(IPath path, IProject project) { // String curPath = path.toOSString( ); // String directPath = project.getLocation( ).toOSString( ); // int index = directPath.lastIndexOf( File.separator ); // String absPath = directPath.substring( 0, index ) + curPath; // return absPath; String directPath; try { directPath = project.getDescription().getLocationURI().toURL().getPath(); } catch (Exception e) { directPath = project.getLocation().toOSString(); } String curPath = path.toOSString( ); int index = curPath.substring(1).indexOf( File.separator ); String absPath = directPath + curPath.substring(index+1); return absPath; }
Example #10
Source File: TmfProjectRegistry.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void handleParentProjectOpen(IProject project) { Job job = Job.createSystem("TmfProjectRegistry.handleParentProjectOpen Job", monitor -> { //$NON-NLS-1$ if (!project.exists() || !project.isOpen()) { return; } IProject shadowProject = TmfProjectModelHelper.getShadowProject(project); if (shadowProject != null && shadowProject.exists() && !shadowProject.isOpen()) { try { shadowProject.open(new NullProgressMonitor()); } catch (CoreException e) { // Do nothing ... addTracingNature() will handle this } } addTracingNature(project, monitor); }); job.schedule(); }
Example #11
Source File: ExternalPackagesPluginTest.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * Check if index is populated with external project content and workspace project content when the external * location with single project is registered and workspace contains project with different name. */ @Test public void testWorkspaceProjectAndExternalProject() throws Exception { IProject createJSProject = ProjectTestsUtils.createJSProject("LibFoo2"); IFolder src = configureProjectWithXtext(createJSProject); IFile packageJson = createJSProject.getProject().getFile(IN4JSProject.PACKAGE_JSON); assertMarkers("package.json of first project should have no errors", packageJson, 0); createTestFile(src, "Foo", "console.log('hi')"); waitForAutoBuild(); Collection<String> expectedExternal = collectIndexableFiles(externalLibrariesRoot); Collection<String> expectedWorkspace = collectIndexableFiles(ResourcesPlugin.getWorkspace()); Collection<String> expected = new HashSet<>(); expected.addAll(expectedExternal); expected.addAll(expectedWorkspace); assertResourceDescriptions(expected, BuilderUtil.getAllResourceDescriptions()); }
Example #12
Source File: ContentAssistTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public static IProject createPluginProject(String name) throws CoreException { Injector injector = XtendActivator.getInstance().getInjector("org.eclipse.xtend.core.Xtend"); PluginProjectFactory projectFactory = injector.getInstance(PluginProjectFactory.class); projectFactory.setBreeToUse(JREContainerProvider.PREFERRED_BREE); projectFactory.setProjectName(name); projectFactory.setProjectDefaultCharset(StandardCharsets.ISO_8859_1.name()); projectFactory.addFolders(Collections.singletonList("src")); projectFactory.addBuilderIds( JavaCore.BUILDER_ID, "org.eclipse.pde.ManifestBuilder", "org.eclipse.pde.SchemaBuilder", XtextProjectHelper.BUILDER_ID); projectFactory.addProjectNatures(JavaCore.NATURE_ID, "org.eclipse.pde.PluginNature", XtextProjectHelper.NATURE_ID); projectFactory.addRequiredBundles(Lists.newArrayList( "org.eclipse.xtext.xbase.lib", "org.eclipse.xtend.lib")); IProject result = projectFactory.createProject(new NullProgressMonitor(), null); JavaProjectSetupUtil.makeJava8Compliant(JavaCore.create(result)); return result; }
Example #13
Source File: ItemManager.java From ice with Eclipse Public License 1.0 | 6 votes |
/** * This operation rebuilds an Item from its builder and the current project * space. */ private void rebuildItem(ItemBuilder builder, Item item, IProject projectSpace) { // Build the proper Item Item rebuiltItem = itemBuilderList.get(item.getItemBuilderName()) .build(projectSpace); // Give the project to this temp Item item.setProject(projectSpace); // Copy over the information from the persistence // provider rebuiltItem.copy(item); // Setup the project space rebuiltItem.setProject(projectSpace); // Refresh the data on the Item rebuiltItem.reloadProjectData(); // Resubmit the Item's Form so that it can repair its state rebuiltItem.submitForm(rebuiltItem.getForm()); // Register as a observer of the Item rebuiltItem.addListener(this); // Load the Item into the list itemList.put(rebuiltItem.getId(), rebuiltItem); }
Example #14
Source File: WorkbenchTestHelper.java From sarl with Apache License 2.0 | 6 votes |
/** Add exported packages into the project. * * @param project the project. * @param exportedPackages the exported packages. * @throws Exception */ public static void addExportedPackages(IProject project, String ... exportedPackages) throws Exception{ IFile manifest = project.getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$ Manifest mf = new Manifest(manifest.getContents()); String value = mf.getMainAttributes().getValue("Export-Package"); //$NON-NLS-1$ for (String exported : exportedPackages) { if (value == null) { value = exported; } else { value += ","+exported; //$NON-NLS-1$ } } mf.getMainAttributes().putValue("Export-Package", value); //$NON-NLS-1$ ByteArrayOutputStream stream = new ByteArrayOutputStream(); mf.write(stream); manifest.setContents(new ByteArrayInputStream(stream.toByteArray()), true, true, null); }
Example #15
Source File: RefactoringSearchEngine2.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Override public final void acceptSearchMatch(final SearchMatch match) throws CoreException { final SearchMatch accepted= fRequestor.acceptSearchMatch(match); if (accepted != null) { fCollectedMatches.add(accepted); final IResource resource= accepted.getResource(); if (!resource.equals(fLastResource)) { if (fBinary) { final IJavaElement element= JavaCore.create(resource); if (!(element instanceof ICompilationUnit)) { final IProject project= resource.getProject(); if (!fGrouping) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_binary_match_ungrouped, BasicElementLabels.getResourceName(project)), null, null, RefactoringStatusEntry.NO_CODE); } else if (!fBinaryResources.contains(resource)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_binary_match_grouped, BasicElementLabels.getResourceName(project)), null, null, RefactoringStatusEntry.NO_CODE); } fBinaryResources.add(resource); } } if (fInaccurate && accepted.getAccuracy() == SearchMatch.A_INACCURATE && !fInaccurateMatches.contains(accepted)) { fStatus.addEntry(fSeverity, Messages.format(RefactoringCoreMessages.RefactoringSearchEngine_inaccurate_match, BasicElementLabels.getResourceName(resource)), null, null, RefactoringStatusEntry.NO_CODE); fInaccurateMatches.add(accepted); } } } }
Example #16
Source File: SendPingJob.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void resourceChanged(IResourceChangeEvent event) { if (event.getType() == IResourceChangeEvent.PRE_DELETE) { // check if it is a studio project and then send the ping out try { IProject project = event.getResource().getProject(); IProjectDescription description = project.getDescription(); String[] natures = description.getNatureIds(); if (!ArrayUtil.isEmpty(natures)) { // just checking the primary nature String projectType = STUDIO_NATURE_MAP.get(natures[0]); if (!StringUtil.isEmpty(projectType)) { sendProjectDeleteEvent(project, projectType); } } } catch (Exception e) { UsagePlugin.logError(e); } } }
Example #17
Source File: HostPagePathSelectionDialog.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
public static HostPagePathTreeItem[] createRootItems(IProject project) { List<HostPagePathTreeItem> rootItems = new ArrayList<HostPagePathTreeItem>(); // Add root for war directory if this is a web app project if (WebAppUtilities.isWebApp(project)) { IFolder warFolder = WebAppUtilities.getWarSrc(project); if (warFolder.exists()) { rootItems.add(new HostPagePathTreeItem(warFolder, null)); } } // Add roots for each public path of each module for (IModule module : ModuleUtils.findAllModules( JavaCore.create(project), false)) { rootItems.addAll(createItemsForModule((ModuleFile) module)); } return rootItems.toArray(new HostPagePathTreeItem[0]); }
Example #18
Source File: ProjectCommandTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testGetClasspathsForMaven() throws Exception { importProjects("maven/classpathtest"); IProject project = WorkspaceHelper.getProject("classpathtest"); String uriString = project.getFile("src/main/java/main/App.java").getLocationURI().toString(); ClasspathOptions options = new ClasspathOptions(); options.scope = "runtime"; ClasspathResult result = ProjectCommand.getClasspaths(uriString, options); assertEquals(1, result.classpaths.length); assertEquals(0, result.modulepaths.length); assertTrue(result.classpaths[0].indexOf("junit") == -1); options.scope = "test"; result = ProjectCommand.getClasspaths(uriString, options); assertEquals(4, result.classpaths.length); assertEquals(0, result.modulepaths.length); boolean containsJunit = Arrays.stream(result.classpaths).anyMatch(element -> { return element.indexOf("junit") > -1; }); assertTrue(containsJunit); }
Example #19
Source File: ResolveMainClassHandler.java From java-debug with Eclipse Public License 1.0 | 5 votes |
private boolean isContainedInInvisibleProject(IProject project, Collection<IPath> rootPaths) { if (project == null) { return false; } IFolder workspaceLinkFolder = project.getFolder(ProjectUtils.WORKSPACE_LINK); return workspaceLinkFolder.exists() && ResourceUtils.isContainedIn(workspaceLinkFolder.getLocation(), rootPaths); }
Example #20
Source File: WebAppProjectProperties.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static void setLaunchConfigExternalUrlPrefix(IProject project, String launchConfigExternalUrlPrefix) throws BackingStoreException { IEclipsePreferences prefs = getProjectProperties(project); if (launchConfigExternalUrlPrefix == null) { launchConfigExternalUrlPrefix = ""; } prefs.put(LAUNCH_CONFIG_EXTERNAL_URL_PREFIX, launchConfigExternalUrlPrefix); prefs.flush(); }
Example #21
Source File: JavaSearchHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected ResourceSet getResourceSet(IProject project) { ResourceSet resourceSet = projectToResourceSet.get(project); if (resourceSet == null) { resourceSet = createResourceSet(project); projectToResourceSet.put(project, resourceSet); } return resourceSet; }
Example #22
Source File: AbstractLibClasspathAdder.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
public void addLibsToClasspath(IJavaProject javaProject, IProgressMonitor monitor) { try { SubMonitor progress = SubMonitor.convert(monitor, 2); IProject project = javaProject.getProject(); if (!project.hasNature(PLUGIN_NATURE) || !addToPluginManifest(project, progress.newChild(1))) addToClasspath(javaProject, progress.newChild(1)); } catch (Exception exc) { LOG.error("Error adding Xtend libs to classpath", exc); } }
Example #23
Source File: PythonNature.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public <T> T getAdapter(Class<T> adapter) { if (IProject.class == adapter) { return (T) this.project; } return null; }
Example #24
Source File: Util.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
public static IPath getAbsoluteFileSystemPath(IPath workspaceRelativePath) { assert (workspaceRelativePath.segmentCount() > 0); String projectName = workspaceRelativePath.segment(0); IProject project = Util.getWorkspaceRoot().getProject(projectName); assert (project.exists()); IPath projectFileSystemPath = project.getLocation(); IPath projectRelativePath = workspaceRelativePath.removeFirstSegments(1); return projectFileSystemPath.append(projectRelativePath); }
Example #25
Source File: ProjectFileChangeListener.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
protected void openErrorDialog(IProject project, String version) { Display.getDefault().asyncExec(() -> MessageDialog .openError(Display.getDefault().getActiveShell(), Messages.repositoryError, String.format(Messages.repositoryError, project.getName(), version, ProductVersion.CURRENT_VERSION))); }
Example #26
Source File: BuilderParticipantPluginTest.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * * 01. MyClassOne import MyVariableTwo, calls in chain * 01a. method of variable type (MyClassTwo), * 01b. method of type of this variable type method (MyRoleThree), * 01c. MyRoleThree method (typed with MyInterfaceFour) * 01d. finally a MyInterfaceFour's method * 02. Creating files in an order that there are initial error markers as required files are not created yet * 03. When all files have been created no file should have error markers * * @throws Exception when creating resources fails */ @SuppressWarnings("resource") //@formatter:on @Test public void testRenamingMethodAccessedViaSubclass() throws Exception { final IProject project = createJSProject("testRenamingMethodAccessedViaSubclass"); IFolder folder = configureProjectWithXtext(project); IFolder moduleFolder = createFolder(folder, TransitiveInheritMemberTestFiles.moduleFolder()); IFile fileC = createTestFile(moduleFolder, "C", TransitiveInheritMemberTestFiles.C()); IFile fileB = createTestFile(moduleFolder, "B", TransitiveInheritMemberTestFiles.B()); IFile fileA = createTestFile(moduleFolder, "A", TransitiveInheritMemberTestFiles.A()); waitForAutoBuild(); assertMarkers("File A should have no errors", fileA, 0); assertMarkers("File B should have no errors", fileB, 0); assertMarkers("File C should have no errors", fileC, 0); fileC.setContents(new StringInputStream(TransitiveInheritMemberTestFiles.CChanged().toString()), true, true, monitor()); waitForAutoBuild(); assertMarkers("File A with other missing method name in chain should have errors", fileA, 1); assertMarkers("File B should have no errors", fileB, 0); assertMarkers("File C should have no errors", fileC, 0); fileC.setContents(new StringInputStream(TransitiveInheritMemberTestFiles.C().toString()), true, true, monitor()); waitForAutoBuild(); assertMarkers("File A with old method name in chain should have no errors", fileA, 0); }
Example #27
Source File: GWTCompileRunner.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
/** * @param processReceiver optional, receives the process after it is started */ public static void compile(IJavaProject javaProject, IPath warLocation, GWTCompileSettings settings, OutputStream consoleOutputStream, IProcessReceiver processReceiver) throws IOException, InterruptedException, CoreException, OperationCanceledException { IProject project = javaProject.getProject(); if (settings.getEntryPointModules().isEmpty()) { // Nothing to compile, so just return. return; } int processStatus = ProcessUtilities.launchProcessAndWaitFor( computeCompilerCommandLine(javaProject, warLocation, settings), project.getLocation().toFile(), consoleOutputStream, processReceiver); /* * Do a refresh on the war folder if it's in the workspace. This ensures * that Eclipse sees the generated artifacts from the GWT compile, and * doesn't complain about stale resources during subsequent file searches. */ if (warLocation != null) { for (IContainer warFolder : ResourcesPlugin.getWorkspace().getRoot() .findContainersForLocationURI(URIUtil.toURI(warLocation))) { warFolder.refreshLocal(IResource.DEPTH_INFINITE, null); } } if (processStatus != 0) { if (processReceiver != null && processReceiver.hasDestroyedProcess()) { PrintWriter printWriter = new PrintWriter(consoleOutputStream); printWriter.println("GWT compilation terminated by the user."); printWriter.flush(); throw new OperationCanceledException(); } else { throw new CoreException(new Status(IStatus.ERROR, GWTPlugin.PLUGIN_ID, "GWT compilation failed")); } } }
Example #28
Source File: DerbyServerUtils.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
public void setRunning(IProject proj, Boolean value) throws CoreException { try{ if (value != null && value.equals(Boolean.FALSE)){ value = null; } if(proj.isOpen()){ proj.setSessionProperty(new QualifiedName(CommonNames.UI_PATH,CommonNames.ISRUNNING ),value); } }catch(Exception e){ Logger.log("DerbyServerUtils.setRunning() error: "+e, IStatus.ERROR); } DerbyIsRunningDecorator.performUpdateDecor(proj); }
Example #29
Source File: TbMatcher.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 针对项目检查当前导入器是否可用,主要判断是否存在数据模块和当前项目是否设置了术语库 * @param project * 当前项目 * @return true可用,false不可用 */ public boolean checkTbMatcher(IProject project) { if (termMatch == null) { return false; } return termMatch.checkTbMatcher(project); }
Example #30
Source File: ResourceUtilsTest.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Test public void testGetResourcesPerProject_selectedProjectAndClasses() throws JavaModelException { // Select project and classes A and B List<?> classes = Arrays.asList(getProject(), getClassA(), getClassB()); Map<IProject, List<WorkItem>> resourcesPerProject = ResourceUtils .getResourcesPerProject(new StructuredSelection(classes)); // We should have project -> [project] assertNotNull(resourcesPerProject); assertEquals(1, resourcesPerProject.size()); assertTrue(resourcesPerProject.containsKey(getProject())); assertEquals(Collections.singletonList(new WorkItem(getProject())), resourcesPerProject.get(getProject())); }