Java Code Examples for org.eclipse.core.resources.IFile#isSynchronized()

The following examples show how to use org.eclipse.core.resources.IFile#isSynchronized() . These examples are extracted from open source projects. 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 Project: erflute   File:    License: Apache License 2.0 6 votes vote down vote up
private void prepareDiagram() {
    try {
        final IFile file = ((IFileEditorInput) getEditorInput()).getFile();
        final Persistent persistent = Persistent.getInstance();
        if (!file.isSynchronized(IResource.DEPTH_ONE)) {
            file.refreshLocal(IResource.DEPTH_ONE, new NullProgressMonitor());
        final InputStream in = file.getContents();
        diagram =;
    } catch (final Exception e) {
    if (diagram == null) {
        diagram = new ERDiagram(DBManagerFactory.getAllDBList().get(0));
Example 2
public T getChild(final String fileName, boolean force) {
    final IFile file = getResource().getFile(fileName);
    if (force && !file.isSynchronized(IResource.DEPTH_ONE) && file.isAccessible()) {
        try {
            file.refreshLocal(IResource.DEPTH_ONE, Repository.NULL_PROGRESS_MONITOR);
        } catch (final CoreException e) {
    if (file.exists()) {
        return createRepositoryFileStore(fileName);

    return null;
Example 3
protected void refreshFile(IFile file, IProgressMonitor monitor) throws CoreException {
	// Note that file.isSynchronized does not require a scheduling rule and thus helps to identify a no-op attempt
	// to refresh the file. The no-op will otherwise be blocked by a running build or cancel a running build
	if (!file.isSynchronized(IResource.DEPTH_ZERO)) {
		super.refreshFile(file, monitor);
Example 4
 * Refresh local file to avoid deadlock with scheduling rule XtextBuilder ->
 * Editing Domain runexclusive
protected void refreshFile(final URI uri) {
	String platformString = uri.toPlatformString(true);
	if (platformString == null)
	IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(platformString));
	if (file.isAccessible() && !file.isSynchronized(IResource.DEPTH_INFINITE)) {
		try {
			file.refreshLocal(IResource.DEPTH_INFINITE, null);
		} catch (CoreException e) {