|
SWT LPEX v3.0.5 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jface.viewers.Viewer
com.ibm.lpex.alef.LpexTextViewer
com.ibm.lpex.alef.LpexSourceViewer
A line-oriented, LPEX-based partial implementation of
org.eclipse.jface.text.source.ISourceViewer
.
A source viewer uses an IVerticalRuler
as its annotation
presentation area. The vertical ruler is a small strip shown left of the
viewer's text widget.
Clients are supposed to instantiate a source viewer and subsequently
communicate with it exclusively using the ISourceViewer
interface.
Clients should not subclass this class, as it is quite likely that subclasses will be broken by future releases.
Several SourceViewer classes, methods, and fields are not available in LpexSourceViewer. Most programming of the underlying LPEX widget should be done directly via its LpexView and LpexWindow.
method's
documentation
Always use LpexView to set the text of the edited document. For example:
IEditorPart editor = IWorkbenchPage.getActiveEditor(); // (a) Using LPEX if (editor instanceof LpexTextEditor) { LpexTextEditor lpexEditor = (LpexTextEditor)editor; LpexView lpexView = lpexEditor.getLpexView(); if (lpexView != null) { lpexView.doDefaultCommand("insertText " + text); // insert text at cursor LpexView.doGlobalCommand("screenShow"); // refresh display } } // (b) Using an Eclipse editor else { // . . . get DocumentProvider, get IDocument, do replace() } |
LpexTextViewer
Nested Class Summary | |
---|---|
protected class |
LpexSourceViewer.RulerLayout
Layout of this source viewer. |
Nested classes inherited from class com.ibm.lpex.alef.LpexTextViewer |
---|
LpexTextViewer.TextHoverKey |
Field Summary | |
---|---|
protected static String |
_SELECTION_POSITION_CATEGORY
Partial name of the position category to manage remembered selections. |
protected IAnnotationHover |
fAnnotationHover
The viewer's annotation hover. |
protected IContentAssistant |
fContentAssistant
The viewer's content assistant. |
protected boolean |
fContentAssistantInstalled
Flag indicating whether the viewer's content assistant is installed (enabled). |
protected IContentFormatter |
fContentFormatter
The viewer's content formatter. |
protected IInformationPresenter |
fInformationPresenter
The viewer's information presenter. |
protected IAnnotationHover |
fOverviewRulerAnnotationHover
The viewer's overview ruler annotation hover. |
protected IPresentationReconciler |
fPresentationReconciler
The viewer's presentation reconciler. |
protected IReconciler |
fReconciler
The viewer's model reconciler. |
protected String |
fSelectionCategory
Position category used by the selection updater. |
protected Stack |
fSelections
Stack of saved selections in the underlying document. |
protected IPositionUpdater |
fSelectionUpdater
Position updater for saved selections. |
protected static int |
GAP_SIZE
The size of the gap between the vertical ruler and the text widget. |
protected static Object |
MODEL_ANNOTATION_MODEL
Key of the model annotation model inside the visual annotation model. |
Fields inherited from class com.ibm.lpex.alef.LpexTextViewer |
---|
fHoverControlCreator, fInformationMapping, fLastTopPixel, fPartitioning, fReplaceTextPresentation, fTextHovers, fTextInputListeners, fViewportListeners, INTERNAL, KEY, MOUSE, MOUSE_END, RESIZE, SCROLLER, TRACE_ERRORS |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
---|
WIDGET_DATA_KEY |
Fields inherited from interface org.eclipse.jface.text.source.ISourceViewer |
---|
CONTENTASSIST_CONTEXT_INFORMATION, CONTENTASSIST_PROPOSALS, FORMAT, INFORMATION |
Fields inherited from interface org.eclipse.jface.text.ITextOperationTarget |
---|
COPY, CUT, DELETE, PASTE, PREFIX, PRINT, REDO, SELECT_ALL, SHIFT_LEFT, SHIFT_RIGHT, STRIP_PREFIX, UNDO |
Constructor Summary | |
---|---|
LpexSourceViewer(Composite parent,
ITextEditor textEditor,
IVerticalRuler ruler,
int styles)
Constructs a new LPEX source viewer. |
Method Summary | |
---|---|
void |
activatePlugins()
Extends LpexTextViewer's to install the annotation hover. |
boolean |
canDoOperation(int operation)
Check whether the action specified by the operation id can be performed. |
protected void |
clearRememberedSelection()
|
void |
configure(SourceViewerConfiguration configuration)
Configure the source viewer as described in the configuration. |
protected void |
createControl(Composite parent,
int styles)
Create this source viewer's controls. |
protected Layout |
createLayout()
Creates the layout used for this viewer. |
protected void |
createViewPreferenceNodes(LpexSourceViewer lpexSourceViewer)
Hook to allow the solution plug-in create custom preference node(s) for view-scoped preference page(s) for this source viewer. |
protected IPreferencePage |
createViewPreferencePage(LpexView lpexView,
int nodeType)
Factory method to create the preference page for a view-scoped preference node used by this source viewer. |
protected IAnnotationModel |
createVisualAnnotationModel(IAnnotationModel annotationModel)
Creates the visual annotation model on top of the given annotation model. |
void |
doOperation(int operation)
Performs the action specified by the operation id. |
void |
enableOperation(int operation,
boolean enable)
|
protected void |
ensureAnnotationHoverManagerInstalled()
Ensure the annotation hover manager is installed. |
IAnnotationModel |
getAnnotationModel()
Return this viewer's annotation model. |
Control |
getControl()
Returns the primary control of this source viewer. |
Composite |
getPromptWindow()
Optionally create and return the prompt window. |
IRegion |
getRangeIndication()
|
protected IVerticalRuler |
getVerticalRuler()
Returns the vertical ruler of this viewer. |
IAnnotationModel |
getVisualAnnotationModel()
Returns the visual annotation model of this viewer. |
protected void |
handleDispose()
Free all resources allocated by this viewer. |
protected void |
handleHelpRequest(HelpEvent e)
Handle a help request from our registered help listener. |
protected Point |
rememberSelection()
Remembers and returns the current selection. |
void |
removeRangeIndication()
Remove the viewer's range indication. |
protected void |
restoreSelection()
Restores a previously saved selection in the document. |
void |
setAnnotationHover(IAnnotationHover annotationHover)
|
void |
setDocument(IDocument document)
Set the viewer's IDocument. |
void |
setDocument(IDocument document,
IAnnotationModel annotationModel)
Sets the given document as this viewer's text model and the given annotation model as the model for this viewer's visual annotations. |
void |
setDocument(IDocument document,
IAnnotationModel annotationModel,
int modelRangeOffset,
int modelRangeLength)
Sets the given document as this viewer's text model and the given annotation model as the model for this viewer's visual annotations. |
void |
setDocument(IDocument document,
int visibleRegionOffset,
int visibleRegionLength)
This method just sets the viewer's IDocument. |
protected void |
setLanguageHelp(LpexLanguageHelp lsh)
Set the provider for this source viewer's LPEX document parser language-sensitive help (LSH). |
void |
setOverviewRulerAnnotationHover(IAnnotationHover annotationHover)
Sets the overview ruler's annotation hover of this source viewer. |
void |
setRangeIndication(int start,
int len,
boolean moveCursor)
Sets this viewer's range indication (in the vertical ruler to its left) to the specified range. |
void |
setRangeIndicator(Annotation rangeIndicator)
Set the annotation used as range indicator for the viewer's vertical ruler. |
void |
showAnnotations(boolean show)
Control the visibility of annotations and, in the case of separate presentation areas of text and annotations, the visibility of the annotation's presentation area. |
void |
unconfigure()
Unconfigures this source viewer. |
protected void |
updateProfile(LpexView lpexView)
Hook for post-updateProfile command processing. |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
---|
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, inputChanged, removeHelpListener, removeSelectionChangedListener, scrollDown, scrollUp, setData, setSelection |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final int GAP_SIZE
protected static final String _SELECTION_POSITION_CATEGORY
protected static final Object MODEL_ANNOTATION_MODEL
protected IContentAssistant fContentAssistant
protected boolean fContentAssistantInstalled
protected IContentFormatter fContentFormatter
protected IReconciler fReconciler
protected IPresentationReconciler fPresentationReconciler
protected IAnnotationHover fAnnotationHover
protected final Stack fSelections
protected IPositionUpdater fSelectionUpdater
protected String fSelectionCategory
protected IAnnotationHover fOverviewRulerAnnotationHover
protected IInformationPresenter fInformationPresenter
Constructor Detail |
public LpexSourceViewer(Composite parent, ITextEditor textEditor, IVerticalRuler ruler, int styles)
parent
- the parent of the viewer's controltextEditor
- the LpexAbstractTextEditor instantiating this source viewerruler
- the vertical ruler used by this source viewerstyles
- the SWT style bitsMethod Detail |
protected void createControl(Composite parent, int styles)
createControl
in class LpexTextViewer
parent
- the parent of the viewer's controlstyles
- the SWT style bits for the viewer's controlLpexTextViewer.createControl(org.eclipse.swt.widgets.Composite, int)
,
getPromptWindow()
protected Layout createLayout()
public Control getControl()
getControl
in interface ITextViewerExtension
getControl
in class LpexTextViewer
Viewer.getControl()
public Composite getPromptWindow()
null
if the prompt window could not be createdpublic void setAnnotationHover(IAnnotationHover annotationHover)
setAnnotationHover
in interface ISourceViewer
ISourceViewer.setAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover)
public void setOverviewRulerAnnotationHover(IAnnotationHover annotationHover)
annotationHover
- the hover to be used; null
is a valid argumentpublic void configure(SourceViewerConfiguration configuration)
You should use an LpexSourceViewerConfiguration-based class to configure an LpexSourceViewer.
LpexSourceViewer does not use/implement certain (Lpex)SourceViewerConfiguration features.
configure
in interface ISourceViewer
configuration
- an LpexSourceViewerConfigurationLpexSourceViewerConfiguration
,
ISourceViewer.configure(org.eclipse.jface.text.source.SourceViewerConfiguration)
,
LpexCommonParser
protected void ensureAnnotationHoverManagerInstalled()
public void activatePlugins()
activatePlugins
in interface ITextViewer
activatePlugins
in class LpexTextViewer
ITextViewer.activatePlugins()
public void setDocument(IDocument document)
setDocument
in interface ITextViewer
setDocument
in class LpexTextViewer
ITextViewer.setDocument(IDocument)
public void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength)
In LpexSourceViewer, the visible document is always the viewer's (entire) input document. To display only certain region(s) of the document in the viewer, set marks for these regions, and set their included or excluded attribute. See the mark, markIncluded, and markExcluded parameters.
In SourceViewer, this method sets the viewer's document and the visible region.
setDocument
in interface ITextViewer
setDocument
in class LpexTextViewer
ITextViewer.setDocument(IDocument,int,int)
,
LpexTextViewer.setDocument(IDocument)
public void setDocument(IDocument document, IAnnotationModel annotationModel)
TextEvent
is issued. This text event does not carry
a related document event.
setDocument
in interface ISourceViewer
document
- the viewer's new input documentannotationModel
- the model for the viewer's visual annotations
(the document provider's annotation model)ISourceViewer.setDocument(IDocument, IAnnotationModel)
protected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel)
annotationModel
- the wrapped annotation model
public void setDocument(IDocument document, IAnnotationModel annotationModel, int modelRangeOffset, int modelRangeLength)
In SourceViewer, the presentation is also updated, whereby only the specified region is made visible. In SourceViewer, this is a convenience method for
setDocument(document, annotationModel); setVisibleRegion(offset, length)
setDocument
in interface ISourceViewer
document
- the new input documentannotationModel
- the model of the viewer's visual annotations
(our IDocument provider's annotation model)ISourceViewer.setDocument(IDocument,IAnnotationModel,int,int)
public IAnnotationModel getAnnotationModel()
getAnnotationModel
in interface ISourceViewer
ISourceViewer.getAnnotationModel()
public IAnnotationModel getVisualAnnotationModel()
ISourceViewerExtension2.getVisualAnnotationModel()
public void unconfigure()
ISourceViewerExtension2.unconfigure()
protected void handleDispose()
handleDispose
in class LpexTextViewer
LpexTextViewer.handleDispose()
public boolean canDoOperation(int operation)
LpexTextViewer
Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly for querying availability.
canDoOperation
in interface ITextOperationTarget
canDoOperation
in class LpexTextViewer
operation
- LPEX-defined operation id (including the equivalents of
ITextOperationTarget.UNDO, .REDO, etc.)ITextOperationTarget.canDoOperation(int)
protected Point rememberSelection()
restoreSelection()
.
ITextViewer.getSelectedRange()
protected void restoreSelection()
protected void clearRememberedSelection()
public void doOperation(int operation)
LpexTextViewer
canDoOperation()
returns true
.
Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly.
doOperation
in interface ITextOperationTarget
doOperation
in class LpexTextViewer
operation
- LPEX-defined operation id (including the equivalents of
ITextOperationTarget.UNDO, .REDO, etc.)ITextOperationTarget.doOperation(int)
public void enableOperation(int operation, boolean enable)
enableOperation
in interface ITextOperationTargetExtension
enableOperation
in class LpexTextViewer
public void setRangeIndicator(Annotation rangeIndicator)
setRangeIndicator
in interface ISourceViewer
ISourceViewer.setRangeIndicator(org.eclipse.jface.text.source.Annotation)
public void setRangeIndication(int start, int len, boolean moveCursor)
setRangeIndication
in interface ISourceViewer
start
- the offset of the rangelen
- the length of the rangemoveCursor
- indicates whether the cursor should be moved to the given
offsetISourceViewer.setRangeIndication(int,int,boolean)
public IRegion getRangeIndication()
getRangeIndication
in interface ISourceViewer
ISourceViewer.getRangeIndication()
public void removeRangeIndication()
removeRangeIndication
in interface ISourceViewer
ISourceViewer.removeRangeIndication()
public void showAnnotations(boolean show)
showAnnotations
in interface ISourceViewer
ISourceViewer.showAnnotations(boolean)
protected final IVerticalRuler getVerticalRuler()
protected void updateProfile(LpexView lpexView)
Called when a new document view is created (a new document is opened in this viewer, and is, at this point, already loaded in the editor), and whenever the updateProfile command is issued afterwards.
updateProfile
in class LpexTextViewer
lpexView
- the primary or secondary document view whose profile
has been updatedprotected void setLanguageHelp(LpexLanguageHelp lsh)
protected void handleHelpRequest(HelpEvent e)
protected void createViewPreferenceNodes(LpexSourceViewer lpexSourceViewer)
A custom preference node is a subclass of LpexViewPreferenceNode. Custom nodes are added after the LPEX view-scoped preference nodes, in the order in which they are created.
LpexAbstractTextEditor.createViewPreferenceNodes(com.ibm.lpex.alef.LpexSourceViewer)
,
LpexViewPreferenceNode
protected IPreferencePage createViewPreferencePage(LpexView lpexView, int nodeType)
If you extend this method, ensure you call super.createViewPreferencePage() for the node types you don't support or customize.
nodeType
- preference node type, one of LpexViewPreferenceNode.VIEW_BASE_PREFERENCE_NODE
,
LpexViewPreferenceNode.VIEW_PARSER_PREFERENCE_NODE
,
LpexViewPreferenceNode.VIEW_SEQUENCE_NUMBERS_PREFERENCE_NODE
,
LpexViewPreferenceNode.VIEW_SOURCE_ENCODING_PREFERENCE_NODE
LpexAbstractTextEditor.createViewPreferencePage(com.ibm.lpex.core.LpexView, int)
|
SWT LPEX v3.0.5 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |