Class RevisionAnnotationController

java.lang.Object
org.eclipse.team.ui.history.RevisionAnnotationController

public abstract class RevisionAnnotationController extends Object
Helper class that coordinates the selection behavior between an editor revision ruler and a history list such as one shown in the history view. In other words, the selection in the history list will be reflected in the revision rule and vice versa.
Since:
3.3
See Also:
  • Constructor Details

    • RevisionAnnotationController

      public RevisionAnnotationController(IWorkbenchPage page, IFile file, ISelectionProvider historyList)
      Create a controller that links an editor on a local file to a history list.
      Parameters:
      page - the workbench page
      file - the local file
      historyList - the history list selection provider
    • RevisionAnnotationController

      public RevisionAnnotationController(IWorkbenchPage page, IStorageEditorInput editorInput, ISelectionProvider historyList)
      Create a controller that links an editor input on a remote file to a history list.
      Parameters:
      page - the workbench page
      editorInput - the editor input for the remote file
      historyList - the history list selection provider
  • Method Details

    • openEditor

      public static AbstractDecoratedTextEditor openEditor(IWorkbenchPage page, IFile file) throws PartInitException
      Open a text editor that supports the use of a revision ruler on the given file. If an appropriate editor is already open, it is returned. Otherwise a new editor is opened.
      Parameters:
      page - the page in which the editor is to be opened
      file - the file to be edited
      Returns:
      the open editor on the file
      Throws:
      PartInitException - swallowed
    • openEditor

      public static AbstractDecoratedTextEditor openEditor(IWorkbenchPage page, Object fileRevision, IStorage storage) throws PartInitException
      Open a text editor that supports the use of a revision ruler on the given file. If an appropriate editor is already open, it is returned. Otherwise a new editor is opened.
      Parameters:
      page - the page in which the editor is to be opened
      fileRevision - the file revision object
      storage - the storage that provides access to the contents of the file revision
      Returns:
      the open editor on the file revision
      Throws:
      PartInitException - if an error occurs
    • dispose

      public void dispose()
      Dispose of the controller.
    • revisionSelected

      protected void revisionSelected(Revision selected)
      Callback from the ruler when a particular revision has been selected by the user. By default, this method will set the selection of the history list selection provider that was passed in the constructor using the history entry returned by getHistoryEntry(Revision). Subclasses may override.
      Parameters:
      selected - the selected revision
    • getHistoryEntry

      protected abstract Object getHistoryEntry(Revision selected)
      Return the history list entry corresponding to the provided revision. THis method is called by the revisionSelected(Revision) method in order to determine what the selection of the history list selection provider should be set to.
      Parameters:
      selected - the selected revision.
      Returns:
      the history list entry that corresponds to the provided revision.
    • getRevisionId

      protected String getRevisionId(Object historyEntry)
      Return the revision id associated with the given history list entry. This method is used to determine which revision in the revision ruler should be highlighted when the history list selection provider fires a selection changed event. By default, this method tries to adapt the entry to either IFileRevision or IResourceVariant in order to obtain the content identifier. Subclasses may override.
      Parameters:
      historyEntry - the history list entry
      Returns:
      the id of the entry