Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD


 

com.ibm.lpex.alef
Class LpexTextViewer

java.lang.Object
  extended byorg.eclipse.jface.viewers.Viewer
      extended bycom.ibm.lpex.alef.LpexTextViewer

All Implemented Interfaces:
org.eclipse.jface.viewers.IInputProvider, org.eclipse.jface.viewers.IInputSelectionProvider, org.eclipse.jface.viewers.ISelectionProvider, org.eclipse.jface.text.ITextOperationTarget, org.eclipse.jface.text.ITextOperationTargetExtension, org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.IWidgetTokenOwner, org.eclipse.jface.text.IWidgetTokenOwnerExtension

Direct Known Subclasses:
LpexSourceViewer


public class LpexTextViewer
extends org.eclipse.jface.viewers.Viewer
implements org.eclipse.jface.text.ITextViewer, org.eclipse.jface.text.ITextOperationTarget, org.eclipse.jface.text.ITextOperationTargetExtension, org.eclipse.jface.text.IWidgetTokenOwner, org.eclipse.jface.text.IWidgetTokenOwnerExtension

A line-oriented, LPEX-based partial implementation of org.eclipse.jface.text.ITextViewer.

This viewer supports a split window of several views on the document. Its main control is an LpexMultiWindow. The first LpexWindow opened is the primary window, and its associated LpexView is the primary view. Additional windows opened in this viewer are secondary windows, and their associated LpexViews are secondary views. The active window is the one which has the input focus. Views on the same document external to this viewer are not managed in here.

Like TextViewer, once this viewer and its text widget have been created, the viewer can only indirectly be disposed by disposing its primary SWT control (the LpexWindow). 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 not subclass this class as it is likely that subclasses will be broken by future releases.

Several TextViewer classes, methods, and fields are not available in LpexTextViewer. 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 the Eclipse editor
 else
  {
   // . . . get DocumentProvider, get IDocument, do replace()
  } 

TextViewer classes, methods, and fields which are not available, not implemented, or whose function differs significantly in LpexTextViewer are listed below, along with explanations and any LPEX alternatives. While the list is rather long, it should be noted that several (such as those geared towards specific Eclipse solutions, like the shift-string operations, or those specific to the underlying StyledText) are indicated for completness, even if their visibility is package or private.

Other notable differences:

See Also:
ITextViewer, getLpexView(), getFirstLpexView(), getLpexWindow(), getFirstLpexWindow()


Nested Class Summary
protected  class LpexTextViewer.TextHoverKey
          Value object used as a key in the text hover configuration table.
 
Field Summary
protected  org.eclipse.jface.text.IInformationControlCreator fHoverControlCreator
          The creator of the text hover control
protected  org.eclipse.jface.text.IDocumentInformationMapping fInformationMapping
          The mapping between model and visible document.
protected  int fLastTopPixel
          The last visible vertical position of the top line.
protected  String fPartitioning
          The viewers partitioning, i.e., the partitioning name the viewer uses to access partitioning information of its input document.
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 fViewportListeners
          All registered viewport listeners.
protected static int INTERNAL
          Id for originator of a view port change.
protected static int KEY
          Id for originator of a view port change.
protected static int MOUSE
          Id for originator of a view port change.
protected static int MOUSE_END
          Id for originator of a view port change.
protected static int RESIZE
          Id for originator of a view port change.
protected static int SCROLLER
          Id for originator of a view port change.
static boolean TRACE_ERRORS
           
 
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 LpexTextViewer()
          Internal-use constructor.
  LpexTextViewer(org.eclipse.swt.widgets.Composite parent, int styles)
          Create an LpexTextViewer with the given SWT style bits.
 
Method Summary
protected  int _getVisibleRegionOffset()
          This method always returns 0.
protected  org.eclipse.jface.text.IRegion _internalGetVisibleRegion()
          This method returns null.
 void activatePlugins()
          Activate the installed TextViewer 'plugins' (text hover, etc.).
 void addTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
          Add a text input listener to the ITextViewer.
 void addTextListener(org.eclipse.jface.text.ITextListener listener)
          The implementation of this method does nothing.
 void addViewportListener(org.eclipse.jface.text.IViewportListener listener)
           
 boolean canDoOperation(int operation)
          Check whether the action specified by the operation id can be performed.
 void changeTextPresentation(org.eclipse.jface.text.TextPresentation presentation, boolean controlRedraw)
          This method does nothing.
protected  void createControl(org.eclipse.swt.widgets.Composite parent, int styles)
          Creates the viewer's SWT control.
protected  com.ibm.lpex.alef.DocumentAdapter createDocumentAdapter()
          Factory method to create the document adapter to be used by this viewer.
protected  org.eclipse.jface.text.IDocument createSlaveDocument(org.eclipse.jface.text.IDocument document)
          Creates a slave document for the given document if there is a slave document manager associated with this viewer.
protected  org.eclipse.jface.text.ISlaveDocumentManager createSlaveDocumentManager()
          Creates a new slave document manager.
 void doOperation(int operation)
          Performs the action specified by the operation id.
 void enableOperation(int operation, boolean enable)
           
protected  void fireInputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
          Informs all registered text input listeners about the forthcoming input change.
protected  void fireInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
          Informs all registered text input listeners about the successful input change.
protected  void freeSlaveDocument(org.eclipse.jface.text.IDocument slave)
          Frees the given document if it is a slave document.
protected  int getAverageCharWidth()
          Deprecated. Use getAverageCharWidth(LpexWindow).
protected  int getAverageCharWidth(LpexWindow lpexWindow)
          Return the average character width in the specified text window of this viewer's widget.
 int getBottomIndex()
          Return the ZERO-based index of the visible document-section line with the highest line number.
 int getBottomIndexEndOffset()
          Return the character position which is at the lower-right corner of the widget's viewport, i.e., the visible character with the highest character position.
protected  int getClosestWidgetLineForModelLine(int modelLine)
          Returns the line of the widget whose corresponding line in the viewer's document is closest to the given line in the viewer's document or -1.
 org.eclipse.swt.widgets.Control getControl()
          Return the primary SWT Control (an LpexMultiWindow) associated with this viewer.
 int getCurrentOffset()
          Return the cursor offset in the active view, in coordinates of this viewer's document.
 org.eclipse.jface.text.ITextHover getCurrentTextHover()
           
 org.eclipse.jface.text.IDocument getDocument()
          Return this text viewer's stream-oriented IDocument.
protected  String getDocumentPartitioning()
          Returns the document partitioning for this viewer.
 String getEOL()
          Return the line delimiter used by the document currently handled by this text viewer.
 org.eclipse.jface.text.IFindReplaceTarget getFindReplaceTarget()
          This method returns null.
 LpexView getFirstLpexView()
          Retrieve the primary view of the underlying LPEX text widget.
 LpexWindow getFirstLpexWindow()
          Retrieve the primary window of the underlying LPEX text widget.
 org.eclipse.swt.graphics.Point getHoverEventLocation()
           
 Object getInput()
          Return the input (IDocument) of this viewer.
 LpexView getLpexView()
          Retrieve the active view of the underlying LPEX text widget, or the primary view if none.
 LpexWindow getLpexWindow()
          Retrieve the window of the underlying LPEX text widget that has the focus, or else the primary window.
 org.eclipse.jface.text.IRegion getModelCoverage()
          Implements the contract of ITextViewerExtension5.getModelCoverage().
 org.eclipse.swt.graphics.Point getSelectedRange()
          Return the range of the current selection in the active view, in coordinates of this viewer's document.
 org.eclipse.jface.viewers.ISelection getSelection()
          Return the current selection in the active view of this viewer.
 org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
           
protected  org.eclipse.jface.text.ISlaveDocumentManager getSlaveDocumentManager()
          Returns the slave document manager
protected  org.eclipse.jface.text.ITextHover getTextHover(int offset)
          Return the text hover for a given offset in the IDocument, according to the document content type / document-parser language at that offset.
protected  org.eclipse.jface.text.ITextHover getTextHover(int offset, int stateMask)
          Returns the text hover for a given offset and a given state mask.
protected  org.eclipse.jface.text.AbstractInformationControlManager getTextHoveringController()
          Return the text hovering controller of this viewer.
 org.eclipse.jface.text.ITextOperationTarget getTextOperationTarget()
          Return the text-operations target of this viewer.
 org.eclipse.swt.custom.StyledText getTextWidget()
          This method returns null.
 int getTopIndex()
          Return the ZERO-based index of the visible document-section line with the smallest line number.
 int getTopIndexStartOffset()
          This method returns -1.
 int getTopInset()
          Return the vertical offset, in pixels, of the text-widget screen's primary window.
 org.eclipse.jface.text.IDocument getVisibleDocument()
          Returns the viewer's visible document.
protected  int getVisibleLinesInViewport()
          Return the number of rows displayable in the viewport.
 org.eclipse.jface.text.IRegion getVisibleRegion()
          This method returns the region of this viewer's input document.
protected  void handleDispose()
          Free all the resources allocated by this viewer.
protected  void handleVisibleDocumentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
          Hook method called when the visible document is about to be changed.
protected  void handleVisibleDocumentChanged(org.eclipse.jface.text.DocumentEvent event)
          Hook method called when the visible document has been changed.
protected  void initializeDocumentInformationMapping(org.eclipse.jface.text.IDocument visibleDocument)
          Initializes the document information mapping between the given slave document and its master document.
protected  void initializeLpexView(LpexView lpexView)
          Hook to initialize a newly instantiated primary or secondary LpexView.
 void invalidateTextPresentation()
          This method does nothing.
 void invalidateTextPresentation(int offset, int length)
          This method does nothing.
 boolean isEditable()
          Query whether the shown text can be manipulated.
 int modelLine2WidgetLine(int modelLine)
          Implements the contract of ITextViewerExtension5.modelLine2WidgetLine(int).
 int modelOffset2WidgetOffset(int modelOffset)
          Implements the contract of ITextViewerExtension5.modelOffset2WidgetOffset(int).
 org.eclipse.jface.text.IRegion modelRange2WidgetRange(org.eclipse.jface.text.IRegion modelRange)
          Implements the contract of ITextViewerExtension5.modelRange2WidgetRange(IRegion).
protected  org.eclipse.jface.text.IRegion modelRange2WidgetRange(org.eclipse.jface.text.Position modelPosition)
          Same as modelRange2WidgetRange(IRegion) but for a Position.
protected  org.eclipse.swt.graphics.Point modelSelection2WidgetSelection(org.eclipse.swt.graphics.Point modelSelection)
          Translates the given selection range of the viewer's document into the corresponding widget range or returns null of this fails.
 boolean moveFocusToWidgetToken()
           
 boolean overlapsWithVisibleRegion(int start, int length)
          This method always returns true.
 void prependAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy strategy, String contentType)
          This method does nothing.
 void refresh()
          Refresh this viewer completely with information freshly obtained from this viewer's model (its IDocument).
 void releaseWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper tokenKeeper)
           
 void removeAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy strategy, String contentType)
          This method does nothing.
 void removeTextHovers(String contentType)
          Removes all text hovers for the given content type independent from their state mask.
 void removeTextInputListener(org.eclipse.jface.text.ITextInputListener listener)
          Remove the text input listener from the ITextViewer.
 void removeTextListener(org.eclipse.jface.text.ITextListener listener)
          The implementation of this method does nothing.
 void removeViewportListener(org.eclipse.jface.text.IViewportListener listener)
           
 boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper requester)
           
 boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper requester, int priority)
           
 void resetPlugins()
          Reset the installed plugins.
 void resetVisibleRegion()
          This method does nothing.
 void revealRange(int start, int len)
          This method is not currently implemented.
protected  Object selectContentTypePlugin(int offset, Map plugins)
          Select from the given map the plugin which is registered under the content type at the given document offset.
protected  void selectionChanged(int offset, int len)
          Sends out a text selection-changed event to all registered listeners.
 void setAutoIndentStrategy(org.eclipse.jface.text.IAutoIndentStrategy strategy, String contentType)
          This method does nothing.
 void setDefaultPrefixes(String[] defaultPrefixes, String contentType)
          This method does nothing in LpexTextViewer.
 void setDocument(org.eclipse.jface.text.IDocument document)
          Set the given IDocument as the text viewer's model, and update the presentation accordingly.
 void setDocument(org.eclipse.jface.text.IDocument document, int modelRangeOffset, int modelRangeLength)
          Sets the given document as this viewer's model and exposes the specified region.
 void setDocumentPartitioning(String partitioning)
          Sets the document partitioning of this viewer.
 void setEditable(boolean editable)
          Set the editable mode.
protected  void setEditorInput(org.eclipse.ui.IEditorInput editorInput)
          Indicate which is the editor-input resource for this text viewer.
 void setEventConsumer(org.eclipse.jface.text.IEventConsumer consumer)
          This method does nothing.
 void setHoverControlCreator(org.eclipse.jface.text.IInformationControlCreator creator)
          Set the creator for the hover controls.
 void setIndentPrefixes(String[] indentPrefixes, String contentType)
          This method does nothing.
 void setInput(Object input)
          Set or clear the input (IDocument) for this viewer.
 void setSelectedRange(int selectionOffset, int selectionLength)
          Set the selection to the specified range in the active view.
 void setSelection(org.eclipse.jface.viewers.ISelection selection, boolean reveal)
          Set a new selection for this viewer.
 void setTextColor(org.eclipse.swt.graphics.Color color)
          This method does nothing.
 void setTextColor(org.eclipse.swt.graphics.Color color, int start, int length, boolean controlRedraw)
          This method does nothing.
 void setTextDoubleClickStrategy(org.eclipse.jface.text.ITextDoubleClickStrategy strategy, String contentType)
          This method does nothing in LpexTextViewer.
 void setTextHover(org.eclipse.jface.text.ITextHover hover, String contentType)
          Sets this viewer's text hover for the given content type.
 void setTextHover(org.eclipse.jface.text.ITextHover hover, String contentType, int stateMask)
          Sets this viewer's text hover for the given content type and the given state mask.
 void setTopIndex(int index)
          Scrolls the edit window so that ZERO-based index is the smallest document-section line number of all visible lines.
 void setUndoManager(org.eclipse.jface.text.IUndoManager undoManager)
          This method does nothing in LpexTextViewer.
protected  void setVisibleDocument(org.eclipse.jface.text.IDocument document)
          Sets this viewer's visible document.
 void setVisibleRegion(int start, int len)
          This method does nothing.
 LpexView splitView(LpexView lpexView)
          Create a new view of the document in this text viewer's window.
protected  void updateProfile()
          Deprecated. Will be removed! You must extend updateProfile(LpexView) instead.
protected  void updateProfile(LpexView lpexView)
          Hook for post-updateProfile command processing.
protected  boolean updateSlaveDocument(org.eclipse.jface.text.IDocument slaveDocument, int modelRangeOffset, int modelRangeLength)
          Updates the given slave document to show the specified range of its master document.
protected  void updateViewportListeners(int origin)
          This method does nothing.
protected  boolean updateVisibleDocument(org.eclipse.jface.text.IDocument visibleDocument, int visibleRegionOffset, int visibleRegionLength)
          Deprecated. use updateSlaveDocument instead
protected  void validateSelectionRange(int[] selectionRange)
          Validates and adapts the given selection range if it is not a valid widget selection.
 int widgetLine2ModelLine(int widgetLine)
          Implements the contract of ITextViewerExtension5.widgetLine2ModelLine(int).
 int widgetLineOfWidgetOffset(int widgetOffset)
          Implements the contract of ITextViewerExtension5.widgetLineOfWidgetOffset(int).
 int widgetlLine2ModelLine(int widgetLine)
          Implements the contract of ITextViewerExtension5.widgetLine2ModelLine(int).
 int widgetOffset2ModelOffset(int widgetOffset)
          Implements the contract of ITextViewerExtension5.widgetOffset2ModelOffset(int).
 org.eclipse.jface.text.IRegion widgetRange2ModelRange(org.eclipse.jface.text.IRegion widgetRange)
          Implements the contract of ITextViewerExtension5.widgetRange2ModelRange(IRegion).
protected  org.eclipse.swt.graphics.Point widgetSelection2ModelSelection(org.eclipse.swt.graphics.Point widgetSelection)
          Translates the given widget selection into the corresponding region of the viewer's document or returns null if this fails.
 
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
 

 

Field Detail

 

 

TRACE_ERRORS

public static boolean TRACE_ERRORS


 

 

SCROLLER

protected static final int SCROLLER

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

MOUSE

protected static final int MOUSE

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

MOUSE_END

protected static final int MOUSE_END

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

KEY

protected static final int KEY

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

RESIZE

protected static final int RESIZE

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

INTERNAL

protected static final int INTERNAL

Id for originator of a view port change.

See Also:
Constant Field Values


 

 

fTextHovers

protected Map fTextHovers

The text viewer's text hovers.


 

 

fHoverControlCreator

protected org.eclipse.jface.text.IInformationControlCreator fHoverControlCreator

The creator of the text hover control


 

 

fViewportListeners

protected List fViewportListeners

All registered viewport listeners.


 

 

fLastTopPixel

protected int fLastTopPixel

The last visible vertical position of the top line.


 

 

fTextInputListeners

protected List fTextInputListeners

All registered text input listeners.


 

 

fReplaceTextPresentation

protected boolean fReplaceTextPresentation

Indicates whether the viewer's text presentation should be replaced are modified.


 

 

fInformationMapping

protected org.eclipse.jface.text.IDocumentInformationMapping fInformationMapping

The mapping between model and visible document.


 

 

fPartitioning

protected String fPartitioning

The viewers partitioning, i.e., the partitioning name the viewer uses to access partitioning information of its input document.

Constructor Detail

 

 

LpexTextViewer

protected LpexTextViewer()

Internal-use constructor. This constructor is the one called by the extending class LpexSourceViewer; afterwards, methods createControl(), setEditorInput(), and setDocument() will be called.


 

 

LpexTextViewer

public LpexTextViewer(org.eclipse.swt.widgets.Composite parent,
                      int styles)

Create an LpexTextViewer with the given SWT style bits. The viewer's text widget (consisting of an LpexMultiWindow, and the primary LpexView and LpexWindow) is created.

Parameters:
parent - the parent of the viewer's control
styles - the SWT style bits for the viewer's control
See Also:
createControl(org.eclipse.swt.widgets.Composite, int)
Method Detail

 

 

createDocumentAdapter

protected com.ibm.lpex.alef.DocumentAdapter createDocumentAdapter()

Factory method to create the document adapter to be used by this viewer.

LpexTextViewer uses a com.ibm.lpex.alef.DocumentAdapter, which is used to translate IDocument changes into LPEX document text changes, and vice versa. TextViewer's DefaultDocumentAdapter adapts an IDocument to the StyledTextContent interface.

Returns:
the document adapter to be used


 

 

createControl

protected void createControl(org.eclipse.swt.widgets.Composite parent,
                             int styles)

Creates the viewer's SWT control. The viewer's text widget is either the control, or is a child of the control. The contents of the text widget will be set later, on setDocument().

Here are the steps carried out by this method:

  • the new control of this viewer, an LpexMultiWindow, is constructed
  • a new LpexView (the primary view) is created
  • a new LpexWindow (the primary window) is created and associated with the LpexView
  • listeners are added to the new text widget
  • initializeLpexView() is called to allow the user to set their own parameters for this primary view.

The user must add their own LPEX actions and commands by extending updateProfile(LpexView), which is called when we are notified of the completion of the updateProfile command.

Parameters:
parent - the parent of the viewer's control
styles - the SWT style bits for the viewer's control
See Also:
initializeLpexView(com.ibm.lpex.core.LpexView), updateProfile(LpexView)


 

 

splitView

public LpexView splitView(LpexView lpexView)

Create a new view of the document in this text viewer's window.

Parameters:
lpexView - source document view
Returns:
the new view on the document, or
null if the current window could not be split for a new document view


 

 

getControl

public org.eclipse.swt.widgets.Control getControl()

Return the primary SWT Control (an LpexMultiWindow) associated with this viewer.

See Also:
Viewer.getControl()


 

 

activatePlugins

public void activatePlugins()

Activate the installed TextViewer 'plugins' (text hover, etc.). If the plugins are already activated, this call is without effect.

Defined by ITextViewer, as part of its plugins support.

Specified by:
activatePlugins in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.activatePlugins()


 

 

resetPlugins

public void resetPlugins()

Reset the installed plugins. If plugins change their state or behavior over the course of time, this method causes them to be set back to their initial state and behavior.

Specified by:
resetPlugins in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.resetPlugins()


 

 

handleDispose

protected void handleDispose()

