|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.jface.viewers.Viewer | +--org.eclipse.jface.text.TextViewer
SWT based implementation of ITextViewer
. Once the viewer and its SWT control
have been created the viewer can only indirectly be disposed by disposing its SWT control.
Clients are supposed to instantiate a text viewer and subsequently to communicate with it
exclusively using the ITextViewer
interface or any of the implemented extension
interfaces.
A text viewer serves as text operation target. It only partially supports the external control of
the enable state of its text operations. A text viewer is also a widget token owner. Anything that
wants to display an overlay window on top of a text viewer should implement the
IWidgetTokenKeeper
interface and participate in the widget token negotiation between
the text viewer and all its potential widget token keepers.
Clients should no subclass this class as it is rather likely that subclasses will be broken by future releases.
ITextViewer
Nested Class Summary | |
protected class |
TextViewer.WidgetCommand
Represents a replace command that brings the text viewer's text widget back in sync with text viewer's document after the document has been changed. |
Field Summary | |
protected Map |
fAutoIndentStrategies
The text viewer's auto indent strategies |
protected Map |
fDefaultPrefixChars
The string a line is prefixed with on PREFIX and removed from each line on STRIP_PREFIX |
protected Map |
fDoubleClickStrategies
The text viewer's text double click strategies |
protected IEventConsumer |
fEventConsumer
The text viewer's event consumer |
protected IInformationControlCreator |
fHoverControlCreator
The creator of the text hover control |
protected boolean |
fIgnoreAutoIndent
Should the auto indent strategies ignore the next edit operation |
protected Map |
fIndentChars
The strings a line is prefixed with on SHIFT_RIGHT and removed from each line on SHIFT_LEFT |
protected int |
fLastTopPixel
The last visible vertical position of the top line |
protected boolean |
fReplaceTextPresentation
Indicates whether the viewer's text presentation should be replaced are modified. |
protected Map |
fTextHovers
The text viewer's text hovers |
protected List |
fTextInputListeners
All registered text input listeners |
protected List |
fTextListeners
All registered text listeners |
protected IUndoManager |
fUndoManager
The text viewer's undo manager |
protected List |
fViewportListeners
All registered viewport listeners> |
protected static int |
INTERNAL
|
protected static int |
KEY
|
protected static int |
MOUSE
|
protected static int |
MOUSE_END
|
protected static int |
RESIZE
|
protected static int |
SCROLLER
ID for originators of view port changes |
protected static String |
SHIFTING
Internal name of the position category used selection preservation during shift |
static boolean |
TRACE_ERRORS
Internal flag to indicate the debug state. |
Fields inherited from class org.eclipse.jface.viewers.Viewer |
WIDGET_DATA_KEY |
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 | |
protected |
TextViewer()
Internal use only |
|
TextViewer(Composite parent,
int styles)
Create a new text viewer with the given SWT style bits. |
Method Summary | |
void |
activatePlugins()
Activates the installed plug-ins. |
void |
addTextInputListener(ITextInputListener listener)
Adds a text input listener to this viewer. |
void |
addTextListener(ITextListener listener)
Adds a text listener to this viewer. |
void |
addViewportListener(IViewportListener listener)
Adds the given viewport listener to this viewer. |
void |
appendVerifyKeyListener(VerifyKeyListener listener)
Appends a verify key listener to the viewer's list of verify key listeners. |
protected boolean |
areMultipleLinesSelected()
Returns true if one line is completely selected or if multiple lines are selected. |
boolean |
canDoOperation(int operation)
Returns whether the operation specified by the given operation code can be performed. |
protected boolean |
canPerformFind()
|
void |
changeTextPresentation(TextPresentation presentation,
boolean controlRedraw)
Applies the color information encoded in the given text presentation. |
protected void |
createControl(Composite parent,
int styles)
Creates the viewer's SWT control. |
protected IDocumentAdapter |
createDocumentAdapter()
Factory method to create the document adapter to be used by this viewer. |
protected StyledText |
createTextWidget(Composite parent,
int styles)
Factory method to create the text widget to be used as the viewer's text widget. |
protected void |
customizeDocumentCommand(DocumentCommand command)
Hook called on receipt of a VerifyEvent . |
protected void |
deleteText()
Deprecated. use StyledText.invokeAction instead |
protected void |
disableRedrawing()
Disables the redrawing of this text viewer. |
void |
doOperation(int operation)
Performs the operation specified by the operation code on the target. |
protected void |
enabledRedrawing()
Enables the redrawing of this text viewer. |
void |
enableOperation(int operation,
boolean enable)
Enables/disabled the given text operation. |
protected int |
findAndSelect(int startPosition,
String findString,
boolean forwardSearch,
boolean caseSensitive,
boolean wholeWord)
|
protected void |
fireInputDocumentAboutToBeChanged(IDocument oldInput,
IDocument newInput)
Informs all registered text input listeners about the forthcoming input change, This method does not use a robust iterator. |
protected void |
fireInputDocumentChanged(IDocument oldInput,
IDocument newInput)
Informs all registered text input listeners about the sucessful input change, This method does not use a robust iterator. |
protected int |
getAverageCharWidth()
Returns the average character width of this viewer's widget. |
int |
getBottomIndex()
Returns the visible line with the highest line number. |
int |
getBottomIndexEndOffset()
Returns the document offset of the lower right corner of this viewer's viewport. |
Control |
getControl()
Returns the control of this viewer. |
IDocument |
getDocument()
Returns the text viewer's input document. |
IFindReplaceTarget |
getFindReplaceTarget()
Returns the find/replace operation target of this viewer. |
Object |
getInput()
Returns the input. |
int |
getMark()
Returns the mark position, -1 if mark is not set. |
IRewriteTarget |
getRewriteTarget()
Returns the viewer's rewrite target. |
Point |
getSelectedRange()
Returns the range of the current selection in coordinates of this viewer's document. |
ISelection |
getSelection()
Returns the current selection for this provider. |
ISelectionProvider |
getSelectionProvider()
Returns a selection provider dedicated to this viewer. |
protected ITextHover |
getTextHover(int offset)
Returns the text hover for a given offset. |
protected AbstractInformationControlManager |
getTextHoveringController()
Returns the text hovering controller of this viewer. |
ITextOperationTarget |
getTextOperationTarget()
Returns the text operation target of this viewer. |
StyledText |
getTextWidget()
Returns viewer's text widget. |
int |
getTopIndex()
Returns the visible line with the smallest line number. |
int |
getTopIndexStartOffset()
Returns the document offset of the upper left corner of this viewer's viewport. |
int |
getTopInset()
Returns the vertical offset of the first visible line. |
protected IDocument |
getVisibleDocument()
Returns the viewer's visible document. |
protected int |
getVisibleLinesInViewport()
Returns the viewport height in lines. |
IRegion |
getVisibleRegion()
Returns the current visible region of this viewer's document. |
protected int |
getVisibleRegionOffset()
Returns the offset of the visible region. |
protected int |
getWidthInPixels(int offset,
int length)
Returns the width of the representation of a text range in the visible region of the viewer's document as drawn in this viewer's widget. |
protected int |
getWidthInPixels(String text)
Deprecated. use getWidthInPixels(int, int) instead |
protected void |
handleDispose()
Frees all resources allocated by this viewer. |
protected void |
handleVerifyEvent(VerifyEvent e)
|
protected void |
inputChanged(Object newInput,
Object oldInput)
Internal hook method called when the input to this viewer is initially set or subsequently changed. |
protected IRegion |
internalGetVisibleRegion()
Returns the visible region if it is not equal to the whole document. |
protected void |
internalRevealRange(int start,
int end)
Reveals the given range of the visible document. |
void |
invalidateTextPresentation()
Invalidates the current presentation by sending an initialization event to all text listener. |
protected boolean |
isBlockSelected()
A block is selected if the character preceding the start of the selection is a new line character. |
boolean |
isEditable()
Returns whether the shown text can be manipulated. |
protected boolean |
isPrintable()
Returns whether the shown text can be printed. |
protected void |
markChanged(int offset,
int length)
Sends out a mark selection changed event to all registered listeners. |
boolean |
overlapsWithVisibleRegion(int start,
int length)
Returns whether a given range overlaps with the visible region of this viewer's document. |
void |
prependVerifyKeyListener(VerifyKeyListener listener)
Inserts the verify key listener at the beginning of the viewer's list of verify key listeners. |
protected void |
print()
Brings up a print dialog and calls printContents(Printer) which
performs the actual print. |
protected boolean |
redraws()
Returns whether this viewer redraws itself. |
void |
refresh()
Refreshes this viewer completely with information freshly obtained from this viewer's model. |
void |
releaseWidgetToken(IWidgetTokenKeeper tokenKeeper)
The given token keeper releases the token to this token owner. |
void |
removeTextInputListener(ITextInputListener listener)
Removes the given listener from this viewer's set of text input listeners. |
void |
removeTextListener(ITextListener listener)
Removes the given listener from this viewer's set of text listeners. |
void |
removeVerifyKeyListener(VerifyKeyListener listener)
Removes the verify key listener from the viewer's list of verify key listeners. |
void |
removeViewportListener(IViewportListener listener)
Removes the given listener from this viewer's set of viewport listeners. |
boolean |
requestWidgetToken(IWidgetTokenKeeper requester)
Requests the widget token from this token owner. |
void |
resetPlugins()
Resets the installed plug-ins. |
void |
resetVisibleRegion()
Resets the region of this viewer's document which is visible in the presentation. |
void |
revealRange(int start,
int length)
Ensures that the given range is visible. |
protected Object |
selectContentTypePlugin(int offset,
Map plugins)
Selects from the given map the one which is registered under the content type of the partition in which the given offset is located. |
protected void |
selectionChanged(int offset,
int length)
Sends out a text selection changed event to all registered listeners. |
void |
setAutoIndentStrategy(IAutoIndentStrategy strategy,
String contentType)
Sets this viewer's auto indent strategy for the given content type. |
void |
setDefaultPrefixes(String[] defaultPrefixes,
String contentType)
Sets the string that is used as prefix when lines of the given content type are prefixed by the prefix text operation. |
void |
setDocument(IDocument document)
Sets the given document as the text viewer's model and updates the presentation accordingly. |
void |
setDocument(IDocument document,
int visibleRegionOffset,
int visibleRegionLength)
Sets the given document as this viewer's model and makes the specified region visible in the presentation. |
void |
setEditable(boolean editable)
Sets the editable mode. |
void |
setEventConsumer(IEventConsumer consumer)
Registers an event consumer with this viewer. |
void |
setHoverControlCreator(IInformationControlCreator creator)
Sets the creator for the hover controls. |
void |
setIndentPrefixes(String[] indentPrefixes,
String contentType)
Sets the strings that are used as prefixes when lines of the given content type are shifted using the shift text operation. |
void |
setInput(Object input)
Sets or clears the input for this viewer. |
void |
setMark(int offset)
Sets or clears the mark. |
void |
setRedraw(boolean redraw)
Enables/disables the redrawing of this text viewer. |
void |
setSelectedRange(int offset,
int length)
Sets the selection to the specified range. |
void |
setSelection(ISelection selection,
boolean reveal)
Sets a new selection for this viewer and optionally makes it visible. |
void |
setTextColor(Color color)
Applies the given color to this viewer's selection. |
void |
setTextColor(Color color,
int start,
int length,
boolean controlRedraw)
Applies the given color to the specified section of this viewer. |
void |
setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy,
String contentType)
Sets this viewer's text double click strategy for the given content type. |
void |
setTextHover(ITextHover hover,
String contentType)
Sets this viewer's text hover for the given content type. |
void |
setTopIndex(int index)
Scrolls the widget so the the given index is the line with the smallest line number of all visible lines. |
void |
setUndoManager(IUndoManager undoManager)
Sets this viewer's undo manager. |
void |
setVisibleRegion(int start,
int length)
Sets the region of this viewer's document which will be visible in the presentation. |
protected void |
shift(boolean useDefaultPrefixes,
boolean right)
Deprecated. use shift(boolean, boolean, boolean) instead |
protected void |
shift(boolean useDefaultPrefixes,
boolean right,
boolean ignoreWhitespace)
Shifts a text block to the right or left using the specified set of prefix characters. |
protected void |
startSequentialRewriteMode(boolean normalized)
Starts the sequential rewrite mode of the viewer's document. |
protected void |
stopSequentialRewriteMode()
Sets the sequential rewrite mode of the viewer's document. |
protected void |
updateTextListeners(TextViewer.WidgetCommand cmd)
Informs all registered text listeners about the change specified by the widget command. |
protected void |
updateViewportListeners(int origin)
Checks whether the viewport changed and if so informs all registered listeners about the change. |
protected void |
validateSelectionRange(int[] selectionRange)
Validates and adapts the given selection range if it is not a valid widget selection. |
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 |
Field Detail |
public static boolean TRACE_ERRORS
protected static final int SCROLLER
protected static final int MOUSE
protected static final int MOUSE_END
protected static final int KEY
protected static final int RESIZE
protected static final int INTERNAL
protected static final String SHIFTING
protected boolean fIgnoreAutoIndent
protected Map fIndentChars
protected Map fDefaultPrefixChars
protected Map fDoubleClickStrategies
protected IUndoManager fUndoManager
protected Map fAutoIndentStrategies
protected Map fTextHovers
protected IInformationControlCreator fHoverControlCreator
protected List fViewportListeners
protected int fLastTopPixel
protected List fTextListeners
protected List fTextInputListeners
protected IEventConsumer fEventConsumer
protected boolean fReplaceTextPresentation
Constructor Detail |
protected TextViewer()
public TextViewer(Composite parent, int styles)
parent
- the parent of the viewer's controlstyles
- the SWT style bits for the viewer's controlMethod Detail |
protected StyledText createTextWidget(Composite parent, int styles)
protected IDocumentAdapter createDocumentAdapter()
protected void createControl(Composite parent, int styles)
parent
- the parent of the viewer's controlstyles
- the SWT style bits for the viewer's controlpublic Control getControl()
ITextViewerExtension
getControl
in interface ITextViewerExtension
getControl
in class Viewer
public void activatePlugins()
ITextViewer
activatePlugins
in interface ITextViewer
public void resetPlugins()
ITextViewer
IUndoManager
has been installed on this text viewer, the manager's list of remembered
text editing operations is removed.
resetPlugins
in interface ITextViewer
protected void handleDispose()
public StyledText getTextWidget()
getTextWidget
in interface ITextViewer
public void setAutoIndentStrategy(IAutoIndentStrategy strategy, String contentType)
ITextViewer
setAutoIndentStrategy
in interface ITextViewer
strategy
- the new auto indent strategy. null
is a valid argument.contentType
- the type for which the strategy is registeredpublic void setEventConsumer(IEventConsumer consumer)
ITextViewer
setEventConsumer
in interface ITextViewer
consumer
- the viewer's event consumer. null
is a valid argument.public void setIndentPrefixes(String[] indentPrefixes, String contentType)
ITextViewer
setIndentPrefixes
in interface ITextViewer
indentPrefixes
- the prefixes to be usedcontentType
- the content type for which the prefixes are specifiedpublic int getTopInset()
ITextViewer
getTopInset
in interface ITextViewer
public boolean isEditable()
ITextViewer
isEditable
in interface ITextViewer
public void setEditable(boolean editable)
ITextViewer
setEditable
in interface ITextViewer
editable
- the editable modepublic void setDefaultPrefixes(String[] defaultPrefixes, String contentType)
ITextViewer
setDefaultPrefixes
in interface ITextViewer
defaultPrefixes
- the prefixes to be usedcontentType
- the content type for which the prefixes are specifiedpublic void setUndoManager(IUndoManager undoManager)
ITextViewer
setUndoManager
in interface ITextViewer
undoManager
- the new undo manager. null
is a valid argument.public void setTextHover(ITextHover hover, String contentType)
ITextViewer
setTextHover
in interface ITextViewer
hover
- the new hover. null
is a valid argument.contentType
- the type for which the hover is registeredprotected ITextHover getTextHover(int offset)
offset
- the offset for which to return the text hover
protected AbstractInformationControlManager getTextHoveringController()
public void setHoverControlCreator(IInformationControlCreator creator)
creator
- the hover control creatorpublic boolean requestWidgetToken(IWidgetTokenKeeper requester)
IWidgetTokenOwner
true
if the token has been aquired or is
already owned by the requester. This method is non-blocking.
requestWidgetToken
in interface IWidgetTokenOwner
requester
- the token requester
true
if requester aquires the token,
false
otherwisepublic void releaseWidgetToken(IWidgetTokenKeeper tokenKeeper)
IWidgetTokenOwner
releaseWidgetToken
in interface IWidgetTokenOwner
tokenKeeper
- the token keeperpublic Point getSelectedRange()
ITextViewer
getSelectedRange
in interface ITextViewer
public void setSelectedRange(int offset, int length)
ITextViewer
setSelectedRange
in interface ITextViewer
offset
- the offset of the selection rangelength
- the length of the selection rangeprotected void validateSelectionRange(int[] selectionRange)
[-1, -1]
indicates
that the selection range could not be validated.
Subclasses may reimplement this method.
selectionRange
- selectionRange[0] is the offset, selectionRange[1]
the length of the selection to validate.public void setSelection(ISelection selection, boolean reveal)
Viewer
Subclasses must implement this method.
setSelection
in class Viewer
selection
- the new selectionreveal
- true
if the selection is to be made
visible, and false
otherwisepublic ISelection getSelection()
ISelectionProvider
getSelection
in interface ISelectionProvider
getSelection
in class Viewer
public ISelectionProvider getSelectionProvider()
ITextViewer
getSelectionProvider
in interface ITextViewer
protected void selectionChanged(int offset, int length)
offset
- the offset of the newly selected range in the visible documentlength
- the length of the newly selected range in the visible documentprotected void markChanged(int offset, int length)
offset
- the offset of the mark selection in the visible document, the offset is -1
if the mark was clearedlength
- the length of the mark selection, may be negative if the caret is before the mark.public void addTextListener(ITextListener listener)
ITextViewer
addTextListener
in interface ITextViewer
listener
- the listener to be addedpublic void removeTextListener(ITextListener listener)
ITextViewer
removeTextListener
in interface ITextViewer
listener
- the listener to be removedprotected void updateTextListeners(TextViewer.WidgetCommand cmd)
cmd
- the widget command translated into a text event sent to all text listenerspublic void addTextInputListener(ITextInputListener listener)
ITextViewer
addTextInputListener
in interface ITextViewer
listener
- the listener to be addedpublic void removeTextInputListener(ITextInputListener listener)
ITextViewer
removeTextInputListener
in interface ITextViewer
listener
- the listener to be removedprotected void fireInputDocumentAboutToBeChanged(IDocument oldInput, IDocument newInput)
oldInput
- the old input documentnewInput
- the new input documentprotected void fireInputDocumentChanged(IDocument oldInput, IDocument newInput)
oldInput
- the old input documentnewInput
- the new input documentpublic Object getInput()
IInputProvider
getInput
in interface IInputProvider
getInput
in class Viewer
public IDocument getDocument()
ITextViewer
getDocument
in interface ITextViewer
public void setInput(Object input)
Viewer
setInput
in class Viewer
input
- the input of this viewer, or null
if nonepublic void setDocument(IDocument document)
ITextViewer
TextEvent
is
issued. This text event does not carry a related document event.
setDocument
in interface ITextViewer
document
- the viewer's new input documentpublic void setDocument(IDocument document, int visibleRegionOffset, int visibleRegionLength)
ITextViewer
TextEvent
is issued. The text event does not carry a
related document event. This method is a convenience method for
setDocument(document);setVisibleRegion(offset, length)
.
setDocument
in interface ITextViewer
document
- the new input documentvisibleRegionOffset
- the offset of the visible regionvisibleRegionLength
- the length of the visible regionpublic void addViewportListener(IViewportListener listener)
ITextViewer
addViewportListener
in interface ITextViewer
listener
- the listener to be addedpublic void removeViewportListener(IViewportListener listener)
ITextViewer
removeViewportListener
in interface ITextViewer
listener
- the listener to be removedprotected void updateViewportListeners(int origin)
origin
- describes under which circumstances this method has been called.IViewportListener
public int getTopIndex()
ITextViewer
getTopIndex
in interface ITextViewer
public void setTopIndex(int index)
ITextViewer
setTopIndex
in interface ITextViewer
index
- the line which should become the top most lineprotected int getVisibleLinesInViewport()
public int getBottomIndex()
ITextViewer
getBottomIndex
in interface ITextViewer
public int getTopIndexStartOffset()
ITextViewer
getTopIndexStartOffset
in interface ITextViewer
public int getBottomIndexEndOffset()
ITextViewer
getBottomIndexEndOffset
in interface ITextViewer
public void revealRange(int start, int length)
ITextViewer
revealRange
in interface ITextViewer
start
- the offset of the range to be revealedlength
- the length of the range to be revealedprotected void internalRevealRange(int start, int end)
start
- the start offset of the rangeend
- the end offset of the rangeprotected final int getWidthInPixels(String text)
getWidthInPixels(int, int)
instead
protected final int getWidthInPixels(int offset, int length)
offset
- the offset of the text range in the visible regionlength
- the length of the text range in the visible region
protected final int getAverageCharWidth()
public void refresh()
Viewer
refresh
in class Viewer
public final void invalidateTextPresentation()
invalidateTextPresentation
in interface ITextViewer
protected IDocument getVisibleDocument()
protected int getVisibleRegionOffset()
public IRegion getVisibleRegion()
ITextViewer
setVisibleRegion
if the document has been modified since then.
getVisibleRegion
in interface ITextViewer
public void setVisibleRegion(int start, int length)
ITextViewer
setVisibleRegion
in interface ITextViewer
start
- the offset of the visible regionlength
- the length of the visible regionpublic void resetVisibleRegion()
ITextViewer
resetVisibleRegion
in interface ITextViewer
public boolean overlapsWithVisibleRegion(int start, int length)
ITextViewer
overlapsWithVisibleRegion
in interface ITextViewer
true
if the specified range overlaps with the visible regionpublic void setTextDoubleClickStrategy(ITextDoubleClickStrategy strategy, String contentType)
ITextViewer
setTextDoubleClickStrategy
in interface ITextViewer
strategy
- the new double click strategy. null
is a valid argument.contentType
- the type for which the strategy is registeredprotected Object selectContentTypePlugin(int offset, Map plugins)
plugins
- the map from which to chooseoffset
- the offset for which to find the plugin
protected void customizeDocumentCommand(DocumentCommand command)
VerifyEvent
. The event has
been translated into a DocumentCommand
which can now be
manipulated by interested parties. By default, the hook forwards the command
to the installed IAutoIndentStrategy
.
command
- the document command representing the verify eventprotected void handleVerifyEvent(VerifyEvent e)
VerifyListener.verifyText(org.eclipse.swt.events.VerifyEvent)
public boolean canDoOperation(int operation)
ITextOperationTarget
canDoOperation
in interface ITextOperationTarget
operation
- the operation code
true
if the specified operation can be performedpublic void doOperation(int operation)
ITextOperationTarget
doOperation
must only be called if canDoOperation
returns true
.
doOperation
in interface ITextOperationTarget
operation
- the operation codepublic void enableOperation(int operation, boolean enable)
ITextOperationTargetExtension
enableOperation
in interface ITextOperationTargetExtension
operation
- the operation to enable/disableenable
- true
to enable the operation otherwise false
protected void deleteText()
StyledText.invokeAction
instead
protected boolean isBlockSelected()
true
if a block is selectedprotected boolean areMultipleLinesSelected()
true
if one line is completely selected or if multiple lines are selected.
Being completely selected means that all characters except the new line characters are
selected.
true
if one or multiple lines are selectedprotected void shift(boolean useDefaultPrefixes, boolean right)
useDefaultPrefixes
- says whether the configured default or indent prefixes should be usedright
- says whether to shift to the right or the leftprotected void shift(boolean useDefaultPrefixes, boolean right, boolean ignoreWhitespace)
useDefaultPrefixes
- says whether the configured default or indent prefixes should be usedright
- says whether to shift to the right or the leftignoreWhitespace
- says whether whitepsace in front of prefixes is allowedprotected boolean isPrintable()
protected void print()
printContents(Printer)
which
performs the actual print.
Subclasses may override.
protected boolean canPerformFind()
IFindReplaceTarget.canPerformFind()
protected int findAndSelect(int startPosition, String findString, boolean forwardSearch, boolean caseSensitive, boolean wholeWord)
IFindReplaceTarget.findAndSelect(int, String, boolean, boolean, boolean)
public void setTextColor(Color color)
ITextViewer
setTextColor
in interface ITextViewer
color
- the color to be appliedpublic void setTextColor(Color color, int start, int length, boolean controlRedraw)
ITextViewer
controlRedraw
tells this viewer whether it should take care of
redraw management or not.
setTextColor
in interface ITextViewer
color
- the color to be appliedstart
- the offset of the range to be coloredlength
- the length of the range to be coloredcontrolRedraw
- indicates whether this viewer should manage redrawsprotected IRegion internalGetVisibleRegion()
null
.
null
public void changeTextPresentation(TextPresentation presentation, boolean controlRedraw)
ITextViewer
controlRedraw
tells this viewer whether it should take care of
redraw management or not. If, e.g., this call is one in a sequence of multiple
coloring calls, it is more appropriate to explicitly control redrawing at the
beginning and the end of the sequence.
changeTextPresentation
in interface ITextViewer
presentation
- the presentation to be applied to this viewercontrolRedraw
- indicates whether this viewer should manage redrawspublic IFindReplaceTarget getFindReplaceTarget()
ITextViewer
getFindReplaceTarget
in interface ITextViewer
public ITextOperationTarget getTextOperationTarget()
ITextViewer
getTextOperationTarget
in interface ITextViewer
public void appendVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtension
appendVerifyKeyListener
in interface ITextViewerExtension
listener
- the listener to be addedpublic void prependVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtension
prependVerifyKeyListener
in interface ITextViewerExtension
listener
- the listener to be insertedpublic void removeVerifyKeyListener(VerifyKeyListener listener)
ITextViewerExtension
removeVerifyKeyListener
in interface ITextViewerExtension
listener
- the listener to be removedpublic int getMark()
ITextViewerExtension
-1
if mark is not set.
getMark
in interface ITextViewerExtension
-1
if no mark is setpublic void setMark(int offset)
ITextViewerExtension
-1
, the mark is cleared.
If a mark is set and the selection is empty, cut and copy actions performed on this
text viewer peform on the region limited by the positions of the mark and the cursor.
setMark
in interface ITextViewerExtension
offset
- the offset of the markprotected void inputChanged(Object newInput, Object oldInput)
Viewer
The default implementation does nothing. Subclassers may override this method to do something when a viewer's input is set. A typical use is populate the viewer.
inputChanged
in class Viewer
newInput
- the new input of this viewer, or null
if noneoldInput
- the old input element or null
if there
was previously no inputprotected void enabledRedrawing()
protected void disableRedrawing()
public final void setRedraw(boolean redraw)
ITextViewerExtension
setSelectedRange
.
Any direct manipulation of the widget as well as calls to methods that change the viewer's
presentation state (such as enabling the segmented view) are not allowed.
When redrawing is disabled the viewer does not send out any selection or
view port change notification. When redrawing is enabled again, a selection
change notification is sent out for the selected range and this range is revealed.
setRedraw
in interface ITextViewerExtension
protected final boolean redraws()
true
if this viewer redraws itselfprotected final void startSequentialRewriteMode(boolean normalized)
protected final void stopSequentialRewriteMode()
public IRewriteTarget getRewriteTarget()
ITextViewerExtension
getRewriteTarget
in interface ITextViewerExtension
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |