Package org.apache.uima.caseditor.editor
Class AnnotationEditor
java.lang.Object
org.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
org.eclipse.ui.texteditor.AbstractTextEditor
org.eclipse.ui.texteditor.StatusTextEditor
org.apache.uima.caseditor.editor.AnnotationEditor
- All Implemented Interfaces:
EventListener,ICasEditor,org.eclipse.core.runtime.IAdaptable,org.eclipse.core.runtime.IExecutableExtension,org.eclipse.ui.IEditorPart,org.eclipse.ui.INavigationLocationProvider,org.eclipse.ui.IPersistable,org.eclipse.ui.IPersistableEditor,org.eclipse.ui.IReusableEditor,org.eclipse.ui.ISaveablePart,org.eclipse.ui.ISaveablesSource,org.eclipse.ui.ISelectionListener,org.eclipse.ui.IWorkbenchPart,org.eclipse.ui.IWorkbenchPart2,org.eclipse.ui.IWorkbenchPart3,org.eclipse.ui.part.IWorkbenchPartOrientation,org.eclipse.ui.texteditor.ITextEditor,org.eclipse.ui.texteditor.ITextEditorExtension,org.eclipse.ui.texteditor.ITextEditorExtension2,org.eclipse.ui.texteditor.ITextEditorExtension3,org.eclipse.ui.texteditor.ITextEditorExtension4,org.eclipse.ui.texteditor.ITextEditorExtension5,org.eclipse.ui.texteditor.ITextEditorExtension6
public final class AnnotationEditor
extends org.eclipse.ui.texteditor.StatusTextEditor
implements ICasEditor, org.eclipse.ui.ISelectionListener
An editor to annotate text.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
org.eclipse.ui.texteditor.AbstractTextEditor.AbstractSelectionChangedListener, org.eclipse.ui.texteditor.AbstractTextEditor.ColumnSupport, org.eclipse.ui.texteditor.AbstractTextEditor.IdMapEntry, org.eclipse.ui.texteditor.AbstractTextEditor.LineEndAction, org.eclipse.ui.texteditor.AbstractTextEditor.LineStartAction, org.eclipse.ui.texteditor.AbstractTextEditor.SelectionProvider, org.eclipse.ui.texteditor.AbstractTextEditor.TextEditorSavableNested classes/interfaces inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
org.eclipse.ui.texteditor.ITextEditorExtension3.InsertMode -
Field Summary
Fields inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
ACTION_MAP, COMMON_EDITOR_CONTEXT_MENU_ID, COMMON_RULER_CONTEXT_MENU_ID, DEFAULT_EDITOR_CONTEXT_MENU_ID, DEFAULT_RULER_CONTEXT_MENU_ID, fErrorLabel, PREFERENCE_COLOR_BACKGROUND, PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_FIND_SCOPE, PREFERENCE_COLOR_FOREGROUND, PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_BACKGROUND, PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_FOREGROUND, PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_FONT, PREFERENCE_HOVER_ENRICH_MODE, PREFERENCE_HYPERLINK_KEY_MODIFIER, PREFERENCE_HYPERLINK_KEY_MODIFIER_MASK, PREFERENCE_HYPERLINKS_ENABLED, PREFERENCE_NAVIGATION_SMART_HOME_END, PREFERENCE_RULER_CONTRIBUTIONS, PREFERENCE_SHOW_CARET_OFFSET, PREFERENCE_SHOW_CARRIAGE_RETURN, PREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_ENCLOSED_SPACES, PREFERENCE_SHOW_ENCLOSED_TABS, PREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_LEADING_SPACES, PREFERENCE_SHOW_LEADING_TABS, PREFERENCE_SHOW_LINE_FEED, PREFERENCE_SHOW_SELECTION_SIZE, PREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_TRAILING_SPACES, PREFERENCE_SHOW_TRAILING_TABS, PREFERENCE_SHOW_WHITESPACE_CHARACTERS, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED, PREFERENCE_USE_CUSTOM_CARETS, PREFERENCE_WHITESPACE_CHARACTER_ALPHA_VALUE, PREFERENCE_WIDE_CARET, PREFERENCE_WORD_WRAP_ENABLED, TAG_SELECTION_HORIZONTAL_PIXEL, TAG_SELECTION_LENGTH, TAG_SELECTION_OFFSET, TAG_SELECTION_TOP_PIXEL, VERTICAL_RULER_WIDTHFields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUTFields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
INSERT, SMART_INSERTFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the annotation listener.voidAdds the cas editor input listener.protected voidCreates custom annotation actions: Annotate Action Smart Annotate Action Delete Annotations Action Find Annotate Action.voidcreatePartControl(org.eclipse.swt.widgets.Composite parent) Configures the editor.protected org.eclipse.jface.text.source.ISourceViewercreateSourceViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles) protected org.eclipse.swt.widgets.ControlcreateStatusControl(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.runtime.IStatus status) voiddispose()protected voiddoSetInput(org.eclipse.ui.IEditorInput input) protected voideditorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu) getAdapter(Class adapter) Retrieves annotation editor adapters.static AnnotationEditor[]Creates a list of allAnnotationEditorwhich are currently opened.Returns the current annotation type.getAnnotationStyle(Type type) Retrieves anAnnotationStylefrom the underlying storage.intReturns the caret position relative to the start of the text.Gets the cas document provider.Returns the currentAnnotationDocumentof this editor.Retrieves the currently selected annotation.org.eclipse.swt.graphics.PointReturns the selection.Gets the shown annotation types.Retrieves the tooltip of the title.protected voidUsed to inform about input changes.voidinit(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) booleanChecks if the current instance is editable.booleanText is not editable, cause of the nature of the annotation editor.protected booleanisErrorStatus(org.eclipse.core.runtime.IStatus status) voidRemoves the annotation listener.voidRemoves the cas editor input listener.voidReopen editor with new type system.voidselectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) Notifies the current instance about selection changes in the workbench.voidsetAnnotationMode(Type type) Sets the new annotation type.voidSets an annotation style.voidsetShownAnnotationType(Type type, boolean isShown) Sets the shown annotation type.voidsetShownAnnotationTypes(Collection<Type> types) Sets the shown annotation types.voidShow view.voidSynchronizes all annotations with the eclipse annotation painter.Methods inherited from class org.eclipse.ui.texteditor.StatusTextEditor
doRevertToSaved, getStatusBanner, getStatusHeader, getStatusMessage, handleEditorInputChanged, sanityCheckState, setFocus, updatePartControl, updateStatusField, validateEditorInputStateMethods inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
addAction, addAction, addGroup, addRulerContextMenuListener, adjustHighlightRange, affectsTextPresentation, canHandleMove, close, configureInsertMode, containsSavedState, createColumnSupport, createContextMenuListener, createEmptyNavigationLocation, createNavigationActions, createNavigationLocation, createUndoRedoActions, createVerticalRuler, disposeDocumentProvider, doGetSelection, doRestoreState, doSave, doSaveAs, doSetSelection, editorSaved, enableOverwriteMode, enableSanityChecking, enableStateValidation, findAnnotation, firePropertyChange, getAction, getActiveSaveables, getContextMenuListener, getCoverage, getCursorListener, getCursorPosition, getDocumentProvider, getEditorContextMenuId, getFontPropertyPreferenceKey, getHelpContextId, getHighlightRange, getInitialWordWrapStatus, getInsertMode, getLegalInsertModes, getPreferenceStore, getProgressMonitor, getRangeIndicator, getRulerContextMenuId, getRulerMouseListener, getSaveables, getSelectionChangedListener, getSelectionProvider, getSourceViewer, getSourceViewerConfiguration, getStatusField, getStatusLineManager, getUndoRedoOperationApprover, getVerticalRuler, gotoAnnotation, handleCursorPositionChanged, handleExceptionOnSave, handleInsertModeChanged, handlePreferenceStoreChanged, initializeDragAndDrop, initializeViewerColors, installCodeMiningProviders, installTabsToSpacesConverter, installTextDragAndDrop, internalInit, isBlockSelectionModeEnabled, isBlockSelectionModeSupported, isChangeInformationShowing, isDirty, isEditorInputIncludedInContextMenu, isEditorInputReadOnly, isInInsertMode, isNavigationTarget, isSaveAsAllowed, isSpacesAsTabsDeletionEnabled, isTabsToSpacesConversionEnabled, isVisible, isWordWrapEnabled, isWordWrapSupported, markAsContentDependentAction, markAsPropertyDependentAction, markAsSelectionDependentAction, markAsStateDependentAction, markInNavigationHistory, modelOffset2WidgetOffset, openSaveErrorDialog, performRevert, performSave, performSaveAs, rememberSelection, removeActionActivationCode, removeRulerContextMenuListener, resetHighlightRange, restoreSelection, restoreState, rulerContextMenuAboutToShow, safelySanityCheckState, saveState, selectAndReveal, selectAndReveal, setAction, setActionActivationCode, setBlockSelectionMode, setCompatibilityMode, setDocumentProvider, setDocumentProvider, setEditorContextMenuId, setHelpContextId, setHighlightRange, setInput, setInputWithNotify, setInsertMode, setKeyBindingScopes, setPreferenceStore, setRangeIndicator, setRulerContextMenuId, setSourceViewerConfiguration, setStatusField, setStatusLineErrorMessage, setStatusLineMessage, setWordWrap, showChangeInformation, showHighlightRangeOnly, showRevisionInformation, showsHighlightRangeOnly, uninstallTabsToSpacesConverter, uninstallTextDragAndDrop, updateContentDependentActions, updateContributedRulerColumns, updateIndentPrefixes, updatePropertyDependentActions, updateSelectionDependentActions, updateState, updateStateDependentActions, updateStatusFields, validateState, widgetOffset2ModelOffsetMethods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setPartNameMethods inherited from class org.eclipse.ui.part.WorkbenchPart
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSiteMethods inherited from interface org.eclipse.ui.ISaveablePart
doSave, doSaveAs, isDirty, isSaveAsAllowed, isSaveOnCloseNeededMethods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener, setFocus
-
Constructor Details
-
AnnotationEditor
public AnnotationEditor()Creates an new AnnotationEditor object.
-
-
Method Details
-
init
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException - Specified by:
initin interfaceorg.eclipse.ui.IEditorPart- Overrides:
initin classorg.eclipse.ui.texteditor.AbstractTextEditor- Throws:
org.eclipse.ui.PartInitException
-
getCasDocumentProvider
Description copied from interface:ICasEditorGets the cas document provider.- Specified by:
getCasDocumentProviderin interfaceICasEditor- Returns:
- the cas document provider
-
getTitleToolTip
Retrieves the tooltip of the title.- Specified by:
getTitleToolTipin interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
getTitleToolTipin classorg.eclipse.ui.part.EditorPart- Returns:
- string of tooltip
-
getAdapter
Retrieves annotation editor adapters.- Specified by:
getAdapterin interfaceorg.eclipse.core.runtime.IAdaptable- Overrides:
getAdapterin classorg.eclipse.ui.texteditor.AbstractTextEditor- Parameters:
adapter- the adapter- Returns:
- an adapter or null
-
createSourceViewer
protected org.eclipse.jface.text.source.ISourceViewer createSourceViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles) - Overrides:
createSourceViewerin classorg.eclipse.ui.texteditor.AbstractTextEditor
-
createPartControl
public void createPartControl(org.eclipse.swt.widgets.Composite parent) Configures the editor.- Specified by:
createPartControlin interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
createPartControlin classorg.eclipse.ui.texteditor.StatusTextEditor- Parameters:
parent- the parent
-
isEditable
public boolean isEditable()Checks if the current instance is editable.- Specified by:
isEditablein interfaceorg.eclipse.ui.texteditor.ITextEditor- Overrides:
isEditablein classorg.eclipse.ui.texteditor.AbstractTextEditor- Returns:
- false
-
handleElementContentReplaced
protected void handleElementContentReplaced()Used to inform about input changes.- Overrides:
handleElementContentReplacedin classorg.eclipse.ui.texteditor.StatusTextEditor
-
doSetInput
protected void doSetInput(org.eclipse.ui.IEditorInput input) throws org.eclipse.core.runtime.CoreException - Overrides:
doSetInputin classorg.eclipse.ui.texteditor.StatusTextEditor- Throws:
org.eclipse.core.runtime.CoreException
-
isErrorStatus
protected boolean isErrorStatus(org.eclipse.core.runtime.IStatus status) - Overrides:
isErrorStatusin classorg.eclipse.ui.texteditor.StatusTextEditor
-
editorContextMenuAboutToShow
protected void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu) - Overrides:
editorContextMenuAboutToShowin classorg.eclipse.ui.texteditor.AbstractTextEditor
-
getDocument
Returns the currentAnnotationDocumentof this editor.- Specified by:
getDocumentin interfaceICasEditor- Returns:
- current
AnnotationDocument
-
reopenEditorWithNewTypeSystem
public void reopenEditorWithNewTypeSystem()Description copied from interface:ICasEditorReopen editor with new type system.- Specified by:
reopenEditorWithNewTypeSystemin interfaceICasEditor
-
getAnnotationMode
Returns the current annotation type.- Returns:
- - current annotation type
-
setAnnotationMode
Sets the new annotation type.- Parameters:
type- the new annotation mode
-
getShownAnnotationTypes
Gets the shown annotation types.- Returns:
- the shown annotation types
-
setShownAnnotationType
Sets the shown annotation type.- Parameters:
type- the typeisShown- the is shown
-
setShownAnnotationTypes
Sets the shown annotation types.- Parameters:
types- the new shown annotation types
-
getAnnotationStyle
Retrieves anAnnotationStylefrom the underlying storage.- Parameters:
type- the type- Returns:
- the annotation style
-
setAnnotationStyle
Sets an annotation style. Note: Internal usage only!- Parameters:
style- the new annotation style
-
syncAnnotationTypes
public void syncAnnotationTypes()Synchronizes all annotations with the eclipse annotation painter. -
addAnnotationListener
Adds the annotation listener.- Parameters:
listener- the listener
-
removeAnnotationListener
Removes the annotation listener.- Parameters:
listener- the listener
-
addCasEditorInputListener
Description copied from interface:ICasEditorAdds the cas editor input listener.- Specified by:
addCasEditorInputListenerin interfaceICasEditor- Parameters:
listener- the listener
-
removeCasEditorInputListener
Description copied from interface:ICasEditorRemoves the cas editor input listener.- Specified by:
removeCasEditorInputListenerin interfaceICasEditor- Parameters:
listener- the listener
-
getSelection
public org.eclipse.swt.graphics.Point getSelection()Returns the selection.- Returns:
- - the selection
-
getSelectedAnnotations
Retrieves the currently selected annotation. TODO: make this private ??? clients can use selections for this ...- Returns:
- the selected annotations or an empty list
-
getCaretOffset
public int getCaretOffset()Returns the caret position relative to the start of the text.- Returns:
- the caret position relative to the start of the text
-
showView
Show view.- Parameters:
viewName- the view name
-
isEditorInputModifiable
public boolean isEditorInputModifiable()Text is not editable, cause of the nature of the annotation editor. This does not mean, that the annotations are not editable.- Specified by:
isEditorInputModifiablein interfaceorg.eclipse.ui.texteditor.ITextEditorExtension2- Overrides:
isEditorInputModifiablein classorg.eclipse.ui.texteditor.AbstractTextEditor- Returns:
- false
-
selectionChanged
public void selectionChanged(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) Notifies the current instance about selection changes in the workbench.- Specified by:
selectionChangedin interfaceorg.eclipse.ui.ISelectionListener- Parameters:
part- the partselection- the selection
-
createActions
protected void createActions()Creates custom annotation actions: Annotate Action Smart Annotate Action Delete Annotations Action Find Annotate Action.- Overrides:
createActionsin classorg.eclipse.ui.texteditor.AbstractTextEditor
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.eclipse.ui.IWorkbenchPart- Overrides:
disposein classorg.eclipse.ui.texteditor.AbstractTextEditor
-
getAnnotationEditors
Creates a list of allAnnotationEditorwhich are currently opened.- Returns:
- the annotation editors
-
createStatusControl
protected org.eclipse.swt.widgets.Control createStatusControl(org.eclipse.swt.widgets.Composite parent, org.eclipse.core.runtime.IStatus status) - Overrides:
createStatusControlin classorg.eclipse.ui.texteditor.StatusTextEditor
-