Java Code Examples for org.eclipse.core.resources.IResource#DEPTH_INFINITE
The following examples show how to use
org.eclipse.core.resources.IResource#DEPTH_INFINITE .
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: CommitOperation.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * This method figures out of if we should commit with DEPTH_ZERO or DEPTH_INFINITE * If there are any modified folders (which could only be a prop change) in the list of committed items, * then it should return DEPTH_ZERO, otherwise it should return DEPTH_INFINITE. * @param resources an array of resources to check * @return IResource.DEPTH_ZERO or IResource.DEPTH_INFINITE */ private int getDepth(IResource[] resources) { int depth = IResource.DEPTH_INFINITE; for (int i = 0; i < resources.length; i++) { if (resources[i].getType() != IResource.FILE) { ISVNLocalResource svnResource = SVNWorkspaceRoot.getSVNResourceFor(resources[i]); try { // If there is a folder delete, then we cannot do a // non-recursive commit if (svnResource.getStatus().isDeleted()) return IResource.DEPTH_INFINITE; if (svnResource.getStatus().isPropModified()) depth = IResource.DEPTH_ZERO; } catch (SVNException e) { } } } return depth; }
Example 2
Source File: SynchronizerSyncInfoCache.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void purgeCache(IContainer root, boolean deep) throws SVNException { int depth = deep ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO; try { if (root.exists() || root.isPhantom()) { ResourcesPlugin.getWorkspace().getSynchronizer().flushSyncInfo(StatusCacheManager.SVN_BC_SYNC_KEY, root, depth); } if (deep) { accessor.removeRecursiveFromPendingCache(root); } else { accessor.removeFromPendingCache(root); } } catch (CoreException e) { if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) { // Must have been deleted since we checked return; } throw SVNException.wrapException(e); } }
Example 3
Source File: JavaElementResourceMapping.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { IJavaProject[] projects= fJavaModel.getJavaProjects(); ResourceTraversal[] result= new ResourceTraversal[projects.length]; for (int i= 0; i < projects.length; i++) { result[i]= new ResourceTraversal(new IResource[] {projects[i].getProject()}, IResource.DEPTH_INFINITE, 0); } return result; }
Example 4
Source File: ProblemReporter.java From cppcheclipse with Apache License 2.0 | 5 votes |
public void deleteMarkers(IResource file, boolean isRecursive) throws CoreException { final int depth; if (isRecursive) { depth = IResource.DEPTH_INFINITE; } else { depth = IResource.DEPTH_ZERO; } file.deleteMarkers(CHECKER_MARKER_TYPE, true, depth); }
Example 5
Source File: JsonEditor.java From KaiZen-OpenAPI-Editor with Eclipse Public License 1.0 | 5 votes |
protected static void clearMarkers(IFile file) { int depth = IResource.DEPTH_INFINITE; try { file.deleteMarkers(IMarker.PROBLEM, true, depth); } catch (CoreException e) { YEditLog.logException(e); YEditLog.logger.warning("Failed to delete markers:\n" + e.toString()); } }
Example 6
Source File: StatusCacheManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Refresh the status of the given resource to the give depth. The depth can * be deeper in case of phantom resources. These have to be traversed to * infinite always ... * * @param resource * @param recursive * @return array of resources which were refreshed (including all phantoms * and their children) * @throws SVNException */ public IResource[] refreshStatus(final IResource resource, final boolean recursive) throws SVNException { if (SVNWorkspaceRoot.isLinkedResource(resource)) { return new IResource[0]; } final int depth = (recursive) ? IResource.DEPTH_INFINITE : IResource.DEPTH_ONE; final StatusUpdateStrategy strategy = (depth == IResource.DEPTH_INFINITE) ? (StatusUpdateStrategy) new RecursiveStatusUpdateStrategy(statusCache) : (StatusUpdateStrategy) new NonRecursiveStatusUpdateStrategy(statusCache); try { List<IResource> refreshedResources = updateCache(resource, strategy.statusesToUpdate(resource)); Set<IResource> resourcesToRefresh = resourcesToRefresh(resource, depth, IContainer.INCLUDE_PHANTOMS, refreshedResources.size()); for (Iterator<IResource> iter = refreshedResources.iterator(); iter.hasNext();) { resourcesToRefresh.remove(iter.next()); } //Resources which were not refreshed above (e.g. deleted resources) //We do it with depth = infinite, so the whole deleted trees are refreshed. for (IResource res : resourcesToRefresh) { if ((res.getType() != IResource.FILE) && res.isPhantom()) { Set<IResource> children = resourcesToRefresh(res, IResource.DEPTH_INFINITE, IContainer.INCLUDE_PHANTOMS | IContainer.INCLUDE_TEAM_PRIVATE_MEMBERS, 0); for (IResource child : children) { statusCache.removeStatus(child); refreshedResources.add(child); } } statusCache.removeStatus(res); refreshedResources.add(res); } return (IResource[]) refreshedResources.toArray(new IResource[refreshedResources.size()]); } catch (CoreException e) { throw SVNException.wrapException(e); } }
Example 7
Source File: JavaElementResourceMapping.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { IJavaProject[] projects= fJavaModel.getJavaProjects(); ResourceTraversal[] result= new ResourceTraversal[projects.length]; for (int i= 0; i < projects.length; i++) { result[i]= new ResourceTraversal(new IResource[] {projects[i].getProject()}, IResource.DEPTH_INFINITE, 0); } return result; }
Example 8
Source File: JavaElementResourceMapping.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] {fProject.getProject()}, IResource.DEPTH_INFINITE, 0) }; }
Example 9
Source File: JavaElementResourceMapping.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] {fRoot.getResource()}, IResource.DEPTH_INFINITE, 0) }; }
Example 10
Source File: SVNWorkspaceSubscriber.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
private IResource[] findChanges(IResource resource, int depth, IProgressMonitor monitor) throws TeamException { try { monitor.beginTask("", 100); remoteSyncStateStore.flushBytes(resource, depth); // ISVNClientAdapter client = SVNProviderPlugin.getPlugin().createSVNClient(); boolean descend = (depth == IResource.DEPTH_INFINITE)? true : false; boolean showOutOfDate = SVNProviderPlugin.getPlugin().getPluginPreferences().getBoolean(ISVNCoreConstants.PREF_SHOW_OUT_OF_DATE_FOLDERS); StatusAndInfoCommand cmd = new StatusAndInfoCommand(SVNWorkspaceRoot.getSVNResourceFor( resource ), descend, showOutOfDate, true ); cmd.setCallback(new CancelableSVNStatusCallback(monitor)); cmd.run(monitor); if (monitor.isCanceled()) { return new IResource[0]; } monitor.worked(70); RemoteResourceStatus[] statuses = cmd.getRemoteResourceStatuses(); List<IResource> result = new ArrayList<IResource>(statuses.length); for (RemoteResourceStatus status : statuses) { IResource changedResource = SVNWorkspaceRoot.getResourceFor(resource, status); if (changedResource == null) continue; if (isSupervised(changedResource) || (status.getTextStatus() != SVNStatusKind.NONE)) { if (!ignoreHiddenChanges || !Util.isHidden(changedResource)) { result.add(changedResource); remoteSyncStateStore.setBytes( changedResource, status.getBytes() ); registerChangedResourceParent(changedResource); } } } // Ensure that the local sync state is also updated IContainer container = resource.getType() == IResource.FILE ? resource.getParent() : (IContainer)resource; SVNProviderPlugin.getPlugin().getStatusCacheManager().refreshStatus(container, true); monitor.worked(30); return (IResource[]) result.toArray(new IResource[result.size()]); } catch (SVNException e) { if (e.getMessage().contains("Operation cancelled")) { return new IResource[0]; } else { throw new TeamException("Error getting status for resource " + resource + " " + e.getMessage(), e); } } finally { monitor.done(); } }
Example 11
Source File: JavaElementResourceMapping.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] {fProject.getProject()}, IResource.DEPTH_INFINITE, 0) }; }
Example 12
Source File: JavaElementResourceMapping.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] {fRoot.getResource()}, IResource.DEPTH_INFINITE, 0) }; }
Example 13
Source File: HierarchicalDecorationContext.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
@Override public ResourceTraversal[] getTraversals(ResourceMappingContext context, IProgressMonitor monitor) throws CoreException { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] {fPack.getResource()}, IResource.DEPTH_INFINITE, 0) }; }
Example 14
Source File: JavaResourceMapping.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 4 votes |
/** * {@inheritDoc} */ @Override public ResourceTraversal[] getTraversals(final ResourceMappingContext context, final IProgressMonitor monitor) { return new ResourceTraversal[] { new ResourceTraversal(new IResource[] { fResource }, IResource.DEPTH_INFINITE, IResource.NONE) }; }