Free all the resources allocated by this viewer. Internally called when the viewer's primary control (LpexMultiWindow) has been disposed.


 

 

getTextWidget

public org.eclipse.swt.custom.StyledText getTextWidget()

This method returns null. In TextViewer, this method returns the StyledText control, its underlying text widget.

Note: Do not use this method in LpexTextViewer. LpexTextViewer uses an LPEX text widget, which consists of an LpexMultiWindow (an SWT SashForm) and its LpexWindow(s) and LpexView(s), rather than a StyledText widget.

Specified by:
getTextWidget in interface org.eclipse.jface.text.ITextViewer

Returns:
null
See Also:
ITextViewer.getTextWidget(), getLpexWindow(), getFirstLpexWindow(), getLpexView(), getFirstLpexView()


 

 

setAutoIndentStrategy

public void setAutoIndentStrategy(org.eclipse.jface.text.IAutoIndentStrategy strategy,
                                  String contentType)

This method does nothing.

Specified by:
setAutoIndentStrategy in interface org.eclipse.jface.text.ITextViewer


 

 

prependAutoEditStrategy

public void prependAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy strategy,
                                    String contentType)

This method does nothing.


 

 

removeAutoEditStrategy

public void removeAutoEditStrategy(org.eclipse.jface.text.IAutoEditStrategy strategy,
                                   String contentType)

This method does nothing.


 

 

setEventConsumer

public void setEventConsumer(org.eclipse.jface.text.IEventConsumer consumer)

This method does nothing.

In TextViewer, implementers can register and receive VerifyEvents before the text viewer touches them. If the IEventConsumer marks an event as processed, the text viewer will ignore it. For example, keys consumed by a content-assist popup should not be again processed by us (this is not quite AWT's e.consume(), but that's the way Eclipse operates).

Specified by:
setEventConsumer in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setEventConsumer(org.eclipse.jface.text.IEventConsumer)


 

 

setIndentPrefixes

public void setIndentPrefixes(String[] indentPrefixes,
                              String contentType)

This method does nothing. LPEX does not currently support the Eclipse shift operations.

In TextViewer, this method sets the strings that are used as prefixes when lines of the given content type are shifted using the shift operations. Defined by ITextViewer, as part of its plugins support.

Specified by:
setIndentPrefixes in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setIndentPrefixes(java.lang.String[], java.lang.String)


 

 

getTopInset

public int getTopInset()

Return the vertical offset, in pixels, of the text-widget screen's primary window.

Specified by:
getTopInset in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getTopInset()


 

 

isEditable

public boolean isEditable()

Query whether the shown text can be manipulated. Preferred method: use the LPEX readonly parameter.

Specified by:
isEditable in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.isEditable()


 

 

setEditable

public void setEditable(boolean editable)

Set the editable mode. Preferred method: you should call the LPEX set readonly command in the updateProfile(LpexView lpexView) hook.

Specified by:
setEditable in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setEditable(boolean), isEditable(), updateProfile(LpexView)


 

 

setDefaultPrefixes

public void setDefaultPrefixes(String[] defaultPrefixes,
                               String contentType)

This method does nothing in LpexTextViewer. LPEX does not currently support the prefix and strip-prefix operations.

Defined by ITextViewer, as part of its plugins support.

Specified by:
setDefaultPrefixes in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setDefaultPrefixes(java.lang.String[], java.lang.String)


 

 

setUndoManager

public void setUndoManager(org.eclipse.jface.text.IUndoManager undoManager)

This method does nothing in LpexTextViewer. LPEX uses its own built-in undo manager (with unlimited undo/redo capabilitites), therefore it does not support IUndoManager.

Defined by ITextViewer, as part of its plugins support.

Specified by:
setUndoManager in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setUndoManager(org.eclipse.jface.text.IUndoManager)


 

 

setTextHover

public void setTextHover(org.eclipse.jface.text.ITextHover hover,
                         String contentType)

Sets this viewer's text hover for the given content type. Defined by ITextViewer, as part of its plugins support.

Specified by:
setTextHover in interface org.eclipse.jface.text.ITextViewer

Parameters:
hover - the new hover; null is a valid argument
contentType - the type for which the hover is registered
See Also:
ITextViewer.setTextHover(org.eclipse.jface.text.ITextHover,String)


 

 

setTextHover

public void setTextHover(org.eclipse.jface.text.ITextHover hover,
                         String contentType,
                         int stateMask)

Sets this viewer's text hover for the given content type and the given state mask. If the given text hover is null, any hover installed for the given content type and state mask is removed.

Parameters:
hover - the new hover or null
contentType - the type for which the hover is to be registered or unregistered
stateMask - the SWT event state mask; DEFAULT_HOVER_STATE_MASK indicates that the hover is installed as the default hover
See Also:
ITextViewerExtension2.setTextHover(org.eclipse.jface.text.ITextHover,String,int)


 

 

removeTextHovers

public void removeTextHovers(String contentType)

Removes all text hovers for the given content type independent from their state mask. Note: To remove a hover for a given content type and state mask use setTextHover(ITextHover, String, int) with null as parameter for the text hover.

Parameters:
contentType - the type for which all text hovers are to be unregistered
See Also:
ITextViewerExtension2.removeTextHovers(String)


 

 

getTextHover

protected org.eclipse.jface.text.ITextHover getTextHover(int offset)

Return the text hover for a given offset in the IDocument, according to the document content type / document-parser language at that offset.

Parameters:
offset - the IDocument offset for which to return the text hover
Returns:
the text hover for the given offset
See Also:
selectContentTypePlugin(int,Map)


 

 

getTextHover

protected org.eclipse.jface.text.ITextHover getTextHover(int offset,
                                                         int stateMask)

Returns the text hover for a given offset and a given state mask.

Parameters:
offset - the offset for which to return the text hover
stateMask - the SWT event state mask
Returns:
the text hover for the given offset and state mask


 

 

getTextHoveringController

protected org.eclipse.jface.text.AbstractInformationControlManager getTextHoveringController()

Return the text hovering controller of this viewer.


 

 

setHoverControlCreator

public void setHoverControlCreator(org.eclipse.jface.text.IInformationControlCreator creator)

Set the creator for the hover controls.

Parameters:
creator - the hover control creator


 

 

requestWidgetToken

public boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper requester)

Specified by:
requestWidgetToken in interface org.eclipse.jface.text.IWidgetTokenOwner


 

 

requestWidgetToken

public boolean requestWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper requester,
                                  int priority)

Specified by:
requestWidgetToken in interface org.eclipse.jface.text.IWidgetTokenOwnerExtension


 

 

releaseWidgetToken

public void releaseWidgetToken(org.eclipse.jface.text.IWidgetTokenKeeper tokenKeeper)

Specified by:
releaseWidgetToken in interface org.eclipse.jface.text.IWidgetTokenOwner


 

 

getSelectedRange

public org.eclipse.swt.graphics.Point getSelectedRange()

Return the range of the current selection in the active view, in coordinates of this viewer's document. Returns the start and length of the selection: x is the offset of the first selected character relative to the first character of the widget content, y is the length of the selection.

This method adjusts positions which are outside the current IDocument text (in LPEX the cursor, character/element/rectangle block positions, etc. can be located outside the actual line text).

Note that the cursor position in LPEX is not necessarily a boundary of the current selection, unless the selection is of type stream. Use getCurrentOffset() to retrieve the cursor position for this viewer.

Specified by:
getSelectedRange in interface org.eclipse.jface.text.ITextViewer

Returns:
selected range (offset,length) inside IDocument if there is a selection, or (offset,0) if there is no selection, or (-1,-1) if no text is visible
See Also:
ITextViewer.getSelectedRange(), getCurrentOffset()


 

 

setSelectedRange

public void setSelectedRange(int selectionOffset,
                             int selectionLength)

Set the selection to the specified range in the active view. Note that in LPEX the cursor is always visible (if there are visible elements).

Preferred method: use the block command or blockMark___ actions. To reposition the cursor, use the locate command and the position parameter.

Specified by:
setSelectedRange in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setSelectedRange(int, int)


 

 

getCurrentOffset

public int getCurrentOffset()

Return the cursor offset in the active view, in coordinates of this viewer's document.

In LPEX the cursor can be located outside the actual line text. This method adjusts a position which is outside the current IDocument text.

Returns:
current offset inside IDocument, or -1
See Also:
getSelectedRange()


 

 

validateSelectionRange

protected void validateSelectionRange(int[] selectionRange)

Validates and adapts the given selection range if it is not a valid widget selection. The widget selection is invalid if it starts or ends inside a multi-character line delimiter. If so, the selection is adapted to start after the divided line delimiter and to end before the divided line delimiter. The parameter passed in is changed in-place when being adapted. An adaptation to [-1, -1] indicates that the selection range could not be validated. Subclasses may reimplement this method.

Parameters:
selectionRange - selectionRange[0] is the offset, selectionRange[1] the length of the selection to validate.


 

 

setSelection

public void setSelection(org.eclipse.jface.viewers.ISelection selection,
                         boolean reveal)

Set a new selection for this viewer.

To set selections in LPEX, use the block command or blockMark___ actions. To reposition the cursor, use the locate command and the position parameter.

See Also:
Viewer.setSelection(ISelection)


 

 

getSelection

public org.eclipse.jface.viewers.ISelection getSelection()

Return the current selection in the active view of this viewer.

In LPEX, this stream-oriented method is inefficient, and should be avoided.

Specified by:
getSelection in interface org.eclipse.jface.viewers.ISelectionProvider

See Also:
Viewer.getSelection()


 

 

getSelectionProvider

public org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()

Specified by:
getSelectionProvider in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getSelectionProvider()


 

 

selectionChanged

protected void selectionChanged(int offset,
                                int len)

Sends out a text selection-changed event to all registered listeners.

Parameters:
offset - the offset of the newly selected range in the visible document
len - the length of the newly selected range in the visible document


 

 

addTextListener

public void addTextListener(org.eclipse.jface.text.ITextListener listener)

The implementation of this method does nothing.

In TextViewer, this method adds a text listener to the text widget. A listener is registered only once, subsequent calls are without effect.

Specified by:
addTextListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.addTextListener(org.eclipse.jface.text.ITextListener)


 

 

removeTextListener

public void removeTextListener(org.eclipse.jface.text.ITextListener listener)

The implementation of this method does nothing.

In TextViewer, this method removes the text listener from the text widget. If the listener is not registered with the widget, the call is without effect.

Specified by:
removeTextListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.removeTextListener(org.eclipse.jface.text.ITextListener)


 

 

addTextInputListener

public void addTextInputListener(org.eclipse.jface.text.ITextInputListener listener)

Add a text input listener to the ITextViewer. A listener is registered only once, subsequent calls are without effect.

Text input listeners registered with a text viewer are informed when the document serving as the text viewer's model is replaced.

Specified by:
addTextInputListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.addTextInputListener(org.eclipse.jface.text.ITextInputListener)


 

 

removeTextInputListener

public void removeTextInputListener(org.eclipse.jface.text.ITextInputListener listener)

Remove the text input listener from the ITextViewer. If the listener is not registered with the viewer, the call is without effect.

Specified by:
removeTextInputListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.removeTextInputListener(org.eclipse.jface.text.ITextInputListener)


 

 

fireInputDocumentAboutToBeChanged

protected void fireInputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput,
                                                 org.eclipse.jface.text.IDocument newInput)

Informs all registered text input listeners about the forthcoming input change.

Parameters:
oldInput - the old input document
newInput - the new input document


 

 

fireInputDocumentChanged

protected void fireInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
                                        org.eclipse.jface.text.IDocument newInput)

Informs all registered text input listeners about the successful input change.

Parameters:
oldInput - the old input document
newInput - the new input document


 

 

getInput

public Object getInput()

Return the input (IDocument) of this viewer.

Specified by:
getInput in interface org.eclipse.jface.viewers.IInputProvider

See Also:
Viewer.getInput()


 

 

getDocument

public org.eclipse.jface.text.IDocument getDocument()

Return this text viewer's stream-oriented IDocument.

Defined by ITextViewer, as part of its model-manipulation support.

Specified by:
getDocument in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getDocument()


 

 

setInput

public void setInput(Object input)

Set or clear the input (IDocument) for this viewer.

See Also:
Viewer.setInput(java.lang.Object)


 

 

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)

Set the given IDocument as the text viewer's model, and update the presentation accordingly. An approriate TextEvent is issued. The text event does not carry a related document event, though.

Defined by ITextViewer, as part of its model-manipulation support.

Specified by:
setDocument in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setDocument(IDocument)


 

 

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document,
                        int modelRangeOffset,
                        int modelRangeLength)

Sets the given document as this viewer's model and exposes the specified region. Convenience method for
   setDocument(document);
   setVisibleRegion(offset, length) 

Defined by ITextViewer as part of its visible-region support.

Specified by:
setDocument in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setDocument(IDocument,int,int), setDocument(IDocument)


 

 

createSlaveDocument

protected org.eclipse.jface.text.IDocument createSlaveDocument(org.eclipse.jface.text.IDocument document)

Creates a slave document for the given document if there is a slave document manager associated with this viewer.

Parameters:
document - the master document
Returns:
the newly created slave document


 

 

updateVisibleDocument

protected boolean updateVisibleDocument(org.eclipse.jface.text.IDocument visibleDocument,
                                        int visibleRegionOffset,
                                        int visibleRegionLength)
                                 throws org.eclipse.jface.text.BadLocationException

Deprecated. use updateSlaveDocument instead

Sets the given slave document to the specified range of its master document.

Parameters:
visibleDocument - the slave document
visibleRegionOffset - the offset of the master document range
visibleRegionLength - the length of the master document range
Returns:
true if the slave has been adapted successfully
Throws:
org.eclipse.jface.text.BadLocationException - in case the specified range is not valid in the master document


 

 

updateSlaveDocument

protected boolean updateSlaveDocument(org.eclipse.jface.text.IDocument slaveDocument,
                                      int modelRangeOffset,
                                      int modelRangeLength)
                               throws org.eclipse.jface.text.BadLocationException

Updates the given slave document to show the specified range of its master document.

Parameters:
slaveDocument - the slave document
modelRangeOffset - the offset of the master document range
modelRangeLength - the length of the master document range
Returns:
true if the slave has been adapted successfully
Throws:
org.eclipse.jface.text.BadLocationException - in case the specified range is not valid in the master document


 

 

addViewportListener

public void addViewportListener(org.eclipse.jface.text.IViewportListener listener)

Specified by:
addViewportListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.addViewportListener(org.eclipse.jface.text.IViewportListener)


 

 

removeViewportListener

public void removeViewportListener(org.eclipse.jface.text.IViewportListener listener)

Specified by:
removeViewportListener in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.removeViewportListener(org.eclipse.jface.text.IViewportListener)


 

 

updateViewportListeners

protected void updateViewportListeners(int origin)

This method does nothing.

In TextViewer, this method checks whether the viewport changed and, if so, informs all registered listeners about the change.

Parameters:
origin - describes under which circumstances this method has been called.
See Also:
IViewportListener


 

 

getTopIndex

public int getTopIndex()

Return the ZERO-based index of the visible document-section line with the smallest line number.

Specified by:
getTopIndex in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getTopIndex()


 

 

setTopIndex

public void setTopIndex(int index)

Scrolls the edit window so that ZERO-based index is the smallest document-section line number of all visible lines.

Preferred method: in LPEX you may consider various options, depending on the intended usage. For example, to set the cursor in the edit window on a certain line in the document:

   LpexView lpexView = getLpexView();
   lpexView.doCommand("locate emphasis line " +
                      (index + 1 + lpexView.linesBeforeStart()));
   lpexView.triggerAction(lpexView.actionId("textWindow"));
To position the line that contains the cursor on a certain screen row:
   LpexView lpexView = getLpexView();
   lpexView.doCommand("set cursorRow " + row);
   lpexView.doDefaultCommand("screenShow");

You must consider certain characteristics of the LPEX edit window, such as:

  • some or all elements (lines) in the document may be hidden
  • the current (cursor) element is always visible in the edit window
  • elements are laid out such that there is never any wasted space at the top of the edit area
  • there may be wasted space only at the bottom of the edit area, if there are not enough visible elements to fill it.

Specified by:
setTopIndex in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setTopIndex(int)


 

 

getVisibleLinesInViewport

protected int getVisibleLinesInViewport()

Return the number of rows displayable in the viewport. The actual document lines displayed in the edit window may be fewer, when the document is shorter or some lines are not visible.

Preferred method: use getLpexView().queryInt("rows").

Returns:
the viewport height in lines


 

 

getBottomIndex

public int getBottomIndex()

Return the ZERO-based index of the visible document-section line with the highest line number.

Specified by:
getBottomIndex in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getBottomIndex()


 

 

getTopIndexStartOffset

public int getTopIndexStartOffset()

This method returns -1.

In TextViewer, this method returns the character position which is at the upper-left corner of the widget's viewport.

Specified by:
getTopIndexStartOffset in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getTopIndexStartOffset()


 

 

getBottomIndexEndOffset

public int getBottomIndexEndOffset()

Return the character position which is at the lower-right corner of the widget's viewport, i.e., the visible character with the highest character position. If the content of the widget is shorter, the last character of the content is returned.

Specified by:
getBottomIndexEndOffset in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getBottomIndexEndOffset()


 

 

revealRange

public void revealRange(int start,
                        int len)

This method is not currently implemented. In TextViewer, this method ensures that the given character range is visible. Note that in LPEX, the cursor is always visible.

Specified by:
revealRange in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.revealRange(int,int)


 

 

getAverageCharWidth

protected final int getAverageCharWidth()

Deprecated. Use getAverageCharWidth(LpexWindow).

Return the average character width of this viewer's widget active window.


 

 

getAverageCharWidth

protected final int getAverageCharWidth(LpexWindow lpexWindow)

Return the average character width in the specified text window of this viewer's widget.


 

 

refresh

public void refresh()

Refresh this viewer completely with information freshly obtained from this viewer's model (its IDocument). The implementation of this method does a setDocument(getDocument());

See Also:
Viewer.refresh(), setDocument(IDocument)


 

 

getSlaveDocumentManager

protected org.eclipse.jface.text.ISlaveDocumentManager getSlaveDocumentManager()

Returns the slave document manager

Returns:
the slave document manager


 

 

createSlaveDocumentManager

protected org.eclipse.jface.text.ISlaveDocumentManager createSlaveDocumentManager()

Creates a new slave document manager. This implementation always returns a ChildDocumentManager.

Returns:
ISlaveDocumentManager


 

 

invalidateTextPresentation

public final void invalidateTextPresentation()

This method does nothing. In TextViewer, this method invalidates the current presentation by sending an initialization event to all the text listeners.

Specified by:
invalidateTextPresentation in interface org.eclipse.jface.text.ITextViewer


 

 

invalidateTextPresentation

public final void invalidateTextPresentation(int offset,
                                             int length)

This method does nothing. In TextViewer, this method invalidates the given range of the text presentation by sending an initialization event to all the text listeners.

Parameters:
offset - the offset of the range to be invalidated
length - the length of the range to be invalidated


 

 

freeSlaveDocument

protected void freeSlaveDocument(org.eclipse.jface.text.IDocument slave)

Frees the given document if it is a slave document.

Parameters:
slave - the potential slave document


 

 

setVisibleDocument

protected void setVisibleDocument(org.eclipse.jface.text.IDocument document)

Sets this viewer's visible document. The visible document represents the visible region of the viewer's input document. In LPEX, the visible document (or currently-loaded document section) is always the viewer's entire input document.

Parameters:
document - the visible document


 

 

handleVisibleDocumentAboutToBeChanged

protected void handleVisibleDocumentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)

Hook method called when the visible document is about to be changed. Subclasses may override.

Parameters:
event - the document event


 

 

handleVisibleDocumentChanged

protected void handleVisibleDocumentChanged(org.eclipse.jface.text.DocumentEvent event)

Hook method called when the visible document has been changed. Subclasses may override.

Parameters:
event - the document event


 

 

initializeDocumentInformationMapping

protected void initializeDocumentInformationMapping(org.eclipse.jface.text.IDocument visibleDocument)

Initializes the document information mapping between the given slave document and its master document.

Parameters:
visibleDocument - the slave document


 

 

getVisibleDocument

public org.eclipse.jface.text.IDocument getVisibleDocument()

Returns the viewer's visible document. The visible document represents the visible region of the viewer's input document. In LPEX, the visible document (or currently-loaded document section) is always the viewer's entire input document.

Returns:
the viewer's visible document


 

 

_getVisibleRegionOffset

protected int _getVisibleRegionOffset()

