Java Code Examples for org.eclipse.core.resources.IResourceStatus#RESOURCE_NOT_FOUND
The following examples show how to use
org.eclipse.core.resources.IResourceStatus#RESOURCE_NOT_FOUND .
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: 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 2
Source File: SVNWorkspaceSubscriber.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public boolean isSupervised(IResource resource) throws TeamException { try { if (resource.isTeamPrivateMember() || SVNWorkspaceRoot.isLinkedResource(resource)) return false; RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), SVNProviderPlugin.getTypeId()); if (provider == null) return false; // TODO: what happens for resources that don't exist? // TODO: is it proper to use ignored here? ISVNLocalResource svnThing = SVNWorkspaceRoot.getSVNResourceFor(resource); if (svnThing.isIgnored()) { // An ignored resource could have an incoming addition (conflict) return (remoteSyncStateStore.getBytes(resource) != null) || ((remoteSyncStateStore.members(resource) != null) && (remoteSyncStateStore.members(resource).length > 0)); } return true; } catch (TeamException e) { // If there is no resource in coe this measn there is no local and no remote // so the resource is not supervised. if (e.getStatus().getCode() == IResourceStatus.RESOURCE_NOT_FOUND) { return false; } throw e; } }
Example 3
Source File: DoUpdateImplementation.java From n4js with Eclipse Public License 1.0 | 4 votes |
private int doUpdateCluster() { int clusterIndex = 0; final List<Delta> changedDeltas = Lists.newArrayList(); while (!queue.isEmpty()) { checkCancelled(); if (!continueProcessing(clusterIndex)) { break; } URI changedURI = null; Resource resource = null; Delta newDelta = null; try { // Load the resource and create a new resource description LoadResult loadResult = loadOperation.next(); changedURI = loadResult.getUri(); progress.subTask("Linking " + changedURI.lastSegment() + " and dependencies"); URI actualResourceURI = loadResult.getResource().getURI(); resource = state.addResource(loadResult.getResource(), resourceSet); reportProgress(); if (!removeFromQueue(changedURI)) { break; } buildLogger.log("Linking " + changedURI); newDelta = resolveLinks(actualResourceURI, resource); } catch (final WrappedException ex) { if (ex instanceof LoadOperationException) { changedURI = ((LoadOperationException) ex).getUri(); } Throwable cause = ex.getCause(); boolean wasResourceNotFound = false; if (cause instanceof CoreException) { if (IResourceStatus.RESOURCE_NOT_FOUND == ((CoreException) cause).getStatus() .getCode()) { wasResourceNotFound = true; } } if (changedURI == null) { LOGGER.error("Error loading resource", ex); //$NON-NLS-1$ } else { if (!removeFromQueue(changedURI)) { break; } if (!wasResourceNotFound) LOGGER.error("Error loading resource from: " + changedURI.toString(), ex); //$NON-NLS-1$ if (resource != null) { resourceSet.getResources().remove(resource); } newDelta = createRemoveDelta(changedURI); } } if (newDelta != null) { clusterIndex++; if (processNewDelta(newDelta)) { changedDeltas.add(newDelta); } } } loadOperation.cancel(); queueAffectedResources(changedDeltas); return clusterIndex; }
Example 4
Source File: N4JSResource.java From n4js with Eclipse Public License 1.0 | 4 votes |
/** * * Discards the current content of the resource, sets the parser result as first slot, installs derived state (this * will build up the second slot again) and sends notifications that proxies have been resolved. The resource will * be even loaded if its already marked as loaded. * * If the second slot, that is the TModule, was already loaded and we just resolved the AST, then the existing * TModule is kept in the resource and rewired to the resolved AST. * * @param object * the object which resource should be loaded * @return the loaded/resolved object */ private EObject demandLoadResource(EObject object) { TModule oldModule = null; EObject oldScript = null; ModuleAwareContentsList myContents = ((ModuleAwareContentsList) contents); try { oldModule = discardStateFromDescription(false); if (!myContents.isEmpty()) { oldScript = myContents.basicGet(0); myContents.sneakyClear(); } // now everything is removed from the resource and contents is empty // stop sending notifications eSetDeliver(false); if (isLoaded) { // Loads the resource even its marked as being already loaded isLoaded = false; } superLoad(null); // manually send the notification eSetDeliver(true); EObject result = getParseResult().getRootASTElement(); if (myContents.isEmpty()) { myContents.sneakyAdd(0, result); if (oldModule != null) { myContents.sneakyAdd(oldModule); } forceInstallDerivedState(false); } else { if (myContents.size() == 1) { if (oldModule != null) { myContents.sneakyAdd(oldModule); } } installDerivedState(false); } if (oldScript != null) { notifyProxyResolved(0, oldScript); } fullyPostProcessed = false; return result; } catch (IOException | IllegalStateException ioe) { if (myContents.isEmpty()) { myContents.sneakyAdd(oldScript); myContents.sneakyAdd(oldModule); } Throwable cause = ioe.getCause(); if (cause instanceof CoreException) { IStatus status = ((CoreException) cause).getStatus(); if (IResourceStatus.RESOURCE_NOT_FOUND == status.getCode()) { return object; } } logger.error("Error in demandLoadResource for " + getURI(), ioe); return object; } }
Example 5
Source File: XtextDocumentProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override protected void handleCoreException(CoreException exception, String message) { if(exception.getStatus() == null || exception.getStatus().getCode() != IResourceStatus.RESOURCE_NOT_FOUND) super.handleCoreException(exception, message); }