org.eclipse.core.resources.IWorkspaceRoot Java Examples
The following examples show how to use
org.eclipse.core.resources.IWorkspaceRoot.
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: GradleProjectImporterTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 6 votes |
@Test public void testJavaHome() throws Exception { Preferences prefs = JavaLanguageServerPlugin.getPreferencesManager().getPreferences(); String javaHomePreference = prefs.getJavaHome(); IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall(); try { IVMInstallType installType = JavaRuntime.getVMInstallType(StandardVMType.ID_STANDARD_VM_TYPE); IVMInstall[] vms = installType.getVMInstalls(); IVMInstall vm = vms[0]; JavaRuntime.setDefaultVMInstall(vm, new NullProgressMonitor()); String javaHome = new File(TestVMType.getFakeJDKsLocation(), "11").getAbsolutePath(); prefs.setJavaHome(javaHome); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IPath rootFolder = root.getLocation().append("/projects/gradle/simple-gradle"); BuildConfiguration build = GradleProjectImporter.getBuildConfiguration(rootFolder.toFile().toPath()); assertEquals(vm.getInstallLocation().getAbsolutePath(), build.getJavaHome().get().getAbsolutePath()); } finally { prefs.setJavaHome(javaHomePreference); if (defaultVM != null) { JavaRuntime.setDefaultVMInstall(defaultVM, new NullProgressMonitor()); } } }
Example #2
Source File: BugContentProvider.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
private Set<IResource> getResources(Object parent) { Set<IResource> resources = new HashSet<>(); if (parent instanceof IWorkingSet) { IWorkingSet workingSet = (IWorkingSet) parent; IAdaptable[] elements = workingSet.getElements(); // elements may contain NON-resource elements, which we have to // convert to // resources for (IAdaptable adaptable : elements) { IResource resource = (IResource) adaptable.getAdapter(IResource.class); // TODO get only java projects or children of them if (resource != null) { resources.add(resource); } } } else if (parent instanceof IWorkspaceRoot) { IWorkspaceRoot workspaceRoot = (IWorkspaceRoot) parent; // TODO get only java projects IProject[] projects = workspaceRoot.getProjects(); for (IProject project : projects) { resources.add(project); } } return resources; }
Example #3
Source File: ImportProjectWizardPage2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
private void resetSqliteTBNameAndPath(IProject project, DatabaseModelBean bean, int index) { IFolder folder = project.getFolder("TB"); if (!folder.exists()) { return; } String dbName = bean.getDbName(); IFile file = folder.getFile("Exported_" + index + "_" + dbName); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); String rootLocation = root.getLocation().toOSString(); String fileSeparator = System.getProperty("file.separator"); if (file.exists()) {// FIXME bean.setDbName("Exported_" + index + "_" + dbName); } if (file.exists() || folder.getFile(dbName).exists()) { bean.setItlDBLocation(rootLocation + fileSeparator + project.getName() + fileSeparator + "TB"); } }
Example #4
Source File: ProjectExplorerContentProvider.java From xds-ide with Eclipse Public License 1.0 | 6 votes |
@Override public Object[] getChildren(Object parentElement) { if (!exists(parentElement)) return NO_CHILDREN; if (parentElement instanceof IWorkspaceRoot) { return XdsModelManager.getModel().getXdsProjects().toArray(); } else if (parentElement instanceof IProject) { IProject parent = (IProject)parentElement; IXdsProject project = XdsModelManager.getModel().getXdsProjectBy(parent); if (project == null) return NO_CHILDREN; // project was deleted return filterXdsElements(project.getChildren()).toArray(); } else if (parentElement instanceof IXdsExternalCompilationUnit) { return NO_CHILDREN; } else if (parentElement instanceof IXdsContainer) { return filterXdsElements(((IXdsContainer)parentElement).getChildren()).toArray(); } return NO_CHILDREN; }
Example #5
Source File: ResourceUIValidatorExtension.java From n4js with Eclipse Public License 1.0 | 6 votes |
private void deleteMarkersRecursively(FileURI location) { if (location == null) { return; } IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IContainer[] containers = root.findContainersForLocationURI(URI.create(location.toString())); if (containers == null || containers.length == 0) { return; } try { for (IContainer container : containers) { if (container.isAccessible()) { container.deleteMarkers(null, true, IResource.DEPTH_INFINITE); } } } catch (CoreException e) { e.printStackTrace(); } }
Example #6
Source File: PythonNature.java From Pydev with Eclipse Public License 1.0 | 6 votes |
public static List<IPythonNature> getPythonNaturesRelatedTo(int relatedTo) { ArrayList<IPythonNature> ret = new ArrayList<IPythonNature>(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject[] projects = root.getProjects(); for (IProject project : projects) { PythonNature nature = getPythonNature(project); try { if (nature != null) { if (nature.getInterpreterType() == relatedTo) { ret.add(nature); } } } catch (CoreException e) { throw new RuntimeException(e); } } return ret; }
Example #7
Source File: ProjectLocationAwareWorkingSetManager.java From n4js with Eclipse Public License 1.0 | 6 votes |
private Multimap<String, IProject> initProjectLocation() { final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); final IProject[] projects = root.getProjects(); final Multimap<String, IProject> locations = HashMultimap.create(); // initialize the repository paths repositoryPaths = repositoriesProvider.getWorkspaceRepositories().stream() .map(r -> r.getDirectory().getParentFile().toPath()).collect(Collectors.toSet()); for (final IProject project : projects) { if (isRemoteEditNature(project)) { continue; } final String pair = getWorkingSetId(project); locations.put(pair, project); } return locations; }
Example #8
Source File: ResourceSelectionTree.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private IContainer[] getFolders() { List rootList = new ArrayList(); if (folders == null) { folderList = new ArrayList(); for (int i = 0; i < resources.length; i++) { if (resources[i] instanceof IContainer) folderList.add(resources[i]); IResource parent = resources[i]; while (parent != null && !(parent instanceof IWorkspaceRoot)) { if (!(parent.getParent() instanceof IWorkspaceRoot) && folderList.contains(parent.getParent())) break; if (parent.getParent() == null || parent.getParent() instanceof IWorkspaceRoot) { rootList.add(parent); } parent = parent.getParent(); folderList.add(parent); } } folders = new IContainer[folderList.size()]; folderList.toArray(folders); Arrays.sort(folders, comparator); rootFolders = new IContainer[rootList.size()]; rootList.toArray(rootFolders); Arrays.sort(rootFolders, comparator); } return folders; }
Example #9
Source File: BluemixUtil.java From XPagesExtensionLibrary with Apache License 2.0 | 6 votes |
public static DominoDesignerProject getDesignerProjectFromWorkspace(String nsfName) { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); if (root != null) { IProject[] projects = root.getProjects(); for (int i = 0; i < projects.length; i++) { try { DominoDesignerProject ddp = (DominoDesignerProject)DominoResourcesPlugin.getDominoDesignerProject(projects[i]); if (ddp != null) { String path = ddp.getNsfPath(); if (StringUtil.equalsIgnoreCase(path, nsfName)) { return ddp; } } } catch (NsfException e) { if (BluemixLogger.BLUEMIX_LOGGER.isErrorEnabled()) { BluemixLogger.BLUEMIX_LOGGER.errorp(BluemixUtil.class, "getDesignerProjectFromWorkspace", e, "Failed to get Domino Designer Project"); // $NON-NLS-1$ $NLE-BluemixUtil.FailedtogetDominoDesignerProject-2$ } } } } return null; }
Example #10
Source File: BazelClasspathContainer.java From eclipse with Apache License 2.0 | 6 votes |
private boolean isSourcePath(String path) throws JavaModelException, BackingStoreException { Path pp = new File(instance.getWorkspaceRoot().toString() + File.separator + path).toPath(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); for (IClasspathEntry entry : project.getRawClasspath()) { if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { IResource res = root.findMember(entry.getPath()); if (res != null) { String file = res.getLocation().toOSString(); if (!file.isEmpty() && pp.startsWith(file)) { IPath[] inclusionPatterns = entry.getInclusionPatterns(); if (!matchPatterns(pp, entry.getExclusionPatterns()) && (inclusionPatterns == null || inclusionPatterns.length == 0 || matchPatterns(pp, inclusionPatterns))) { return true; } } } } } return false; }
Example #11
Source File: ProjectOpenedOrClosedListener.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.17 */ protected boolean visitResourceDelta(IResourceDelta delta, final Set<IProject> accumulator) { if (delta.getResource() instanceof IWorkspaceRoot) return true; if (delta.getResource() instanceof IProject) { IProject project = (IProject) delta.getResource(); if ((delta.getKind() & IResourceDelta.CHANGED) != 0 && project.isOpen()) { if ((delta.getFlags() & IResourceDelta.OPEN) != 0) { accumulator.add(project); } if ((delta.getFlags() & IResourceDelta.DESCRIPTION) != 0) { if ((delta.findMember(new Path(".project")) != null) && XtextProjectHelper.hasNature(project) && XtextProjectHelper.hasBuilder(project)) accumulator.add(project); else if (!XtextProjectHelper.hasNature(project)) { scheduleRemoveProjectJobIfNecessary(project, delta); } } } } return false; }
Example #12
Source File: LibrariesWorkbookPage.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private CPListElement[] openClassFolderDialog(CPListElement existing) { if (existing == null) { IPath[] selected= BuildPathDialogAccess.chooseClassFolderEntries(getShell(), fCurrJProject.getPath(), getUsedContainers(existing)); if (selected != null) { IWorkspaceRoot root= fCurrJProject.getProject().getWorkspace().getRoot(); ArrayList<CPListElement> res= new ArrayList<CPListElement>(); for (int i= 0; i < selected.length; i++) { IPath curr= selected[i]; IResource resource= root.findMember(curr); if (resource instanceof IContainer) { res.add(newCPLibraryElement(resource)); } } return res.toArray(new CPListElement[res.size()]); } } else { // disabled } return null; }
Example #13
Source File: EclipseFileSystemTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@After public void tearDown() { try { final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject[] _projects = root.getProjects(); for (final IProject p : _projects) { boolean _remove = this.knownProjects.remove(p.getName()); boolean _not = (!_remove); if (_not) { p.delete(true, null); } } Assert.assertTrue(this.knownProjects.isEmpty()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example #14
Source File: MavenImportUtils.java From sarl with Apache License 2.0 | 5 votes |
private static AbstractProjectScanner<MavenProjectInfo> getProjectScanner(IWorkspaceRoot workspaceRoot, String projectName) { final File root = workspaceRoot.getLocation().toFile(); final String projectPath = new File(root, projectName).getAbsolutePath(); final MavenModelManager modelManager = MavenPlugin.getMavenModelManager(); return new LocalProjectScanner( root, projectPath, false, modelManager); }
Example #15
Source File: RefreshAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override protected List<IResource> getSelectedResources() { List<IResource> selectedResources= super.getSelectedResources(); if (!getStructuredSelection().isEmpty() && selectedResources.size() == 1 && selectedResources.get(0) instanceof IWorkspaceRoot) { selectedResources= Collections.emptyList(); // Refresh action refreshes root when it can't find any resources in selection } ArrayList<IResource> allResources= new ArrayList<IResource>(selectedResources); addWorkingSetResources(allResources); return allResources; }
Example #16
Source File: TreeConflictsView.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void refresh() { if (disposed || resource == null) return; BusyIndicator.showWhile(Display.getDefault(), new Runnable() { public void run() { folderList = new ArrayList(); treeConflicts = new ArrayList(); ISVNClientAdapter client = null; try { client = SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().getSVNClient(); ISVNStatus[] statuses = client.getStatus(resource.getLocation().toFile(), true, false, true); for (int i = 0; i < statuses.length; i++) { if (statuses[i].hasTreeConflict()) { SVNTreeConflict treeConflict = new SVNTreeConflict(statuses[i]); IResource treeConflictResource = treeConflict.getResource(); if (treeConflictResource instanceof IContainer && !folderList.contains(treeConflictResource)) { folderList.add(treeConflict); } if (!(treeConflictResource instanceof IContainer)) { IContainer parent = treeConflictResource.getParent(); if (parent != null && !(parent instanceof IWorkspaceRoot) && !folderList.contains(parent)) { folderList.add(parent); } } treeConflicts.add(treeConflict); } } treeViewer.refresh(); treeViewer.expandAll(); } catch (Exception e) { SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e); } finally { SVNWorkspaceRoot.getSVNResourceFor(resource).getRepository().returnSVNClient(client); } } }); }
Example #17
Source File: MyMvnSourceContainerBrowser.java From m2e.sourcelookup with Eclipse Public License 1.0 | 5 votes |
private static List<IJavaProject> getPossibleAdditions0(final ISourceLookupDirector director) { final List<IProject> mavenProjects = new ArrayList<IProject>(); for (final IMavenProjectFacade mavenProject : MavenPlugin.getMavenProjectRegistry().getProjects()) { mavenProjects.add(mavenProject.getProject()); } final List<IJavaProject> javaProjects = new ArrayList<IJavaProject>(); final IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); try { for (final IJavaProject javaProject : JavaCore.create(root).getJavaProjects()) { if (mavenProjects.contains(javaProject.getProject())) { javaProjects.add(javaProject); } } } catch (final JavaModelException e) { final IStatus status = new Status(IStatus.ERROR, SourceLookupPlugin.getInstance().getBundle().getSymbolicName(), "Can't retrieve Java projects.", e); SourceLookupPlugin.getInstance().getLog().log(status); } for (final ISourceContainer container : director.getSourceContainers()) { if (container.getType().getId().equals(MyMvnSourceContainerTypeDelegate.TYPE_ID)) { javaProjects.remove(((MyMvnSourceContainer) container).getJavaProject()); } } return javaProjects; }
Example #18
Source File: ProjectAwareXtendXtext2EcorePostProcessor.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected ClassLoader createClassLoader(IJavaProject javaProject) throws CoreException { List<URL> urls = Lists.newArrayListWithExpectedSize(javaProject.getResolvedClasspath(true).length); try { IWorkspaceRoot workspaceRoot = getWorkspace().getRoot(); urls.addAll(getOutputFolders(javaProject)); for (IClasspathEntry entry : javaProject.getResolvedClasspath(true)) { IPath path = null; URL url = null; switch (entry.getEntryKind()) { case IClasspathEntry.CPE_SOURCE: break; case IClasspathEntry.CPE_PROJECT: IResource project = workspaceRoot.findMember(entry.getPath()); urls.addAll(getOutputFolders(JavaCore.create(project.getProject()))); break; default: path = entry.getPath(); url = path.toFile().toURI().toURL(); break; } if (url != null) { urls.add(url); } } } catch (MalformedURLException e) { logger.error("Error creating class loader for java project '" + javaProject.getProject().getName() + "'", e); } return new URLClassLoader(urls.toArray(new URL[urls.size()]), getClass().getClassLoader()); }
Example #19
Source File: TestsRunner.java From gama with GNU General Public License v3.0 | 5 votes |
private static List<IFile> findTestModels() throws CoreException { final List<IFile> result = new ArrayList<>(); final IWorkspaceRoot w = ResourcesPlugin.getWorkspace().getRoot(); for (final IProject p : w.getProjects()) { if (isInteresting(p)) result.addAll(ModelsFinder.getAllGamaFilesInProject(p)); } return result; }
Example #20
Source File: PythonNature.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * @return all the python natures available in the workspace (for opened and existing projects) */ public static List<IPythonNature> getAllPythonNatures() { List<IPythonNature> natures = new ArrayList<IPythonNature>(); IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IProject[] projects = root.getProjects(); for (IProject project : projects) { PythonNature nature = getPythonNature(project); if (nature != null) { natures.add(nature); } } return natures; }
Example #21
Source File: LocalFolder.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public LocalResourceStatus getStatusFromCache() throws SVNException { if (getIResource().isTeamPrivateMember() && (SVNProviderPlugin.getPlugin().isAdminDirectory(getIResource().getName()))) { return LocalResourceStatus.NONE; } if (getIResource() instanceof IWorkspaceRoot) { return LocalResourceStatus.NONE; } return super.getStatusFromCache(); }
Example #22
Source File: PipelineArgumentsTabTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Before public void setUp() throws CoreException, InvocationTargetException, InterruptedException { workspaceRoot = mock(IWorkspaceRoot.class); dependencyManager = mock(DataflowDependencyManager.class); project1 = mockProject("project1"); javaProject1 = mock(IJavaProject.class); when(workspaceRoot.getProject("project1")).thenReturn(project1); when(project1.getAdapter(IJavaElement.class)).thenReturn(javaProject1); when(javaProject1.getJavaProject()).thenReturn(javaProject1); configuration1 = mockLaunchConfiguration(); when(configuration1.getAttribute(eq(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME), anyString())).thenReturn("project1"); doReturn(MajorVersion.ONE).when(dependencyManager).getProjectMajorVersion(project1); project2 = mockProject("project2"); javaProject2 = mock(IJavaProject.class); when(project2.getAdapter(IJavaElement.class)).thenReturn(javaProject2); when(javaProject2.getJavaProject()).thenReturn(javaProject2); when(workspaceRoot.getProject("project2")).thenReturn(project2); configuration2 = mockLaunchConfiguration(); when(configuration2.getAttribute(eq(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME), anyString())).thenReturn("project2"); doReturn(MajorVersion.TWO).when(dependencyManager).getProjectMajorVersion(project2); ILaunchConfigurationDialog dialog = mock(ILaunchConfigurationDialog.class); doAnswer(new SynchronousIRunnableContextExecutor()).when(dialog).run(anyBoolean(), anyBoolean(), any(IRunnableWithProgress.class)); pipelineArgumentsTab = new PipelineArgumentsTab(workspaceRoot, dependencyManager); pipelineArgumentsTab.setLaunchConfigurationDialog(dialog); pipelineArgumentsTab.createControl(shellResource.getShell()); }
Example #23
Source File: CordovaProjectCLITest.java From thym with Eclipse Public License 1.0 | 5 votes |
private HybridProject getTheProject() { IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot(); IProject theProject = workspaceRoot.getProject(PROJECT_NAME); HybridProject hProject = HybridProject.getHybridProject(theProject); assertNotNull(hProject); return hProject; }
Example #24
Source File: AbstractCheckTestCase.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Gets the project or creates and returns it if it is <code>null</code>. * * @return the project * @throws CoreException * the core exception */ protected IProject getOrCreatePluginProject() throws CoreException { IWorkspaceRoot workspaceRoot = EcorePlugin.getWorkspaceRoot(); assertNotNull("No workspace; project cannot be created or found", workspaceRoot); IProject project = workspaceRoot.getProject(PluginTestProjectManager.TEST_PROJECT_NAME); if (!project.exists()) { try { project = PluginTestProjectManager.createPluginProject(getInjector(), PluginTestProjectManager.TEST_PROJECT_NAME); } catch (CoreException e) { fail(e.getMessage()); } } return project; }
Example #25
Source File: EclipseProjectImporterTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Test public void testFindUniqueProject() throws Exception { //given String name = "project"; IWorkspaceRoot root = mock(IWorkspaceRoot.class); IWorkspace workspace = mock(IWorkspace.class); when(workspace.getRoot()).thenReturn(root); IProject p0 = mockProject(root, "project", false); //when IProject p = importer.findUniqueProject(workspace, name); //then assertSame(p0, p); //given when(p0.exists()).thenReturn(true); IProject p2 = mockProject(root, "project (2)", false); //when p = importer.findUniqueProject(workspace, name); //then assertSame(p2, p); //given when(p0.exists()).thenReturn(true); when(p2.exists()).thenReturn(true); IProject p3 = mockProject(root, "project (3)", false); //when p = importer.findUniqueProject(workspace, name); //then assertSame(p3, p); }
Example #26
Source File: NativeLibrariesConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private String chooseInternal() { String initSelection= fPathField.getText(); ILabelProvider lp= new WorkbenchLabelProvider(); ITreeContentProvider cp= new WorkbenchContentProvider(); Class<?>[] acceptedClasses= new Class[] { IProject.class, IFolder.class }; TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, true); ViewerFilter filter= new TypedViewerFilter(acceptedClasses); IResource initSel= null; IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); if (initSelection.length() > 0) { initSel= root.findMember(new Path(initSelection)); } if (initSel == null) { initSel= root.findMember(fEntry.getPath()); } ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(fShell, lp, cp); dialog.setAllowMultiple(false); dialog.setValidator(validator); dialog.addFilter(filter); dialog.setComparator(new ResourceComparator(ResourceComparator.NAME)); dialog.setTitle(NewWizardMessages.NativeLibrariesDialog_intfiledialog_title); dialog.setMessage(NewWizardMessages.NativeLibrariesDialog_intfiledialog_message); dialog.setInput(root); dialog.setInitialSelection(initSel); dialog.setHelpAvailable(false); if (dialog.open() == Window.OK) { IResource res= (IResource) dialog.getFirstResult(); return res.getFullPath().makeRelative().toString(); } return null; }
Example #27
Source File: JdtUtils.java From java-debug with Eclipse Public License 1.0 | 5 votes |
/** * Given the project name, return the corresponding project object. * If the project doesn't exist, return null. */ public static IProject getProject(String projectName) { if (StringUtils.isBlank(projectName)) { return null; } IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); return root.getProject(projectName); }
Example #28
Source File: AbstractNewDocumentOutputPart.java From depan with Apache License 2.0 | 5 votes |
@Override public IFile getOutputFile() throws CoreException { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); IResource resource = root.findMember(new Path(getContainerName())); if (!resource.exists() || !(resource instanceof IContainer)) { throwCoreException( "Container \"" + getContainerName() + "\" does not exist."); } IContainer container = (IContainer) resource; final IFile file = container.getFile(new Path(getFilename())); return file; }
Example #29
Source File: ExternalBreakpointWatcher.java From goclipse with Eclipse Public License 1.0 | 5 votes |
@Override public void resourceChanged(IResourceChangeEvent event) { IResourceDelta delta = event.getDelta(); if(delta == null) { return; } IResource res = delta.getResource(); if(res instanceof IWorkspaceRoot && (delta.getFlags() & IResourceDelta.MARKERS) != 0) { IMarkerDelta[] markerDeltas = delta.getMarkerDeltas(); for (IMarkerDelta markerDelta : markerDeltas) { int kind = markerDelta.getKind(); if(markerDelta.isSubtypeOf(CBREAKPOINT_MARKER_TYPE)) { if (kind == IResourceDelta.ADDED) { addMarkerAnnotation(markerDelta.getMarker()); } if (kind == IResourceDelta.REMOVED) { removeMarkerAnnotation(markerDelta.getMarker()); } if (kind == IResourceDelta.CHANGED) { updateMarkerAnnotation(markerDelta.getMarker()); } } } } }
Example #30
Source File: PipelineArgumentsTab.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@VisibleForTesting PipelineArgumentsTab(IWorkspaceRoot workspaceRoot, DataflowDependencyManager dependencyManager) { this.workspaceRoot = workspaceRoot; this.dependencyManager = dependencyManager; hierarchy = pipelineOptionsHierarchyFactory.global(new NullProgressMonitor()); ImageDescriptor descriptor = AbstractUIPlugin .imageDescriptorFromPlugin(DataflowUiPlugin.PLUGIN_ID, "icons/Dataflow_16.png"); image = descriptor != null ? descriptor.createImage() : null;; }