|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.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 should not subclass this class, as it is quite likely that subclasses will be broken by future releases.
One major difference from SourceViewer, this viewer's stream-oriented IDocument is not kept up-to-date with the text changes in the underlying LPEX text widget.
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
LpexTextViewer
Field Summary | |
protected org.eclipse.jface.text.source.IAnnotationHover |
fAnnotationHover
The viewer's annotation hover. |
protected IContentAssistant |
fContentAssistant
The viewer's content assistant. |
protected org.eclipse.jface.text.formatter.IContentFormatter |
fContentFormatter
The viewer's content formatter. |
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 static int |
GAP_SIZE
The size of the gap between the vertical ruler and the text widget. |
Fields inherited from class com.ibm.lpex.alef.LpexTextViewer |
fLastTopPixel, 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 |
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()
Activate the installed TextViewer 'plugins' (hover, etc.). |
boolean |
canDoOperation(int operation)
Check whether the action specified by the operation id can be performed. |
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)
Creates the viewer's SWT control. |
void |
doOperation(int operation)
Performs the action specified by the operation id. |
org.eclipse.jface.text.source.IAnnotationModel |
getAnnotationModel()
Return this viewer's annotation model. |
org.eclipse.swt.widgets.Control |
getControl()
Return the primary SWT Control (LpexWindow) associated with this viewer. |
org.eclipse.jface.text.IRegion |
getRangeIndication()
|
protected void |
handleDispose()
Free all resources allocated by this viewer. |
protected void |
initializeLpexView(LpexView lpexView)
Hook to initialize a newly instantiated LpexView during the construction of this SourceViewer. |
void |
removeRangeIndication()
Remove the viewer's range indication. |
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 visibleRegionOffset,
int visibleRegionLength)
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. |
void |
setRangeIndication(int start,
int len,
boolean moveCursor)
Set 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. |
protected void |
updateProfile()
Hook for post-updateProfile command processing. |
Methods inherited from class org.eclipse.jface.viewers.Viewer |
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, 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, isEditable, overlapsWithVisibleRegion, removeTextInputListener, removeTextListener, removeViewportListener, resetPlugins, resetVisibleRegion, revealRange, setAutoIndentStrategy, setDefaultPrefix, setEditable, setEventConsumer, setIndentPrefixes, setSelectedRange, setTextColor, setTextColor, setTextDoubleClickStrategy, setTextHover, setTopIndex, setUndoManager, setVisibleRegion |
Field Detail |
protected IContentAssistant fContentAssistant
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 static final int GAP_SIZE
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)
parent
- the parent of the viewer's controltextEditor
- the LpexAbstractTextEditor instantiating this source viewerruler
- the vertical ruler used by this source viewerMethod Detail |
protected void createControl(org.eclipse.swt.widgets.Composite parent, int styles)
LpexTextViewer
Here are the steps carried out by this method:
The user must add their own LPEX actions and commands by extending updateProfile(), which is called when we are notified of the completion of the updateProfile command.
createControl
in class LpexTextViewer
LpexTextViewer.createControl(org.eclipse.swt.widgets.Composite, int)
public void setAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover annotationHover)
setAnnotationHover
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.setAnnotationHover(org.eclipse.jface.text.source.IAnnotationHover)
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.
configure
in interface org.eclipse.jface.text.source.ISourceViewer
configuration
- an LpexSourceViewerConfigurationLpexSourceViewerConfiguration
,
ISourceViewer.configure(org.eclipse.jface.text.source.SourceViewerConfiguration)
,
LpexCommonParser
public void activatePlugins()
LpexTextViewer
Defined by ITextViewer, as part of its plugins support.
activatePlugins
in interface org.eclipse.jface.text.ITextViewer
activatePlugins
in class LpexTextViewer
LpexTextViewer.activatePlugins()
public void setDocument(org.eclipse.jface.text.IDocument document)
setDocument
in interface org.eclipse.jface.text.ITextViewer
setDocument
in class LpexTextViewer
com.ibm.lpex.alef.LpexTextViewer
ITextViewer.setDocument(IDocument)
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.
setDocument
in interface org.eclipse.jface.text.ITextViewer
setDocument
in class LpexTextViewer
com.ibm.lpex.alef.LpexTextViewer
ITextViewer.setDocument(IDocument,int,int)
,
LpexTextViewer.setDocument(IDocument)
public void setDocument(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.source.IAnnotationModel annotationModel)
TextEvent
is issued. This text event does not carry
a related document event.setDocument
in interface org.eclipse.jface.text.source.ISourceViewer
document
- the viewer's new input documentannotationModel
- the model for the viewer's visual annotationsISourceViewer.setDocument(IDocument, IAnnotationModel)
public void setDocument(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.source.IAnnotationModel annotationModel, int visibleRegionOffset, int visibleRegionLength)
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 org.eclipse.jface.text.source.ISourceViewer
document
- the new input documentannotationModel
- the model of the viewer's visual annotationsISourceViewer.setDocument(IDocument,IAnnotationModel,int,int)
public org.eclipse.jface.text.source.IAnnotationModel getAnnotationModel()
getAnnotationModel
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.getAnnotationModel()
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 class LpexTextViewer
ITextOperationTarget.canDoOperation(int)
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 class LpexTextViewer
ITextOperationTarget.doOperation(int)
public void setRangeIndicator(org.eclipse.jface.text.source.Annotation rangeIndicator)
setRangeIndicator
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.setRangeIndicator(org.eclipse.jface.text.source.Annotation)
public void setRangeIndication(int start, int len, boolean moveCursor)
setRangeIndication
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.setRangeIndication(int, int, boolean)
public org.eclipse.swt.widgets.Control getControl()
LpexTextViewer
getControl
in class LpexTextViewer
LpexTextViewer.getControl()
public org.eclipse.jface.text.IRegion getRangeIndication()
getRangeIndication
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.getRangeIndication()
public void removeRangeIndication()
removeRangeIndication
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.removeRangeIndication()
public void showAnnotations(boolean show)
showAnnotations
in interface org.eclipse.jface.text.source.ISourceViewer
ISourceViewer.showAnnotations(boolean)
protected void initializeLpexView(LpexView lpexView)
Extend this method to set any file/view-specific parameters for this LpexView. Ensure you also call super.initializeLpexView(lpexView).
Here you may set any "File Open" preferences page settings for your solution's plugin, such as sequenceNumbers, sourceEncoding, save.textLimit, and save.trim. The updateProfile command will be called later.
initializeLpexView
in class LpexTextViewer
com.ibm.lpex.alef.LpexTextViewer
LpexTextViewer.createControl(org.eclipse.swt.widgets.Composite, int)
protected void updateProfile()
Called when a new LpexTextViewer is created (an LPEX document is opened), and whenever the updateProfile command is issued afterwards.
updateProfile
in class LpexTextViewer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |