|
SWT LPEX v3.0.0 | |||||||||||
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.
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() } |
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 org.eclipse.jface.text.source.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 org.eclipse.jface.text.formatter.IContentFormatter | fContentFormatter
The viewer's content formatter. |
protected org.eclipse.jface.text.information.IInformationPresenter | fInformationPresenter
The viewer's information presenter. |
protected org.eclipse.jface.text.source.IAnnotationHover | fOverviewRulerAnnotationHover
The viewer's overview ruler annotation hover. |
protected org.eclipse.jface.text.presentation.IPresentationReconciler | fPresentationReconciler
The viewer's presentation reconciler. |
protected org.eclipse.jface.text.reconciler.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 org.eclipse.jface.text.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(org.eclipse.swt.widgets.Composite parent,
org.eclipse.ui.texteditor.ITextEditor textEditor,
org.eclipse.jface.text.source.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(org.eclipse.jface.text.source.SourceViewerConfiguration configuration)
Configure the source viewer as described in the configuration. |
protected void | createControl(org.eclipse.swt.widgets.Composite parent,
int styles)
Create this source viewer's controls. |
protected org.eclipse.swt.widgets.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 org.eclipse.jface.preference.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 org.eclipse.jface.text.source.IAnnotationModel | createVisualAnnotationModel(org.eclipse.jface.text.source.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. |
org.eclipse.jface.text.source.IAnnotationModel | getAnnotationModel()
Return this viewer's annotation model. |
org.eclipse.swt.widgets.Control | getControl()
Return the primary SWT Control (an LpexMultiWindow) associated with this viewer. |
org.eclipse.swt.widgets.Composite | getPromptWindow()
Optionally create and return the prompt window. |
org.eclipse.jface.text.IRegion | getRangeIndication()
|
protected org.eclipse.jface.text.source.IVerticalRuler | getVerticalRuler()
Returns the vertical ruler of this viewer. |
org.eclipse.jface.text.source.IAnnotationModel | getVisualAnnotationModel()
Returns the visual annotation model of this viewer. |
protected void | handleDispose()
Free all resources allocated by this viewer. |
protected void | handleHelpRequest(org.eclipse.swt.events.HelpEvent e)
Handle a help request from our registered help listener. |
protected org.eclipse.swt.graphics.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(org.eclipse.jface.text.source.IAnnotationHover annotationHover)
|
void | setDocument(org.eclipse.jface.text.IDocument document)
Set the viewer's IDocument. |
void | setDocument(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.source.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(org.eclipse.jface.text.IDocument document,
org.eclipse.jface.text.source.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(org.eclipse.jface.text.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(org.eclipse.jface.text.source.IAnnotationHover annotationHover)
Sets the overview ruler's annotation hover of this source viewer. |
void | setRangeIndication(int start,
int len,
boolean moveCursor)
Sets the viewers's range indication to the specified range. |
void | setRangeIndicator(org.eclipse.jface.text.source.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 |
Methods inherited from interface org.eclipse.jface.text.ITextViewer |
---|
addTextInputListener, addTextListener, addViewportListener, changeTextPresentation, getBottomIndex, getBottomIndexEndOffset, getDocument, getFindReplaceTarget, getSelectedRange, getSelectionProvider, getTextOperationTarget, getTextWidget, getTopIndex, getTopIndexStartOffset, getTopInset, getVisibleRegion, invalidateTextPresentation, isEditable, overlapsWithVisibleRegion, removeTextInputListener, removeTextListener, removeViewportListener, resetPlugins, resetVisibleRegion, revealRange, setAutoIndentStrategy, setDefaultPrefixes, setEditable, setEventConsumer, setIndentPrefixes, setSelectedRange, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTopIndex, setUndoManager, setVisibleRegion |
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 org.eclipse.jface.text.formatter.IContentFormatter fContentFormatter
protected org.eclipse.jface.text.reconciler.IReconciler fReconciler
protected org.eclipse.jface.text.presentation.IPresentationReconciler fPresentationReconciler
protected org.eclipse.jface.text.source.IAnnotationHover fAnnotationHover
protected final Stack fSelections
protected org.eclipse.jface.text.IPositionUpdater fSelectionUpdater
protected String fSelectionCategory
protected org.eclipse.jface.text.source.IAnnotationHover fOverviewRulerAnnotationHover
protected org.eclipse.jface.text.information.IInformationPresenter fInformationPresenter
Constructor Detail |
public LpexSourceViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.texteditor.ITextEditor textEditor, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles)
Method Detail |
protected void createControl(org.eclipse.swt.widgets.Composite parent, int styles)
protected org.eclipse.swt.widgets.Layout createLayout()
public org.eclipse.swt.widgets.Control getControl()
public org.eclipse.swt.widgets.Composite getPromptWindow()
public void setAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover annotationHover)
public void setOverviewRulerAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover annotationHover)
public void configure(org.eclipse.jface.text.source.SourceViewerConfiguration configuration)
You should use an LpexSourceViewerConfiguration-based class to configure an LpexSourceViewer.
LpexSourceViewer does not use/implement certain (Lpex)SourceViewerConfiguration features.
protected void ensureAnnotationHoverManagerInstalled()
public void activatePlugins()
public void setDocument(org.eclipse.jface.text.IDocument document)
public void setDocument(org.eclipse.jface.text.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.
public void setDocument(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.source.IAnnotationModel annotationModel)
protected org.eclipse.jface.text.source.IAnnotationModel createVisualAnnotationModel(org.eclipse.jface.text.source.IAnnotationModel annotationModel)
public void setDocument(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.source.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)
public org.eclipse.jface.text.source.IAnnotationModel getAnnotationModel()
public org.eclipse.jface.text.source.IAnnotationModel getVisualAnnotationModel()
public void unconfigure()
protected void handleDispose()
public boolean canDoOperation(int operation)
Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly for querying availability.
protected org.eclipse.swt.graphics.Point rememberSelection()
protected void restoreSelection()
protected void clearRememberedSelection()
public void doOperation(int operation)
Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly.
public void enableOperation(int operation, boolean enable)
public void setRangeIndicator(org.eclipse.jface.text.source.Annotation rangeIndicator)
public void setRangeIndication(int start, int len, boolean moveCursor)
public org.eclipse.jface.text.IRegion getRangeIndication()
public void removeRangeIndication()
public void showAnnotations(boolean show)
protected final org.eclipse.jface.text.source.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.
protected void setLanguageHelp(LpexLanguageHelp lsh)
protected void handleHelpRequest(org.eclipse.swt.events.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.
protected org.eclipse.jface.preference.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.
|
SWT LPEX v3.0.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |