Package org.eclipse.team.ui.history
Class RevisionAnnotationController
java.lang.Object
org.eclipse.team.ui.history.RevisionAnnotationController
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 Summary
ConstructorDescriptionRevisionAnnotationController
(IWorkbenchPage page, IFile file, ISelectionProvider historyList) Create a controller that links an editor on a local file to a history list.RevisionAnnotationController
(IWorkbenchPage page, IStorageEditorInput editorInput, ISelectionProvider historyList) Create a controller that links an editor input on a remote file to a history list. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Dispose of the controller.protected abstract Object
getHistoryEntry
(Revision selected) Return the history list entry corresponding to the provided revision.protected String
getRevisionId
(Object historyEntry) Return the revision id associated with the given history list entry.static AbstractDecoratedTextEditor
openEditor
(IWorkbenchPage page, Object fileRevision, IStorage storage) Open a text editor that supports the use of a revision ruler on the given file.static AbstractDecoratedTextEditor
openEditor
(IWorkbenchPage page, IFile file) Open a text editor that supports the use of a revision ruler on the given file.protected void
revisionSelected
(Revision selected) Callback from the ruler when a particular revision has been selected by the user.
-
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 pagefile
- the local filehistoryList
- 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 pageeditorInput
- the editor input for the remote filehistoryList
- 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 openedfile
- 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 openedfileRevision
- the file revision objectstorage
- 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
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 bygetHistoryEntry(Revision)
. Subclasses may override.- Parameters:
selected
- the selected revision
-
getHistoryEntry
Return the history list entry corresponding to the provided revision. THis method is called by therevisionSelected(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
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 eitherIFileRevision
orIResourceVariant
in order to obtain the content identifier. Subclasses may override.- Parameters:
historyEntry
- the history list entry- Returns:
- the id of the entry
-