This method always returns 0. In LpexTextViewer, the visible document (or document section) 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 attributes. See the mark, markIncluded, and markExcluded parameters.

In TextViewer, this method returns the offset of the visible region.


 

 

getVisibleRegion

public org.eclipse.jface.text.IRegion getVisibleRegion()

This method returns the region of this viewer's input document. In LpexTextViewer, the visible document (or document section) 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 attributes. See the mark, markIncluded, and markExcluded parameters.

In TextViewer, this method returns the current visible region of this viewer's document. Defined by ITextViewer as part of its visible-region support.

Specified by:
getVisibleRegion in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getVisibleRegion()


 

 

setVisibleRegion

public void setVisibleRegion(int start,
                             int len)

This method does nothing. In LpexTextViewer, the visible document (or document section) 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 attributes. See the mark, markIncluded, and markExcluded parameters.

In TextViewer, this method sets the region of this viewer's document which will be visible in the presentation. It does this by defining a child document for this region, and setting it as the visible document for the text widget (i.e., reloading the text widgets with the contents of this child document). It is defined by ITextViewer as part of its visible-region support.

Specified by:
setVisibleRegion in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setVisibleRegion(int, int)


 

 

resetVisibleRegion

public void resetVisibleRegion()

This method does nothing. In LpexTextViewer, the visible document (or document section) 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 attributes. See the mark, markIncluded, and markExcluded parameters.

In TextViewer, this method resets the region of this viewer's document which is visible in the presentation, so that the whole document is presented again. It is defined by ITextViewer, as part of its visible-region support.

Specified by:
resetVisibleRegion in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.resetVisibleRegion()


 

 

overlapsWithVisibleRegion

public boolean overlapsWithVisibleRegion(int start,
                                         int length)

This method always returns true. In LpexTextViewer, 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 TextViewer, this method returns whether a given range overlaps with the visible region of this viewer's document. It is defined by ITextViewer, as part of its visible-region support.

Specified by:
overlapsWithVisibleRegion in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.overlapsWithVisibleRegion(int, int)


 

 

setTextDoubleClickStrategy

public void setTextDoubleClickStrategy(org.eclipse.jface.text.ITextDoubleClickStrategy strategy,
                                       String contentType)

This method does nothing in LpexTextViewer. LPEX has its own double-click actions, therefore it doesn't support ITextDoubleClickStrategy. Token/word selection and bracket matching can be customized via new LpexActions.

Defined by ITextViewer, as part of its plugins support.

Specified by:
setTextDoubleClickStrategy in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setTextDoubleClickStrategy(org.eclipse.jface.text.ITextDoubleClickStrategy, java.lang.String)


 

 

selectContentTypePlugin

protected Object selectContentTypePlugin(int offset,
                                         Map plugins)

Select from the given map the plugin which is registered under the content type at the given document offset.

This method first checks for a plugin for the IDocument content type (e.g., IDocument.DEFAULT_CONTENT_TYPE) of the document partition in which the given offset is located. If none found, it checks for a plugin registered for the LPEX document-parser language, as defined in LpexCommonParser.getLanguage(LpexDocumentLocation) (e.g., LpexCommonParser.LANGUAGE_JAVA), as content type.

Parameters:
offset - the document offset for which to find the plug-in
plugins - the map from which to choose
Returns:
the plug-in registered under the offset's content type


 

 

canDoOperation

public boolean canDoOperation(int operation)

Check whether the action specified by the operation id can be performed.

Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly for querying availability.

Specified by:
canDoOperation in interface org.eclipse.jface.text.ITextOperationTarget

Parameters:
operation - LPEX-defined operation id (including the equivalents of ITextOperationTarget.UNDO, .REDO, etc.)
See Also:
ITextOperationTarget.canDoOperation(int)


 

 

doOperation

public void doOperation(int operation)

Performs the action specified by the operation id. This method may be called when canDoOperation() returns true.

Note that most LPEX actions (as defined in e.g., LpexAbstractTextEditor) call the editor directly.

Specified by:
doOperation in interface org.eclipse.jface.text.ITextOperationTarget

Parameters:
operation - LPEX-defined operation id (including the equivalents of ITextOperationTarget.UNDO, .REDO, etc.)
See Also:
ITextOperationTarget.doOperation(int)


 

 

enableOperation

public void enableOperation(int operation,
                            boolean enable)

Specified by:
enableOperation in interface org.eclipse.jface.text.ITextOperationTargetExtension


 

 

setTextColor

public void setTextColor(org.eclipse.swt.graphics.Color color)

This method does nothing. LPEX parsers set display attributes to text in the parsed document. Also, LPEX marks can be set with certain style, visibility, and protection attributes. See the mark and related editor parameters.

Defined by ITextViewer, as part of its presentation-manipulation support.

Specified by:
setTextColor in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setTextColor(Color)


 

 

setTextColor

public void setTextColor(org.eclipse.swt.graphics.Color color,
                         int start,
                         int length,
                         boolean controlRedraw)

This method does nothing. LPEX parsers set display attributes to text in the parsed document. Also, LPEX marks can be set with certain style, visibility, and protection attributes. See the mark and related editor parameters.

Defined by ITextViewer, as part of its presentation-manipulation support.

Specified by:
setTextColor in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.setTextColor(Color,int,int,boolean)


 

 

_internalGetVisibleRegion

protected org.eclipse.jface.text.IRegion _internalGetVisibleRegion()

This method returns null. In LpexTextViewer, 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 TextViewer, this method returns the visible region if it is not equal to the whole document, or null if it is.


 

 

changeTextPresentation

public void changeTextPresentation(org.eclipse.jface.text.TextPresentation presentation,
                                   boolean controlRedraw)

This method does nothing. LPEX document parsers set display attributes to the text in the parsed document. Also, LPEX marks can be set with certain style, visibility, and protection attributes. See the mark and related parameters.

In TextViewer, this method applies in the text widget the color information of the specified text presentation.

Defined by ITextViewer, as part of its presentation-manipulation support.

Specified by:
changeTextPresentation in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.changeTextPresentation(org.eclipse.jface.text.TextPresentation, boolean)


 

 

getFindReplaceTarget

public org.eclipse.jface.text.IFindReplaceTarget getFindReplaceTarget()

This method returns null. LPEX implements its own findAndReplace actions.

Defined by ITextViewer, as part of its target-handling support.

Specified by:
getFindReplaceTarget in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getFindReplaceTarget()


 

 

getTextOperationTarget

public org.eclipse.jface.text.ITextOperationTarget getTextOperationTarget()

Return the text-operations target of this viewer.

Defined by ITextViewer, as part of its target-handling support.

Specified by:
getTextOperationTarget in interface org.eclipse.jface.text.ITextViewer

See Also:
ITextViewer.getTextOperationTarget()


 

 

getCurrentTextHover

public org.eclipse.jface.text.ITextHover getCurrentTextHover()


 

 

getHoverEventLocation

public org.eclipse.swt.graphics.Point getHoverEventLocation()


 

 

