Java Code Examples for org.eclipse.core.resources.IResource#isSynchronized()
The following examples show how to use
org.eclipse.core.resources.IResource#isSynchronized() .
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: Util.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Save local history * * @param resource * @throws CoreException */ public static void saveLocalHistory(IResource resource) throws CoreException { if (resource instanceof IFile && resource.exists()) { if (!resource.isSynchronized(IResource.DEPTH_ZERO)) resource.refreshLocal(IResource.DEPTH_ZERO, null); ((IFile)resource).appendContents(new ByteArrayInputStream(new byte[0]),IResource.KEEP_HISTORY, null); } }
Example 2
Source File: Resources.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Checks if the given resources are in sync with the underlying file * system. * * @param resources the resources to be checked * @return IStatus status describing the check's result. If <code>status. * isOK() </code> returns <code>true</code> then the resources are in sync */ public static IStatus checkInSync(IResource[] resources) { IStatus result= null; for (int i= 0; i < resources.length; i++) { IResource resource= resources[i]; if (!resource.isSynchronized(IResource.DEPTH_INFINITE)) { result= addOutOfSync(result, resource); } } if (result != null) return result; return Status.OK_STATUS; }
Example 3
Source File: ClassFileDocumentProvider.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public boolean isSynchronized(Object element) { Object elementInfo= getElementInfo(element); if (elementInfo instanceof ClassFileInfo) { IClassFileEditorInput input= (IClassFileEditorInput)element; IResource resource; try { resource= input.getClassFile().getUnderlyingResource(); } catch (JavaModelException e) { return true; } return resource == null || resource.isSynchronized(IResource.DEPTH_ZERO); } return false; }