Runtime

## org.eclipse.gmf.runtime.common.ui.resources
Class FileChangeManager

    java.lang.Object
      org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager

All Implemented Interfaces:
  java.util.EventListener, org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager, IResourceChangeListener, IResourceDeltaVisitor

public class FileChangeManager
extends java.lang.Object
implements IResourceChangeListener, IResourceDeltaVisitor, org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager

The file change manager handles changes made to file resources within the Eclipse workspace. Files in the workspace are affected by change events on the files themselves as well as change events on the project and folder that contains these files.

Method Summary
`void` `addFileObserver(IFileObserver fileObserver)` Add a file observer without a filter.
`void` `addFileObserver(IFileObserver fileObserver, IContentType[] contentTypeFilter)` Add a file observer with a content type filter.
`void` `addFileObserver(IFileObserver fileObserver, IFile fileFilter)` Add a file observer with a file filter.
`void` `addFileObserver(IFileObserver fileObserver, IFolder folderFilter)` Add a file observer with a folder filter.
`void` `addFileObserver(IFileObserver fileObserver, java.lang.String[] extensionFilter)` Add a file observer with a file extension filter.
`static FileChangeManager` `getInstance()` get the singleton instance of this class
`static IResource` `getMovedFromResource(IResourceDelta delta)` Retrieve the moved from resource from the resource delta.
`boolean` `okToEdit(IFile[] files, java.lang.String modificationReason)` Validates that the given files can be modified using the Team validateEdit support.
`boolean` `okToSave(IFile file)` Validates that the given file can be saved using the Team validateSave support.
`void` `refreshLocal(IFile file)` Refresh changes made to the file directly on disk with the workspace.
`void` `removeFileObserver(IFileObserver fileObserver)` Remove a file observer.
`void` `resourceChanged(IResourceChangeEvent event)`
`boolean` `visit(IResourceDelta delta)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### getInstance

    public static FileChangeManager getInstance()

  get the singleton instance of this class

  Returns:
    singleton instance of the FileChangeManager class

### resourceChanged

    public final void resourceChanged(IResourceChangeEvent event)

  Specified by:
    `resourceChanged` in interface `IResourceChangeListener`

### visit

    public final boolean visit(IResourceDelta delta)

  Specified by:
    `visit` in interface `IResourceDeltaVisitor`

### okToEdit

    public boolean okToEdit(IFile[] files,
                            java.lang.String modificationReason)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Validates that the given files can be modified using the Team validateEdit support.

  Specified by:
    `okToEdit` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `files` - files that are to be modified; these files must all exist in the workspace.
    `modificationReason` - a String describing the reason for modifying the file, usually the command text.
  Returns:
    true if it is OK to edit the files.
  See Also:
    `IFileModificationValidator.validateEdit(org.eclipse.core.resources.IFile[], java.lang.Object)`

### okToSave

    public boolean okToSave(IFile file)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Validates that the given file can be saved using the Team validateSave support.

  Specified by:
    `okToSave` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `file` - the file that is to be saved; this file must exist in the workspace.
  Returns:
    true if it is OK to save the file.
  See Also:
    `IFileModificationValidator.validateSave(org.eclipse.core.resources.IFile)`

### removeFileObserver

    public void removeFileObserver(IFileObserver fileObserver)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Remove a file observer.

  Specified by:
    `removeFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.

### addFileObserver

    public void addFileObserver(IFileObserver fileObserver,
                                IFile fileFilter)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Add a file observer with a file filter. The file observer will be notified of file change events for the provided file filter.

  Specified by:
    `addFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.
    `fileFilter` - the file filter.

### addFileObserver

    public void addFileObserver(IFileObserver fileObserver,
                                IContentType[] contentTypeFilter)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Add a file observer with a content type filter. The file observer will be notified of file change events for any file whose file name is associated with the provided content type filter.

  Specified by:
    `addFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.
    `contentTypeFilter` - the content type array filter.

### addFileObserver

    public void addFileObserver(IFileObserver fileObserver,
                                IFolder folderFilter)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Add a file observer with a folder filter. The file observer will be notified of file change events for any file under the provided folder filter.

  Specified by:
    `addFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.
    `folderFilter` - the folder filter.

### addFileObserver

    public void addFileObserver(IFileObserver fileObserver,
                                java.lang.String[] extensionFilter)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Add a file observer with a file extension filter. The file observer will be notified of file change events for any file having the same file extension as the provided extension filter.

  Specified by:
    `addFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.
    `extensionFilter` - the file extension array filter.

### addFileObserver

    public void addFileObserver(IFileObserver fileObserver)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Add a file observer without a filter. The file observer will be notified of all file change events.

  Specified by:
    `addFileObserver` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `fileObserver` - the file observer.

### refreshLocal

    public void refreshLocal(IFile file)

  Description copied from interface: `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Refresh changes made to the file directly on disk with the workspace.

  Specified by:
    `refreshLocal` in interface `org.eclipse.gmf.runtime.common.ui.internal.resources.IFileChangeManager`
  Parameters:
    `file` - the file to refresh.

### getMovedFromResource

    public static IResource getMovedFromResource(IResourceDelta delta)

  Retrieve the moved from resource from the resource delta. The moved from resource is the original resource after a rename or move.

  Parameters:
    `delta` - the resource change containing the moved from path.
  Returns:
    the moved from resource.

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.