modelLine2WidgetLine

public int modelLine2WidgetLine(int modelLine)

Implements the contract of ITextViewerExtension5.modelLine2WidgetLine(int).

Parameters:
modelLine - the model line
Returns:
the corresponding widget line or -1


 

 

modelOffset2WidgetOffset

public int modelOffset2WidgetOffset(int modelOffset)

Implements the contract of ITextViewerExtension5.modelOffset2WidgetOffset(int).

Parameters:
modelOffset - the model offset
Returns:
the corresponding widget offset or -1


 

 

modelRange2WidgetRange

public org.eclipse.jface.text.IRegion modelRange2WidgetRange(org.eclipse.jface.text.IRegion modelRange)

Implements the contract of ITextViewerExtension5.modelRange2WidgetRange(IRegion).

Parameters:
modelRange - the model range
Returns:
the corresponding widget range or null


 

 

widgetlLine2ModelLine

public int widgetlLine2ModelLine(int widgetLine)

Implements the contract of ITextViewerExtension5.widgetLine2ModelLine(int).

Parameters:
widgetLine - the widget line
Returns:
the corresponding model line


 

 

widgetLine2ModelLine

public int widgetLine2ModelLine(int widgetLine)

Implements the contract of ITextViewerExtension5.widgetLine2ModelLine(int). Returns the line of the viewer's document that corresponds to the given widget line, or -1 if there is no such line.

Parameters:
widgetLine - the widget line
Returns:
the corresponding model line or -1


 

 

widgetOffset2ModelOffset

public int widgetOffset2ModelOffset(int widgetOffset)

Implements the contract of ITextViewerExtension5.widgetOffset2ModelOffset(int).

Parameters:
widgetOffset - the widget offset
Returns:
the corresponding model offset or -1


 

 

widgetRange2ModelRange

public org.eclipse.jface.text.IRegion widgetRange2ModelRange(org.eclipse.jface.text.IRegion widgetRange)

Implements the contract of ITextViewerExtension5.widgetRange2ModelRange(IRegion).

Parameters:
widgetRange - the widget range
Returns:
the corresponding model range or null


 

 

getModelCoverage

public org.eclipse.jface.text.IRegion getModelCoverage()

Implements the contract of ITextViewerExtension5.getModelCoverage().

Returns:
the model coverage


 

 

getClosestWidgetLineForModelLine

protected int getClosestWidgetLineForModelLine(int modelLine)

Returns the line of the widget whose corresponding line in the viewer's document is closest to the given line in the viewer's document or -1.

Parameters:
modelLine - the line in the viewer's document
Returns:
the line in the widget that corresponds best to the given line in the viewer's document or -1


 

 

modelRange2WidgetRange

protected org.eclipse.jface.text.IRegion modelRange2WidgetRange(org.eclipse.jface.text.Position modelPosition)

Same as modelRange2WidgetRange(IRegion) but for a Position.

Parameters:
modelPosition - the position describing a range in the viewer's document
Returns:
a region describing a range in the viewer's widget


 

 

widgetSelection2ModelSelection

protected org.eclipse.swt.graphics.Point widgetSelection2ModelSelection(org.eclipse.swt.graphics.Point widgetSelection)

Translates the given widget selection into the corresponding region of the viewer's document or returns null if this fails.

Parameters:
widgetSelection - the widget selection
Returns:
the region of the viewer's document corresponding to the widget selection or null


 

 

modelSelection2WidgetSelection

protected org.eclipse.swt.graphics.Point modelSelection2WidgetSelection(org.eclipse.swt.graphics.Point modelSelection)

Translates the given selection range of the viewer's document into the corresponding widget range or returns null of this fails.

Parameters:
modelSelection - the selection range of the viewer's document
Returns:
the widget range corresponding to the selection range or null


 

 

widgetLineOfWidgetOffset

public int widgetLineOfWidgetOffset(int widgetOffset)

Implements the contract of ITextViewerExtension5.widgetLineOfWidgetOffset(int).

Parameters:
widgetOffset - the widget offset
Returns:
the corresponding widget line or -1


 

 

moveFocusToWidgetToken

public boolean moveFocusToWidgetToken()


 

 

setDocumentPartitioning

public void setDocumentPartitioning(String partitioning)

Sets the document partitioning of this viewer. The partitioning is used by this viewer to access partitioning information of the viewer's input document.

Parameters:
partitioning - the partitioning name


 

 

getDocumentPartitioning

protected String getDocumentPartitioning()

Returns the document partitioning for this viewer.

Returns:
the document partitioning for this viewer


 

 

initializeLpexView

protected void initializeLpexView(LpexView lpexView)

Hook to initialize a newly instantiated primary or secondary LpexView.

Extend this method to set any file/view-specific parameters for this LpexView. Here you may set any "File Open" preferences page settings for your solution's plug-in, such as sequenceNumbers, sourceEncoding, save.textLimit, and save.trim. The updateProfile command will be called later.

Parameters:
lpexView - the newly instantiated primary or secondary document view


 

 

updateProfile

protected void updateProfile()

Deprecated. Will be removed! You must extend updateProfile(LpexView) instead.


 

 

updateProfile

protected void updateProfile(LpexView lpexView)

Hook for post-updateProfile command processing. Extend this method to define your own LPEX actions (and assign them to keys), and your own LPEX commands.

Called when a new document view is created (a new document is opened in this viewer), and whenever the updateProfile command is issued afterwards.

Parameters:
lpexView - the primary or secondary document view whose profile has been updated


 

 

setEditorInput

protected void setEditorInput(org.eclipse.ui.IEditorInput editorInput)

Indicate which is the editor-input resource for this text viewer. LPEX uses this to set its document name. The LPEX document name is used to e.g., determine the document parser activated on this document.

This method should be called prior to the setDocument() for this text viewer, and whenever the input changes for this text viewer.


 

 

getLpexWindow

public LpexWindow getLpexWindow()

Retrieve the window of the underlying LPEX text widget that has the focus, or else the primary window.

Returns:
null if the text widget was not yet created, or was disposed


 

 

getFirstLpexWindow

public LpexWindow getFirstLpexWindow()

Retrieve the primary window of the underlying LPEX text widget.

Returns:
null if the text widget was not yet created, or was disposed


 

 

getLpexView

public LpexView getLpexView()

Retrieve the active view of the underlying LPEX text widget, or the primary view if none.

Returns:
null if the text widget was not yet created, or was disposed


 

 

getFirstLpexView

public LpexView getFirstLpexView()

Retrieve the primary view of the underlying LPEX text widget.

Returns:
null if the text widget was not yet created, or was disposed


 

 

getEOL

public String getEOL()

Return the line delimiter used by the document currently handled by this text viewer. This method assumes that a consistent line separator is used throughout the document (i.e., throughout the original underlying file resource).


 

Overview

 
Package  Use  Tree  Serialized  Deprecated  Index  Help 
SWT LPEX
v3.0.0
 PREV CLASS   NEXT CLASS FRAMES    NO FRAMES  
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD