|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.viewers.Viewer
org.eclipse.jface.text.TextViewer
org.eclipse.jface.text.source.SourceViewer
org.eclipse.jface.text.source.projection.ProjectionViewer
A projection source viewer is a source viewer which supports multiple visible regions which can dynamically be changed.
A projection source viewer uses a ProjectionDocumentManager
for the management of the visible document.
NOTE: The ProjectionViewer only supports projections that cover full lines.
This class should not be subclassed.
| Nested Class Summary |
|---|
| Nested classes inherited from class org.eclipse.jface.text.source.SourceViewer |
|---|
SourceViewer.RulerLayout |
| Nested classes inherited from class org.eclipse.jface.text.TextViewer |
|---|
TextViewer.TextHoverKey, TextViewer.WidgetCommand |
| Field Summary | |
|---|---|
static int |
COLLAPSE
Operation constant for the collapse operation. |
static int |
COLLAPSE_ALL
Operation constant for the collapse all operation. |
static int |
EXPAND
Operation constant for the expand operation. |
static int |
EXPAND_ALL
Operation constant for the expand all operation. |
static int |
TOGGLE
Operation constant for the toggle projection operation. |
| Fields inherited from class org.eclipse.jface.text.source.SourceViewer |
|---|
_SELECTION_POSITION_CATEGORY, fAnnotationHover, fContentAssistant, fContentAssistantInstalled, fContentFormatter, fInformationPresenter, fOverviewRulerAnnotationHover, fPresentationReconciler, fQuickAssistAssistant, fQuickAssistAssistantInstalled, fReconciler, fSelectionCategory, fSelections, fSelectionUpdater, GAP_SIZE, GAP_SIZE_1, MODEL_ANNOTATION_MODEL |
| 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, QUICK_ASSIST |
| Fields inherited from interface org.eclipse.jface.text.ITextViewerExtension2 |
|---|
DEFAULT_HOVER_STATE_MASK |
| 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 | |
|---|---|
ProjectionViewer(Composite parent,
IVerticalRuler ruler,
IOverviewRuler overviewRuler,
boolean showsAnnotationOverview,
int styles)
Creates a new projection source viewer. |
|
| Method Summary | |
|---|---|
void |
addProjectionListener(IProjectionListener listener)
Adds a projection annotation listener to this viewer. |
void |
addVerticalRulerColumn(IVerticalRulerColumn column)
Adds the give column as last column to this viewer's vertical ruler. |
boolean |
canDoOperation(int operation)
Returns whether the operation specified by the given operation code can be performed. |
IRegion |
computeCollapsedRegion(Position position)
Computes the region that must be collapsed when the given position is the position of an expanded projection annotation. |
Position |
computeCollapsedRegionAnchor(Position position)
Computes the collapsed region anchor for the given position. |
protected void |
copyMarkedRegion(boolean delete)
Copies/cuts the marked region. |
protected ISlaveDocumentManager |
createSlaveDocumentManager()
Creates a new slave document manager. |
protected IAnnotationModel |
createVisualAnnotationModel(IAnnotationModel annotationModel)
Creates the visual annotation model on top of the given annotation model. |
void |
disableProjection()
Disables the projection mode. |
void |
doOperation(int operation)
Performs the operation specified by the operation code on the target. |
void |
enableProjection()
Enables the projection mode. |
boolean |
exposeModelRange(IRegion modelRange)
Exposes the given model range. |
protected int |
findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
boolean regExSearch)
Adheres to the contract of IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean). |
protected int |
findAndSelectInRange(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
int rangeOffset,
int rangeLength,
boolean regExSearch)
Adheres to the contract of IFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean). |
protected void |
fireProjectionDisabled()
Notifies all registered projection listeners that projection mode has been disabled. |
protected void |
fireProjectionEnabled()
Notifies all registered projection listeners that projection mode has been enabled. |
IRegion[] |
getCoveredModelRanges(IRegion modelRange)
Returns the maximal subranges of the given model range thus that there is no offset inside a subrange for which there is no image offset. |
protected FindReplaceDocumentAdapter |
getFindReplaceDocumentAdapter()
Returns the find/replace document adapter. |
ProjectionAnnotationModel |
getProjectionAnnotationModel()
Returns the projection annotation model. |
IRegion |
getVisibleRegion()
Returns the current visible region of this viewer's document. |
protected void |
handleDispose()
Frees all resources allocated by this viewer. |
protected void |
handleVerifyEvent(VerifyEvent e)
Handles the verify event issued by the viewer's text widget. |
protected void |
handleVisibleDocumentAboutToBeChanged(DocumentEvent event)
Hook method called when the visible document is about to be changed. |
protected void |
handleVisibleDocumentChanged(DocumentEvent event)
Hook method called when the visible document has been changed. |
boolean |
isProjectionMode()
Returns whether this viewer is in projection mode. |
boolean |
overlapsWithVisibleRegion(int offset,
int length)
Returns whether a given range overlaps with the visible region of this viewer's document. |
protected void |
postCatchupRequest(AnnotationModelEvent event)
Posts the request for catch up with the annotation model into the UI thread. |
protected void |
processCatchupRequest(AnnotationModelEvent event)
Processes the request for catch up with the annotation model in the UI thread. |
void |
reinitializeProjection()
Forces this viewer to throw away any old state and to initialize its content from its projection annotation model. |
void |
removeProjectionListener(IProjectionListener listener)
Removes the given listener from this viewer. |
void |
removeVerticalRulerColumn(IVerticalRulerColumn column)
Removes the give column from this viewer's vertical ruler. |
void |
resetVisibleRegion()
Resets the region of this viewer's document which is visible in the presentation. |
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 |
setProjectionSummary(org.eclipse.jface.text.source.projection.ProjectionSummary projectionSummary)
Sets the projection summary for this viewer. |
void |
setRangeIndication(int offset,
int length,
boolean moveCursor)
Sets the viewers's range indication to the specified range. |
protected void |
setVisibleDocument(IDocument document)
Sets this viewer's visible document. |
void |
setVisibleRegion(int start,
int length)
Defines and sets the region of this viewer's document which will be visible in the presentation. |
protected boolean |
updateSlaveDocument(IDocument slaveDocument,
int modelRangeOffset,
int modelRangeLength)
Updates the given slave document to show the specified range of its master document. |
protected Point |
widgetSelection2ModelSelection(Point widgetSelection)
Adapts the behavior of the super class to respect line based folding. |
| Methods inherited from class org.eclipse.jface.viewers.Viewer |
|---|
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, 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.ITextViewerExtension5 |
|---|
getModelCoverage, modelLine2WidgetLine, modelOffset2WidgetOffset, modelRange2WidgetRange, widgetLine2ModelLine, widgetLineOfWidgetOffset, widgetOffset2ModelOffset, widgetRange2ModelRange |
| Methods inherited from interface org.eclipse.jface.text.ITextViewerExtension3 |
|---|
widgetlLine2ModelLine |
| Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider |
|---|
addSelectionChangedListener, removeSelectionChangedListener, setSelection |
| Field Detail |
public static final int EXPAND
public static final int COLLAPSE
public static final int TOGGLE
public static final int EXPAND_ALL
public static final int COLLAPSE_ALL
| Constructor Detail |
public ProjectionViewer(Composite parent,
IVerticalRuler ruler,
IOverviewRuler overviewRuler,
boolean showsAnnotationOverview,
int styles)
parent - the SWT parent controlruler - the vertical ruleroverviewRuler - the overview rulershowsAnnotationOverview - true if the overview ruler should be shownstyles - the SWT style bits| Method Detail |
public void setProjectionSummary(org.eclipse.jface.text.source.projection.ProjectionSummary projectionSummary)
projectionSummary - the projection summary.
public void setDocument(IDocument document,
IAnnotationModel annotationModel,
int modelRangeOffset,
int modelRangeLength)
ISourceViewerTextEvent is issued. The text event does not carry a
related document event. This method is a convenience method for
setDocument(document, annotationModel);setVisibleRegion(offset, length).
setDocument in interface ISourceViewersetDocument in class SourceViewerprotected IAnnotationModel createVisualAnnotationModel(IAnnotationModel annotationModel)
SourceViewer
createVisualAnnotationModel in class SourceViewerannotationModel - the wrapped annotation model
public ProjectionAnnotationModel getProjectionAnnotationModel()
protected ISlaveDocumentManager createSlaveDocumentManager()
TextViewerChildDocumentManager.
createSlaveDocumentManager in class TextViewer
protected boolean updateSlaveDocument(IDocument slaveDocument,
int modelRangeOffset,
int modelRangeLength)
throws BadLocationException
TextViewer
updateSlaveDocument in class TextViewerslaveDocument - the slave documentmodelRangeOffset - the offset of the master document rangemodelRangeLength - the length of the master document range
true if the slave has been adapted successfully
BadLocationException - in case the specified range is not valid in the master documentpublic void addProjectionListener(IProjectionListener listener)
null. If the listener is already registered, this method
does not have any effect.
listener - the listener to addpublic void removeProjectionListener(IProjectionListener listener)
null. If the listener is not registered with this viewer,
this method is without effect.
listener - the listener to removeprotected void fireProjectionEnabled()
protected void fireProjectionDisabled()
public final boolean isProjectionMode()
true if this viewer is in projection mode,
false otherwisepublic final void disableProjection()
public final void enableProjection()
public void setVisibleRegion(int start,
int length)
ITextViewer
setVisibleRegion in interface ITextViewersetVisibleRegion in class TextViewerprotected void setVisibleDocument(IDocument document)
TextViewer
setVisibleDocument in class TextViewerdocument - the visible documentpublic void resetVisibleRegion()
ITextViewer
resetVisibleRegion in interface ITextViewerresetVisibleRegion in class TextViewerpublic IRegion getVisibleRegion()
ITextViewersetVisibleRegion if
the document has been modified since then. The visible region is supposed
to be a consecutive region in viewer's input document and every character
inside that region is supposed to visible in the viewer's widget.
Viewers implementing ITextViewerExtension5 may be forced to
change the fractions of the input document that are shown, in order to
fulfill this contract.
getVisibleRegion in interface ITextViewergetVisibleRegion in class TextViewer
public boolean overlapsWithVisibleRegion(int offset,
int length)
ITextViewer
Viewers implementing ITextViewerExtension5may be forced to
change the fractions of the input document that are shown in order to
fulfill this request. This is because the overlap is supposed to be
without gaps.
overlapsWithVisibleRegion in interface ITextVieweroverlapsWithVisibleRegion in class TextViewerprotected final void processCatchupRequest(AnnotationModelEvent event)
event - the annotation model eventprotected final void postCatchupRequest(AnnotationModelEvent event)
event - the annotation model eventpublic IRegion computeCollapsedRegion(Position position)
position - the position
public Position computeCollapsedRegionAnchor(Position position)
position - the position
public final void reinitializeProjection()
throws BadLocationException
BadLocationException - in case something goes wrong during initializationprotected void handleVerifyEvent(VerifyEvent e)
TextViewer
handleVerifyEvent in class TextViewere - the verify eventVerifyListener.verifyText(VerifyEvent)public void addVerticalRulerColumn(IVerticalRulerColumn column)
column - the column to be addedpublic void removeVerticalRulerColumn(IVerticalRulerColumn column)
column - the column to be removedpublic boolean exposeModelRange(IRegion modelRange)
ITextViewerExtension5
exposeModelRange in interface ITextViewerExtension5modelRange - the model range to be exposed
true if the set of exposed model ranges changed,
false otherwise
public void setRangeIndication(int offset,
int length,
boolean moveCursor)
ISourceViewer
setRangeIndication in interface ISourceViewersetRangeIndication in class SourceViewerprotected void handleDispose()
TextViewer
handleDispose in class SourceViewerprotected void handleVisibleDocumentChanged(DocumentEvent event)
TextViewerSubclasses may override.
handleVisibleDocumentChanged in class TextViewerevent - the document eventprotected void handleVisibleDocumentAboutToBeChanged(DocumentEvent event)
TextViewerSubclasses may override.
handleVisibleDocumentAboutToBeChanged in class TextViewerevent - the document eventpublic IRegion[] getCoveredModelRanges(IRegion modelRange)
ITextViewerExtension5
getCoveredModelRanges in interface ITextViewerExtension5modelRange - the model range
public void doOperation(int operation)
ITextOperationTargetdoOperation must only be called if canDoOperation
returns true.
doOperation in interface ITextOperationTargetdoOperation in class SourceViewerpublic boolean canDoOperation(int operation)
ITextOperationTarget
canDoOperation in interface ITextOperationTargetcanDoOperation in class SourceViewerprotected void copyMarkedRegion(boolean delete)
TextViewer
copyMarkedRegion in class TextViewerdelete - true if the region should be deleted rather than copied.protected Point widgetSelection2ModelSelection(Point widgetSelection)
widgetSelection2ModelSelection in class TextViewerwidgetSelection - the widget selection
protected FindReplaceDocumentAdapter getFindReplaceDocumentAdapter()
TextViewer
getFindReplaceDocumentAdapter in class TextViewer
protected int findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
boolean regExSearch)
TextViewerIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).
findAndSelect in class TextViewerstartPosition - the start positionfindString - the find string specificationforwardSearch - the search directioncaseSensitive - true if case sensitive, false otherwisewholeWord - true if matches must be whole words, false otherwiseregExSearch - true if findString is a regular expression, false otherwise
protected int findAndSelectInRange(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord,
int rangeOffset,
int rangeLength,
boolean regExSearch)
TextViewerIFindReplaceTargetExtension3.findAndSelect(int, String, boolean, boolean, boolean, boolean).
findAndSelectInRange in class TextViewerstartPosition - the start positionfindString - the find string specificationforwardSearch - the search directioncaseSensitive - true if case sensitive, false otherwisewholeWord - true if matches must be whole words, false otherwiserangeOffset - the search scope offsetrangeLength - the search scope lengthregExSearch - true if findString is a regular expression, false otherwise
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.