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 LpexAbstractTextEditor

java.lang.Object
  extended byorg.eclipse.ui.part.WorkbenchPart
      extended byorg.eclipse.ui.part.EditorPart
          extended bycom.ibm.lpex.alef.LpexAbstractTextEditor

All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IReusableEditor, org.eclipse.ui.ISaveablePart, org.eclipse.ui.texteditor.ITextEditor, org.eclipse.ui.texteditor.ITextEditorExtension, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2

Direct Known Subclasses:
LpexStatusTextEditor


public abstract class LpexAbstractTextEditor
extends org.eclipse.ui.part.EditorPart
implements org.eclipse.ui.texteditor.ITextEditor, org.eclipse.ui.IReusableEditor, org.eclipse.ui.texteditor.ITextEditorExtension

A line oriented, LPEX-based abstract base implementation of a text editor. Subclasses are responsible for configuring the editor appropriately. LpexTextEditor is one such example.

Actions and commands

LPEX actions, their assigned keys, and commands new or (re)defined in here for running in the Eclipse workbench:

Keys already defined (e.g., by the active base profile) to an action different from nullAction are not redefined in here.

LpexAbstractTextEditor

If a subclass calls setEditorContextMenuId, the argument is used as the id under which the editor's context menu is registered for extensions. If no id is set, the context menu is registered under [editor_id].EditorContext, whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to run in version 1.0 context menu registration compatibility mode, the latter form of the registration even happens if a context menu id has been set via setEditorContextMenuId. If no id is set while in compatibility mode, the menu is registered under DEFAULT_EDITOR_CONTEXT_MENU_ID.

If a subclass calls setRulerContextMenuId, the arguments is used as the id under which the ruler's context menu is registered for extensions. If no id is set, the context menu is registered under [editor_id].RulerContext, whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to run in version 1.0 context menu registration compatibility mode, the latter form of the registration even happens if a context menu id has been set via setRulerContextMenuId. If no id is set while in compatibility mode, the menu is registered under DEFAULT_RULER_CONTEXT_MENU_ID.

Several AbstractTextEditor classes, methods, and fields are not available in LpexAbstractTextEditor. 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 document"); // refresh display
    }
  }
 // (b) Using the Eclipse editor
 else
  {
   // . . . get DocumentProvider, get IDocument, do replace()
  } 

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


Field Summary
protected static com.ibm.lpex.alef.LpexAbstractTextEditor.IdMapEntry[] ACTION_MAP
          Mapping between Eclipse action definition names and LPEX actions.
static String DEFAULT_EDITOR_CONTEXT_MENU_ID
          Menu id for the editor context menu.
static String DEFAULT_RULER_CONTEXT_MENU_ID
          Menu id for the ruler context menu.
protected  String fErrorLabel
          The error message shown in the status line in the case of failed information look up.
protected static int VERTICAL_RULER_WIDTH
          The width of the vertical ruler.
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
protected LpexAbstractTextEditor()
          Creates a new text editor.
 
Method Summary
protected  void addAction(org.eclipse.jface.action.IMenuManager menu, String actionName)
          Convenience method to add the action installed under the given action name to the given menu.
protected  void addAction(org.eclipse.jface.action.IMenuManager menu, String group, String actionName)
          Convenience method to add the action installed under the given action name to the specified group of the given menu.
protected  void addGroup(org.eclipse.jface.action.IMenuManager menu, String existingGroup, String newGroup)
          Convenience method to add a new menu group after the specified group.
protected  boolean addLines(LpexView lpexView, int lineNeeded)
          Hook for managing an LPEX text-widget document section.
 void addRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)
          Add a ruler context-menu listener to the editor.
protected  void adjustHighlightRange(int offset, int len)
          Adjust the highlight range so that at least the specified range is highlighted.
protected  boolean affectsTextPresentation(org.eclipse.jface.util.PropertyChangeEvent event)
          Determines whether the given preference change affects the editor's presentation.
protected  boolean canHandleMove(org.eclipse.ui.IEditorInput originalElement, org.eclipse.ui.IEditorInput movedElement)
          Returns whether this editor can handle the move of the original element so that it ends up being the moved element.
 void close(boolean save)
          Close this text editor, after optionally saving changes.
protected  void createActions()
          Creates this editor's standard actions.
 org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()
           
protected  void createNavigationActions()
          Create action entries for those LPEX actions that correspond to Eclipse's actions being mapped to its SWT StyledText actions in AbstractTextEditor.
 org.eclipse.ui.INavigationLocation createNavigationLocation()
           
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
          The LpexAbstractTextEditor implementation of this IWorkbenchPart method creates the vertical ruler and source viewer.
protected  org.eclipse.jface.text.source.ISourceViewer createSourceViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles)
          Create the source viewer (an LpexSourceViewer) to be used by this editor.
protected  org.eclipse.jface.text.source.IVerticalRuler createVerticalRuler()
          Create the vertical ruler (an LpexVerticalRuler) to be used by this editor.
protected  void createViewPreferenceNodes(LpexSourceViewer lpexSourceViewer)
          Hook to allow the solution plug-in create custom preference node(s) for view-scoped preference page(s) for this editor's source viewer.
protected  org.eclipse.jface.preference.IPreferencePage createViewPreferencePage(LpexView lpexView, int nodeType)
          Factory method to create a view-scoped preference page to be used by this editor's source viewer.
 void dispose()
          Dispose this part and discard all part state.
protected  void disposeDocumentProvider()
          Disposes the connection with the document provider.
 void doRevertToSaved()
          Abandons all modifications applied to the editor's input element's textual presentation since the last save operation.
 void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Saves the contents of the target.
 void doSaveAs()
          Saves the contents of the target to another object.
protected  void doSetInput(org.eclipse.ui.IEditorInput input)
          Internal processing of setting/changing the input to this editor.
protected  void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
          Sets up the context (pop-up) menu of this editor's active view before it is made visible.
protected  void editorSaved()
          Hook which gets called when the editor has been saved.
protected  void enableSanityChecking(boolean enable)
          Enables/disables sanity checking.
protected  void enableStateValidation(boolean enable)
          Enables/disables state validation.
protected  void firePropertyChange(int property)
          Fire a property-changed event.
 org.eclipse.jface.action.IAction getAction(String actionName)
          Returns the user or global Eclipse action which has been installed (i.e., cached in here) under the specified action name.
 Object getAdapter(Class required)
          Return the object which is an instance of the given class associated with this object, or null if no such object can be found.
protected  org.eclipse.jface.action.IMenuListener getContextMenuListener()
          Create and return the listener on this editor's context menus.
protected static org.eclipse.jface.text.IRegion getCoverage(org.eclipse.jface.text.source.ISourceViewer viewer)
          Returns the minimal region of the given source viewer's document that completely comprises everything that is visible in the viewer's widget.
protected  String getCursorPosition()
          Returns a description of the cursor position suitable for display in the Eclipse status field.
 org.eclipse.ui.texteditor.IDocumentProvider getDocumentProvider()
          Returns this text editor's document provider.
protected  String getEditorContextMenuId()
          Returns the editor's context menu id.
 String getEOL()
          Return the line delimiter used by the document currently handled by this text editor.
 LpexView getFirstLpexView()
          Convenience method to retrieve the primary document view of the underlying LPEX text widget.
 LpexWindow getFirstLpexWindow()
          Convenience method to retrieve the primary window of the underlying LPEX text widget.
protected  String getHelpContextId()
          Retrieves the editor's edit-area help context id.
 org.eclipse.jface.text.IRegion getHighlightRange()
          Return the highlighted range of this text editor.
protected  org.eclipse.core.resources.IResource getInputResource()
          Retrieve the IResource underlying our editor input (file / storage).
protected  String[] getKeyBindingScopes(LpexView lpexView)
          Returns the key-binding scopes set for a view of this editor.
 LpexView getLpexView()
          Convenience method to retrieve the active document view of the underlying LPEX text widget, or otherwise the primary view.
 LpexWindow getLpexWindow()
          Convenience method to retrieve the active window of the underlying LPEX text widget, or otherwise the primary window.
protected  org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
          Returns this editor's preference store.
protected  org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
          Returns the progress monitor related to this editor.
protected  org.eclipse.jface.text.source.Annotation getRangeIndicator()
          Returns this editor's range indicator.
protected  String getRulerContextMenuId()
          Returns the ruler's context menu id.
protected  org.eclipse.swt.events.MouseListener getRulerMouseListener()
          Create and return the listener on this editor's vertical ruler.
 org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
          Returns the editor's selection provider.
protected  org.eclipse.jface.text.source.ISourceViewer getSourceViewer()
          Returns the editor's source viewer.
protected  org.eclipse.jface.text.source.SourceViewerConfiguration getSourceViewerConfiguration()
          Returns the editor's source viewer configuration.
protected  org.eclipse.ui.texteditor.IStatusField getStatusField(String category)
          Returns the current status field for the given status category.
 org.eclipse.jface.text.source.IVerticalRuler getVerticalRuler()
          Returns the editor's vertical ruler.
protected  void handleDelegate(LpexView lpexView)
          Redirect Lpex actions and commands to run in this plug-in's context.
protected  void handleEditorInputChanged()
          Handle an external change of the editor's input element.
protected  void handleElementContentReplaced()
          Performs any additional action necessary after the input document's content has been replaced.
protected  void handleExceptionOnSave(org.eclipse.core.runtime.CoreException exception, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Handles the given save exception.
protected  void handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent event)
          Handle a property-change event describing a change of the editor's preference store.
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
          Initialize this editor with the given editor site and input.
 void initializeLpexView(LpexView lpexView)
          Hook to initialize a newly instantiated primary or secondary LpexView used by this text editor's LpexSourceViewer.
protected  void internalInit(org.eclipse.ui.IWorkbenchWindow window, org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
           
 boolean isChangeInformationShowing()
           
 boolean isDirty()
          Returns whether the contents of this editor have changed since the last save operation.
 boolean isEditable()
          Returns whether the text in this text editor can be changed by the user.
 boolean isEditorInputModifiable()
          Returns whether the editor's input can be persistently modified.
 boolean isEditorInputReadOnly()
          Returns whether the editor's input is read-only.
 boolean isSaveAsAllowed()
          Returns true if the "Save as" operation is supported by the target.
 boolean isSaveOnCloseNeeded()
          Returns whether the contents of this editor should be saved when the editor is closed.
protected static boolean isVisible(org.eclipse.jface.text.source.ISourceViewer viewer, int offset, int len)
          Tells whether the given region is visible in the given source viewer.
 void markAsPropertyDependentAction(String actionId, boolean mark)
          Marks or unmarks the given action to be updated on property changes.
protected  void markInNavigationHistory()
          Writes a check mark of the given situation into the navigation history.
protected static int modelOffset2WidgetOffset(org.eclipse.jface.text.source.ISourceViewer viewer, int modelOffset)
          Returns the offset of the given source viewer's text widget that corresponds to the given model offset.
protected  void performRevert()
          Performs revert and handles errors appropriately.
protected  void performSave(boolean overwrite, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Performs the save and handles errors appropriately.
protected  void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Performs a "Save as", and reports the result state back to the given progress monitor.
protected  void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor, String fileName)
          Performs a "Save as", and reports the result state back to the given progress monitor.
protected  void rememberSelection()
          Remembers the current selection of this editor.
 void removeActionActivationCode(String actionName)
          The preferred method is to define and use LPEX actions, and associate them with keys using the set keyAction LPEX command.
 void removeRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)
          Remove a ruler context-menu listener from the editor.
 void resetHighlightRange()
          Reset the highlight range.
protected  void restoreSelection()
          Restores a selection previously remembered by rememberSelection.
protected  void rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
          Sets up the vertical ruler's context (pop-up) menu before it is made visible.
protected  void safelySanityCheckState(org.eclipse.ui.IEditorInput input)
          Checks the state of the given editor input if sanity checking is enabled.
protected  void sanityCheckState(org.eclipse.ui.IEditorInput input)
          Checks the state of the given editor input.
 void selectAndReveal(int start, int len)
          Select and reveal the specified range in this text editor.
 void setAction(String actionName, org.eclipse.jface.action.IAction action)
          Installs or removes the given user or global Eclipse action under the specified action name.
 void setActionActivationCode(String actionName, char activationCharacter, int activationKeyCode, int activationStateMask)
          The preferred method is to define and use LPEX actions, and associate them with keys using the set keyAction LPEX command.
protected  void setCompatibilityMode(boolean compatible)
          Sets the context menu registration 1.0 compatibility mode.
protected  void setDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider provider)
          Sets the editor's document provider.
protected  void setDocumentProvider(org.eclipse.ui.IEditorInput input)
          Hook method for setting the document provider for the given input.
protected  boolean setDocumentSection(int linesBeforeStart, int linesAfterEnd)
          Establish the boundaries of the LPEX document section that was loaded or is going to be loaded in the text widget, and initiate the management of this document section.
protected  void setEditorContextMenuId(String contextMenuId)
          Sets this editor's pop-up (context) menu id.
 void setFocus()
          Ask the part to take focus within the workbench.
protected  void setHelpContextId(String helpContextId)
          Sets the editor's edit-area help context id.
 void setHighlightRange(int offset, int len, boolean moveCursor)
          Set the highlight range to the specified region.
 void setInput(org.eclipse.ui.IEditorInput input)
          Set the input to this editor.
protected  void setKeyBindingScopes(LpexView lpexView, String[] scopes)
          Sets the key-binding scopes for a view of this editor.
protected  void setKeyBindingScopes(String[] scopes)
          Do not use this method.
protected  void setLanguageHelp(LpexLanguageHelp lsh)
          Set the provider for this editor's LPEX document parser language-sensitive help (LSH).
protected  void setPreferenceStore(org.eclipse.jface.preference.IPreferenceStore store)
          Set this editor's preference store.
protected  void setRangeIndicator(org.eclipse.jface.text.source.Annotation rangeIndicator)
          Sets the annotation which this editor uses to represent the highlight range if the editor is configured to show the entire document.
protected  void setRulerContextMenuId(String contextMenuId)
          Sets the ruler's pop-up (context) menu id.
protected  void setSourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration configuration)
          Sets this editor's source viewer configuration used to configure its internal source viewer.
 void setStatusField(org.eclipse.ui.texteditor.IStatusField field, String category)
          Informs the editor which status field is to be used when posting status information in the given category.
 void showChangeInformation(boolean show)
           
 void showHighlightRangeOnly(boolean showHighlightRangeOnly)
          Configure the editor to show, or not show, the highlight range exclusively.
 boolean showsHighlightRangeOnly()
          Query whether the editor is configured to show the highlight range only, or all of the input element's textual representation.
 void updateProfile()
          Deprecated. Will be removed! You must extend updateProfile(LpexView) instead.
 void updateProfile(LpexView lpexView)
          Extend this method for post-updateProfile command processing.
protected  void updatePropertyDependentActions()
          Updates all property dependent actions.
protected  void updateState(org.eclipse.ui.IEditorInput input)
          Updates the state of the given editor input, such as the readonly flag.
protected  void updateStatusField(String category)
          Updates the Eclipse status field for the given category.
protected  void updateStatusFields()
          Updates all status fields.
protected  void validateState(org.eclipse.ui.IEditorInput input)
          Validates the state of the given editor input.
protected  void widgetContentsSet(LpexView lpexView)
          Hook called once the LPEX text widget contents have been (re-)set from the Eclipse IDocument.
protected static int widgetOffset2ModelOffset(org.eclipse.jface.text.source.ISourceViewer viewer, int widgetOffset)
          Returns the offset of the given source viewer's document that corresponds to the given widget offset.
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, setContentDescription, setInitializationData, setPartName
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getConfigurationElement, getContentDescription, getDefaultImage, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSite
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 

 

Field Detail

 

 

DEFAULT_EDITOR_CONTEXT_MENU_ID

public static final String DEFAULT_EDITOR_CONTEXT_MENU_ID

Menu id for the editor context menu.

See Also:
Constant Field Values


 

 

DEFAULT_RULER_CONTEXT_MENU_ID

public static final String DEFAULT_RULER_CONTEXT_MENU_ID

Menu id for the ruler context menu.

See Also:
Constant Field Values


 

 

VERTICAL_RULER_WIDTH

protected static final int VERTICAL_RULER_WIDTH

The width of the vertical ruler.

See Also:
Constant Field Values


 

 

ACTION_MAP

protected static final com.ibm.lpex.alef.LpexAbstractTextEditor.IdMapEntry[] ACTION_MAP

Mapping between Eclipse action definition names and LPEX actions. Used by the Eclipse key-binding service. See alse IdMapEntry and LpexTextNavigationAction.


 

 

fErrorLabel

protected final String fErrorLabel

The error message shown in the status line in the case of failed information look up.

Constructor Detail

 

 

LpexAbstractTextEditor

protected LpexAbstractTextEditor()

Creates a new text editor. If not explicitly set, this editor uses an LpexSourceViewerConfiguration to configure its source viewer. This viewer does not have a range indicator installed, nor any menu id set. By default, the created editor runs in 1.0 context menu registration compatibility mode.

Method Detail

 

 

getDocumentProvider

public org.eclipse.ui.texteditor.IDocumentProvider getDocumentProvider()

Returns this text editor's document provider.

Specified by:
getDocumentProvider in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.getDocumentProvider()


 

 

getPreferenceStore

protected final org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()

Returns this editor's preference store. LPEX's default settings are stored in its defaultProfile, not in the editor's preference store.

Returns:
this editor's preference store


 

 

getRangeIndicator

protected final org.eclipse.jface.text.source.Annotation getRangeIndicator()

Returns this editor's range indicator.


 

 

getSourceViewerConfiguration

protected final org.eclipse.jface.text.source.SourceViewerConfiguration getSourceViewerConfiguration()

Returns the editor's source viewer configuration.


 

 

getSourceViewer

protected final org.eclipse.jface.text.source.ISourceViewer getSourceViewer()

Returns the editor's source viewer.


 

 

getVerticalRuler

public final org.eclipse.jface.text.source.IVerticalRuler getVerticalRuler()

Returns the editor's vertical ruler.


 

 

getEditorContextMenuId

protected final String getEditorContextMenuId()

Returns the editor's context menu id.


 

 

getRulerContextMenuId

protected final String getRulerContextMenuId()

Returns the ruler's context menu id.


 

 

setDocumentProvider

protected void setDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider provider)

Sets the editor's document provider. This method must be called before the editor's control is created.

IDocumentProvider is an interface used by the ITextEditor to interact with its input element based on the input element's textual representation as IDocument. A document provider may be shared between multiple editors.

Parameters:
provider - the document provider


 

 

setSourceViewerConfiguration

protected void setSourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration configuration)

Sets this editor's source viewer configuration used to configure its internal source viewer. This method must be called before the editor's control is created. If not, this editor uses a default LpexSourceViewerConfiguration.

Parameters:
configuration - the source viewer configuration object
See Also:
LpexSourceViewerConfiguration


 

 

setRangeIndicator

protected void setRangeIndicator(org.eclipse.jface.text.source.Annotation rangeIndicator)

Sets the annotation which this editor uses to represent the highlight range if the editor is configured to show the entire document. If the range indicator is not set, this editor uses a DefaultRangeIndicator.

Parameters:
rangeIndicator - the annotation


 

 

setEditorContextMenuId

protected void setEditorContextMenuId(String contextMenuId)

Sets this editor's pop-up (context) menu id.

Parameters:
contextMenuId - the context menu id


 

 

setRulerContextMenuId

protected void setRulerContextMenuId(String contextMenuId)

Sets the ruler's pop-up (context) menu id.

Parameters:
contextMenuId - the context menu id


 

 

setCompatibilityMode

protected final void setCompatibilityMode(boolean compatible)

Sets the context menu registration 1.0 compatibility mode. (See class description for more details.)

Parameters:
compatible - true if compatibility mode is enabled


 

 

getSelectionProvider

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

Returns the editor's selection provider.

Specified by:
getSelectionProvider in interface org.eclipse.ui.texteditor.ITextEditor


 

 

rememberSelection

protected void rememberSelection()

Remembers the current selection of this editor. This method is called when, e.g., the content of the editor is about to be reverted to the saved state. This method remembers the selection in a semantic format, i.e., in a format which allows to restore the selection even if the originally selected text is no longer part of the editor's content.

Subclasses should implement this method including all necessary state. This default implementation remembers the textual range only and is thus purely syntactic.

See Also:
restoreSelection()


 

 

restoreSelection

protected void restoreSelection()

Restores a selection previously remembered by rememberSelection. Subclasses may reimplement this method and thereby semantically adapt the remembered selection. This default implementation just selects the remembered textual range.

See Also:
rememberSelection()


 

 

getContextMenuListener

protected final org.eclipse.jface.action.IMenuListener getContextMenuListener()

Create and return the listener on this editor's context menus.

Returns:
the menu listener


 

 

getRulerMouseListener

protected final org.eclipse.swt.events.MouseListener getRulerMouseListener()

Create and return the listener on this editor's vertical ruler. The vertical ruler works in conjunction with the primary window.

Returns:
the mouse listener


 

 

affectsTextPresentation

protected boolean affectsTextPresentation(org.eclipse.jface.util.PropertyChangeEvent event)

Determines whether the given preference change affects the editor's presentation. This implementation always returns false. May be reimplemented by subclasses.

Parameters:
event - the event which should be investigated
Returns:
true if the event describes a preference change affecting the editor's presentation


 

 

handlePreferenceStoreChanged

protected void handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent event)

Handle a property-change event describing a change of the editor's preference store.

LPEX's default settings are stored in its own defaultProfile. In TextViewer, this method updates any preference-related editor properties (its font; foreground, background, selection, and find-scope colours, carets).

Parameters:
event - the property change event


 

 

internalInit

protected final void internalInit(org.eclipse.ui.IWorkbenchWindow window,
                                  org.eclipse.ui.IEditorSite site,
                                  org.eclipse.ui.IEditorInput input)
                           throws org.eclipse.ui.PartInitException

Throws:
org.eclipse.ui.PartInitException


 

 

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException

Initialize this editor with the given editor site and input. This method is automatically called shortly after the part construction; it marks the start of the part's lifecycle. The IWorkbenchPart.dispose() method will be called automically at the end of the lifecycle. Clients must not call this method.

Specified by:
init in interface org.eclipse.ui.IEditorPart

Throws:
org.eclipse.ui.PartInitException
See Also:
IEditorPart.init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)


 

 

createVerticalRuler

protected org.eclipse.jface.text.source.IVerticalRuler createVerticalRuler()

Create the vertical ruler (an LpexVerticalRuler) to be used by this editor. Subclasses may reimplement this method.

Returns:
the vertical ruler


 

 

createSourceViewer

protected org.eclipse.jface.text.source.ISourceViewer createSourceViewer(org.eclipse.swt.widgets.Composite parent,
                                                                         org.eclipse.jface.text.source.IVerticalRuler ruler,
                                                                         int styles)

Create the source viewer (an LpexSourceViewer) to be used by this editor. Subclasses may reimplement this method.

Called from createPartControl().

Parameters:
parent - the parent control
ruler - the vertical ruler
styles - style bits, SWT.WRAP is currently not supported
Returns:
the source viewer


 

 

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)

The LpexAbstractTextEditor implementation of this IWorkbenchPart method creates the vertical ruler and source viewer. Subclasses may extend.

This is a multistep process:

  1. create one or more controls within the parent
  2. set the parent layout as needed
  3. hook focus on each of the controls - when focus is gained, notify all focus listeners
  4. register any global actions with the IActionService
  5. register any popup menus with the IActionService.

Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart

See Also:
IWorkbenchPart.createPartControl(org.eclipse.swt.widgets.Composite)


 

 

setDocumentProvider

protected void setDocumentProvider(org.eclipse.ui.IEditorInput input)

Hook method for setting the document provider for the given input. Called while updating the document provider for the new editor input. This default implementation does nothing. Clients may reimplement: this is the method in which you can configure the appropriate implicit document provider for the given editor input.

Parameters:
input - the input of this editor


 

 

doSetInput

protected void doSetInput(org.eclipse.ui.IEditorInput input)
                   throws org.eclipse.core.runtime.CoreException

Internal processing of setting/changing the input to this editor. Called from init() (shortly after the part construction), from setInput(), and from handleEditorInputChanged().

Parameters:
input - the (new) input to be set; if null, this text editor is being closed
Throws:
org.eclipse.core.runtime.CoreException - if the input cannot be connected to the document provider (i.e., it is not understood by this part)


 

 

setInput

public final void setInput(org.eclipse.ui.IEditorInput input)

Set the input to this editor. Overrides EditorPart's, but doSetInput() - called in here - will eventually call EditorPart's setInput() as well.

Specified by:
setInput in interface org.eclipse.ui.IReusableEditor

See Also:
EditorPart.setInput(org.eclipse.ui.IEditorInput)


 

 

setPreferenceStore

protected void setPreferenceStore(org.eclipse.jface.preference.IPreferenceStore store)

Set this editor's preference store. This method must be called before the editor's control is created. Note that LPEX's default settings are stored in its defaultProfile, not in the preference store.

Parameters:
store - the preference store


 

 

close

public void close(boolean save)

Close this text editor, after optionally saving changes.

Specified by:
close in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
save - true if unsaved changed should be saved, or false if unsaved changed should be discarded
See Also:
ITextEditor.close(boolean)


 

 

dispose

public void dispose()

Dispose this part and discard all part state. From this point on, the part will not be referenced within the workbench.

The AbstractTextEditor implementation of this IWorkbenchPart method may be extended by subclasses. Subclasses must call super.dispose().

This method is called at the end of the part lifecycle: release any resources, fonts, images, etc. held by the part. The part control has already been disposed, so there is no need to dispose it here.

Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart

See Also:
IWorkbenchPart.dispose()


 

 

disposeDocumentProvider

protected void disposeDocumentProvider()

Disposes the connection with the document provider. Subclasses may extend.


 

 

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor)

Saves the contents of the target. If the save is successful, the editor fires a property-changed event, reflecting the new dirty state.

The implementation of this IEditorPart method may be extended by subclasses.

Specified by:
doSave in interface org.eclipse.ui.ISaveablePart

Parameters:
progressMonitor - the progress monitor for communicating result state, or null
See Also:
ISaveablePart.doSave(org.eclipse.core.runtime.IProgressMonitor)


 

 

enableSanityChecking

protected void enableSanityChecking(boolean enable)

Enables/disables sanity checking.

Parameters:
enable - true if sanity checking should be enabled, or false otherwise


 

 

safelySanityCheckState

protected void safelySanityCheckState(org.eclipse.ui.IEditorInput input)

Checks the state of the given editor input if sanity checking is enabled.

Parameters:
input - the editor input whose state is to be checked


 

 

sanityCheckState

protected void sanityCheckState(org.eclipse.ui.IEditorInput input)

Checks the state of the given editor input.

Parameters:
input - the editor input whose state is to be checked


 

 

enableStateValidation

protected void enableStateValidation(boolean enable)

Enables/disables state validation.

Parameters:
enable - true if state validation should be enabled, false otherwise


 

 

validateState

protected void validateState(org.eclipse.ui.IEditorInput input)

Validates the state of the given editor input. The predominant intent of this method is to take any action probably necessary to ensure that the input can be persistently changed.

Parameters:
input - the input to be validated


 

 

updateState

protected void updateState(org.eclipse.ui.IEditorInput input)

Updates the state of the given editor input, such as the readonly flag.

Parameters:
input - the input to be validated


 

 

performSave

protected void performSave(boolean overwrite,
                           org.eclipse.core.runtime.IProgressMonitor progressMonitor)

Performs the save and handles errors appropriately.

Parameters:
overwrite - indicates whether or not overwriting is allowed
progressMonitor - the monitor in which to run the operation


 

 

handleExceptionOnSave

protected void handleExceptionOnSave(org.eclipse.core.runtime.CoreException exception,
                                     org.eclipse.core.runtime.IProgressMonitor progressMonitor)

Handles the given save exception. If the exception reports an out-of-sync situation, this is reported to the user. Otherwise, the exception is generically reported.

Parameters:
exception - the exception to handle
progressMonitor - the progress monitor


 

 

doSaveAs

public void doSaveAs()

Saves the contents of the target to another object. If the save is successful, the editor should fire a property-changed event, reflecting the new dirty state and input object.

The LpexAbstractTextEditor implementation of this IEditorPart method calls performSaveAs().

Specified by:
doSaveAs in interface org.eclipse.ui.ISaveablePart

See Also:
ISaveablePart.doSaveAs()


 

 

performSaveAs

protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor)

Performs a "Save as", and reports the result state back to the given progress monitor. This default implementation does nothing. Subclasses may reimplement.

Parameters:
progressMonitor - the progress monitor for communicating result state, or null
See Also:
performSaveAs(IProgressMonitor,String)


 

 

performSaveAs

protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor,
                             String fileName)

Performs a "Save as", and reports the result state back to the given progress monitor. This default implementation does nothing. Subclasses may reimplement.

Parameters:
fileName - name of the file to save to (initial file for the Save As dialog)
progressMonitor - the progress monitor for communicating result state, or null
See Also:
performSaveAs(IProgressMonitor)


 

 

isSaveAsAllowed

public boolean isSaveAsAllowed()

Returns true if the "Save as" operation is supported by the target. Overrides EditorPart's. The implementation of this IEditorPart method returns false. Subclasses may override.

Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart

Returns:
false
See Also:
ISaveablePart.isSaveAsAllowed()


 

 

isSaveOnCloseNeeded

public boolean isSaveOnCloseNeeded()

Returns whether the contents of this editor should be saved when the editor is closed.

Specified by:
isSaveOnCloseNeeded in interface org.eclipse.ui.ISaveablePart

Returns:
true if the contents of the editor should be saved on close, or
false if the contents are expendable
See Also:
EditorPart.isSaveOnCloseNeeded()


 

 

isDirty

public boolean isDirty()

Returns whether the contents of this editor have changed since the last save operation. If this value changes, the part must fire a property listener event with PROP_DIRTY.

What's returned by this method determines both the display, in the viewer label, of the dirty indication '*' which follows the file name, and the enablement of the Save menu items (which are only enabled on modified documents in Eclipse).

Specified by:
isDirty in interface org.eclipse.ui.ISaveablePart

See Also:
EditorPart.isDirty()


 

 

doRevertToSaved

public void doRevertToSaved()

Abandons all modifications applied to the editor's input element's textual presentation since the last save operation.

The implementation of this ITextEditor method may be extended by subclasses.

Specified by:
doRevertToSaved in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.doRevertToSaved()


 

 

performRevert

protected void performRevert()

Performs revert and handles errors appropriately.


 

 

handleElementContentReplaced

protected void handleElementContentReplaced()

Performs any additional action necessary after the input document's content has been replaced. Clients may extended this method.


 

 

setAction

public void setAction(String actionName,
                      org.eclipse.jface.action.IAction action)

Installs or removes the given user or global Eclipse action under the specified action name. The action is cached in here in a list of active actions, ans is also registered with the key-binding service.

Specified by:
setAction in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
actionName - name of the action (e.g., "SelectAll")
action - the JFace IAction, or null to remove it
See Also:
ITextEditor.setAction(String, IAction)


 

 

getAction

public org.eclipse.jface.action.IAction getAction(String actionName)

Returns the user or global Eclipse action which has been installed (i.e., cached in here) under the specified action name. If no action under this name has been installed or contributed via plugin.xml, null is returned.

Specified by:
getAction in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
actionName - action name, e.g., "cut"
See Also:
ITextEditor.getAction(String)


 

 

markAsPropertyDependentAction

public void markAsPropertyDependentAction(String actionId,
                                          boolean mark)

Marks or unmarks the given action to be updated on property changes.

Parameters:
actionId - the action id
mark - true if the action is property dependent


 

 

updatePropertyDependentActions

protected void updatePropertyDependentActions()

Updates all property dependent actions.


 

 

createNavigationActions

protected void createNavigationActions()

Create action entries for those LPEX actions that correspond to Eclipse's actions being mapped to its SWT StyledText actions in AbstractTextEditor. Used in the key-binding service to reroute the Eclipse-defined actions to LPEX's.

Subclasses may extend.


 

 

createActions

protected void createActions()

Creates this editor's standard actions.

Actions handled in here are the standard Eclipse editor actions defined in ITextEditorActionConstants (and IWorkbenchActionConstants), and some of the context menu actions.

The standard editor actions will be connected to the workbench global actions in LpexContextContributor -> BasicTextEditorActionContributor (see #doSetActiveEditor(): setGlobalActionHandler() for ITextEditorActionConstants.UNDO, REDO, CUT, COPY, PASTE, DELETE, SELECT_ALL, FIND, PRINT, REVERT; and setAction() for retargeted ITextEditorActionConstants.FIND_NEXT, FIND_PREVIOUS, FIND_INCREMENTAL, GOTO_LINE).

For LPEX's contributions to the Eclipse context, see LpexContextContributor.

Subclasses may extend this method.


 

 

addAction

protected final void addAction(org.eclipse.jface.action.IMenuManager menu,
                               String actionName)

Convenience method to add the action installed under the given action name to the given menu.

Parameters:
menu - menu to add the action
actionName - name of the action (e.g., "cut")


 

 

addAction

protected final void addAction(org.eclipse.jface.action.IMenuManager menu,
                               String group,
                               String actionName)

Convenience method to add the action installed under the given action name to the specified group of the given menu.

Parameters:
menu - the menu to add the action to
group - the group in the menu
actionName - the name of the action to add


 

 

addGroup

protected final void addGroup(org.eclipse.jface.action.IMenuManager menu,
                              String existingGroup,
                              String newGroup)

Convenience method to add a new menu group after the specified group.

Parameters:
menu - the menu to add the new group to
existingGroup - the group after which to insert the new group
newGroup - the new group


 

 

rulerContextMenuAboutToShow

protected void rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)

Sets up the vertical ruler's context (pop-up) menu before it is made visible.

Subclasses may extend to add other actions.

Parameters:
menu - the menu


 

 

editorContextMenuAboutToShow

protected void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)

Sets up the context (pop-up) menu of this editor's active view before it is made visible. Contributes LPEX's actions defined by the current.popup parameter, and also adds "Save" as per Eclipse norms.

Subclasses may extend to add other actions. LPEX document parsers normally use LpexCommonParser.getPopupItems(int) to update the popup editor parameter.

Parameters:
menu - the menu
See Also:
getLpexView()


 

 

getAdapter

public Object getAdapter(Class required)

Return the object which is an instance of the given class associated with this object, or null if no such object can be found.

IAdaptable is an interface for an adaptable object. Adaptable objects can be dynamically extended to provide different interfaces (or "adapters"). Adapters are created by adapter factories, which are in turn managed by type by adapter managers.

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable

See Also:
IAdaptable.getAdapter(java.lang.Class)


 

 

setFocus

public void setFocus()

Ask the part to take focus within the workbench. Gives keyboard input focus to the last-focused widget in the last-focused LpexWindow.

Specified by:
setFocus in interface org.eclipse.ui.IWorkbenchPart

See Also:
IWorkbenchPart.setFocus()


 

 

setHelpContextId

protected void setHelpContextId(String helpContextId)

Sets the editor's edit-area help context id.

Parameters:
helpContextId - the help context id
See Also:
setLanguageHelp(com.ibm.lpex.alef.LpexLanguageHelp)


 

 

getHelpContextId

protected final String getHelpContextId()

Retrieves the editor's edit-area help context id.


 

 

setLanguageHelp

protected void setLanguageHelp(LpexLanguageHelp lsh)

Set the provider for this editor's LPEX document parser language-sensitive help (LSH). When LSH is registered, a help request in the edit area will display the language-sensitive help, rather than the editor context help.

See Also:
setHelpContextId(java.lang.String)


 

 

setKeyBindingScopes

protected void setKeyBindingScopes(String[] scopes)

Do not use this method. It is provided solely for compatibility with Eclipse's AbstractTextEditor. Sets the key-binding scopes for the active, or otherwise primary view of this editor.

See Also:
setKeyBindingScopes(LpexView,String[])


 

 

setKeyBindingScopes

protected void setKeyBindingScopes(LpexView lpexView,
                                   String[] scopes)

Sets the key-binding scopes for a view of this editor.

Each time the updateProfile command is run in a document view of this editor, and before the updateProfile(LpexView) user hook is invoked, this method is called to set the LPEX key-binding scope for the LPEX editor profile in effect in that particular view. The scope set is one of:

  • empty (String[0]) - none base profile
  • "com.ibm.lpex.briefScope" - brief base profile
  • "com.ibm.lpex.emacsScope" - emacs base profile
  • "com.ibm.lpex.epmScope" - epm base profile
  • "com.ibm.lpex.ispfScope" - ispf base profile
  • "com.ibm.lpex.lpexScope" - lpex base profile
  • "com.ibm.lpex.seuScope" - seu base profile
  • "com.ibm.lpex.viScope" - vi base profile
  • "com.ibm.lpex.xeditScope" - xedit base profile.

See also eclipse/plugins/com.ibm.lpex_n.n.n/plugin.xml.

If the user modifies this key-binding scope, for example by subclassing this method or by calling it with a different scopes parameter from within the updateProfile() hook, it is assumed that any new scope(s) used extend or augment the LPEX scope set in here: actions are always registered with the Eclipse key-binding service for all the 'commands' that are defined in the LPEX scope that corresponds to the editor profile in effect (see also the updateProfile.baseProfile editor parameter).

Parameters:
lpexView - a document view of this editor
scopes - the key-binding scope(s) to set for this view
See Also:
getKeyBindingScopes(LpexView)


 

 

getKeyBindingScopes

protected String[] getKeyBindingScopes(LpexView lpexView)

Returns the key-binding scopes set for a view of this editor.

Returns:
the key-binding scopes set for the specified editor view, or
null if none set yet, or if the given lpexView is null
See Also:
setKeyBindingScopes(LpexView,String[])


 

 

getProgressMonitor

protected org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()

Returns the progress monitor related to this editor.

Returns:
the progress monitor related to this editor


 

 

handleEditorInputChanged

protected void handleEditorInputChanged()

Handle an external change of the editor's input element.


 

 

showsHighlightRangeOnly

public boolean showsHighlightRangeOnly()

Query whether the editor is configured to show the highlight range only, or all of the input element's textual representation.

Specified by:
showsHighlightRangeOnly in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.showsHighlightRangeOnly()


 

 

showHighlightRangeOnly

public void showHighlightRangeOnly(boolean showHighlightRangeOnly)

Configure the editor to show, or not show, the highlight range exclusively.

Specified by:
showHighlightRangeOnly in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.showHighlightRangeOnly(boolean)


 

 

setHighlightRange

public void setHighlightRange(int offset,
                              int len,
                              boolean moveCursor)

Set the highlight range to the specified region. Called, for example, from the outline view, when the selection changes.

Specified by:
setHighlightRange in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
offset - the offset of the highlighted range
len - the length of the highlighted range
moveCursor - true move the cursor to the start of the highlighted range, or false leave the cursor as is
See Also:
ITextEditor.setHighlightRange(int,int,boolean)


 

 

getHighlightRange

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

Return the highlighted range of this text editor.

Specified by:
getHighlightRange in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.getHighlightRange()


 

 

setActionActivationCode

public void setActionActivationCode(String actionName,
                                    char activationCharacter,
                                    int activationKeyCode,
                                    int activationStateMask)

The preferred method is to define and use LPEX actions, and associate them with keys using the set keyAction LPEX command.

Sets the given activation code for the specified Eclipse action. If there is an activation code already registered, it is replaced.

The activation code consists of the same information as a KeyEvent. If the activation code is triggered and the associated action is enabled, the action is performed and the triggering KeyEvent is considered consumed. If the action is disabled, the KeyEvent is passed on to the text widget unmodified. Thus, action activation codes and action accelerators differ in their model of event consumption.

The key code parameter can be -1 to indicate a wild card. The state mask parameter can be SWT.DEFAULT to indicate a wild card.

Specified by:
setActionActivationCode in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
actionName - Eclipse action name
activationCharacter - the activation code character
activationKeyCode - the activation code key code, or -1 for wild card
activationStateMask - the activation code state mask, or SWT.DEFAULT for wild card
See Also:
ITextEditor.setActionActivationCode(String,char,int,int)


 

 

removeActionActivationCode

public void removeActionActivationCode(String actionName)

The preferred method is to define and use LPEX actions, and associate them with keys using the set keyAction LPEX command.

Removes any installed activation code for the specified action. If no activation code is installed, this method does not have any effect.

Specified by:
removeActionActivationCode in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
actionName - action name
See Also:
ITextEditor.removeActionActivationCode(String)


 

 

resetHighlightRange

public void resetHighlightRange()

Reset the highlight range.

Specified by:
resetHighlightRange in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.resetHighlightRange()


 

 

adjustHighlightRange

protected void adjustHighlightRange(int offset,
                                    int len)

Adjust the highlight range so that at least the specified range is highlighted. Subclasses may re-implement this method.

Parameters:
offset - the offset of the range which at least should be highlighted
len - the length of the range which at least should be highlighted


 

 

selectAndReveal

public void selectAndReveal(int start,
                            int len)

Select and reveal the specified range in this text editor.

Specified by:
selectAndReveal in interface org.eclipse.ui.texteditor.ITextEditor

Parameters:
start - the offset of the selection
len - the length of the selection
See Also:
ITextEditor.selectAndReveal(int, int)


 

 

createEmptyNavigationLocation

public org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()


 

 

createNavigationLocation

public org.eclipse.ui.INavigationLocation createNavigationLocation()


 

 

markInNavigationHistory

protected void markInNavigationHistory()

Writes a check mark of the given situation into the navigation history.


 

 

editorSaved

protected void editorSaved()

Hook which gets called when the editor has been saved. Subclasses may extend.


 

 

firePropertyChange

protected void firePropertyChange(int property)

Fire a property-changed event.

Parameters:
property - the id of the property that changed
See Also:
WorkbenchPart.firePropertyChange(int)


 

 

setStatusField

public void setStatusField(org.eclipse.ui.texteditor.IStatusField field,
                           String category)

Informs the editor which status field is to be used when posting status information in the given category.

Specified by:
setStatusField in interface org.eclipse.ui.texteditor.ITextEditorExtension

Parameters:
field - the status field to be used, or null to remove a previous setting
category - the status information category
See Also:
ITextEditorExtension.setStatusField(org.eclipse.ui.texteditor.IStatusField,String)


 

 

getStatusField

protected org.eclipse.ui.texteditor.IStatusField getStatusField(String category)

Returns the current status field for the given status category.

Parameters:
category - the status category
Returns:
the current status field for the given status category


 

 

updateStatusField

protected void updateStatusField(String category)

Updates the Eclipse status field for the given category.

Parameters:
category - the status category


 

 

updateStatusFields

protected void updateStatusFields()

Updates all status fields. Called by LpexStatusTextEditor#updatePartControl().


 

 

getCursorPosition

protected String getCursorPosition()

Returns a description of the cursor position suitable for display in the Eclipse status field. The information returned is based on the latest status line information notifications received from LPEX. Note that status line notifications are not being received when the LPEX status line is on.

Returns:
a description of the cursor position


 

 

isEditable

public boolean isEditable()

Returns whether the text in this text editor can be changed by the user. Preferred method: use the LPEX readonly parameter.

Specified by:
isEditable in interface org.eclipse.ui.texteditor.ITextEditor

See Also:
ITextEditor.isEditable()


 

 

isEditorInputReadOnly

public boolean isEditorInputReadOnly()

Returns whether the editor's input is read-only. This method is orthogonal to ITextEditor#isEditable(), as it talks about the editor input, i.e., the domain element, and not about the editor document.

Specified by:
isEditorInputReadOnly in interface org.eclipse.ui.texteditor.ITextEditorExtension

See Also:
ITextEditorExtension.isEditorInputReadOnly()


 

 

isEditorInputModifiable

public boolean isEditorInputModifiable()

Returns whether the editor's input can be persistently modified. This is orthogonal to ITextEditorExtension#isEditorInputReadOnly(), as read-only elements may be modifiable, and writable elements may not be modifiable. If the given element is not connected to this document provider, the result is undefined. Document providers are allowed to use a cache to answer this question, i.e. there can be a difference between the "real" state of the element and the return value.

See Also:
ITextEditorExtension2.isEditorInputModifiable()


 

 

addRulerContextMenuListener

public void addRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)

Add a ruler context-menu listener to the editor.

Specified by:
addRulerContextMenuListener in interface org.eclipse.ui.texteditor.ITextEditorExtension

See Also:
ITextEditorExtension.addRulerContextMenuListener(IMenuListener)


 

 

removeRulerContextMenuListener

public void removeRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)

Remove a ruler context-menu listener from the editor.

Specified by:
removeRulerContextMenuListener in interface org.eclipse.ui.texteditor.ITextEditorExtension

See Also:
ITextEditorExtension.removeRulerContextMenuListener(IMenuListener)


 

 

canHandleMove

protected boolean canHandleMove(org.eclipse.ui.IEditorInput originalElement,
                                org.eclipse.ui.IEditorInput movedElement)

Returns whether this editor can handle the move of the original element so that it ends up being the moved element. By default this method returns true. Subclasses may reimplement.

Parameters:
originalElement - the original element
movedElement - the moved element
Returns:
whether this editor can handle the move of the original element so that it ends up being the moved element


 

 

widgetOffset2ModelOffset

protected static final int widgetOffset2ModelOffset(org.eclipse.jface.text.source.ISourceViewer viewer,
                                                    int widgetOffset)

Returns the offset of the given source viewer's document that corresponds to the given widget offset. Returns -1 if there is no such offset.

Parameters:
viewer - the source viewer
widgetOffset - the widget offset
Returns:
the corresponding offset in the source viewer's document or -1


 

 

modelOffset2WidgetOffset

protected static final int modelOffset2WidgetOffset(org.eclipse.jface.text.source.ISourceViewer viewer,
                                                    int modelOffset)

Returns the offset of the given source viewer's text widget that corresponds to the given model offset. Returns -1 if there is no such offset.

Parameters:
viewer - the source viewer
modelOffset - the model offset
Returns:
the corresponding offset in the source viewer's text widget or -1


 

 

getCoverage

protected static final org.eclipse.jface.text.IRegion getCoverage(org.eclipse.jface.text.source.ISourceViewer viewer)

Returns the minimal region of the given source viewer's document that completely comprises everything that is visible in the viewer's widget.

Parameters:
viewer - the viewer go return the coverage for
Returns:
the minimal region of the source viewer's document comprising the contents of the viewer's widget


 

 

isVisible

protected static final boolean isVisible(org.eclipse.jface.text.source.ISourceViewer viewer,
                                         int offset,
                                         int len)

Tells whether the given region is visible in the given source viewer.

Parameters:
viewer - the source viewer
offset - the offset of the region
len - the length of the region
Returns:
true if visible


 

 

showChangeInformation

public void showChangeInformation(boolean show)


 

 

isChangeInformationShowing

public boolean isChangeInformationShowing()


 

 

getLpexView

public LpexView getLpexView()

Convenience method to retrieve the active document view of the underlying LPEX text widget, or otherwise the primary view.


 

 

getFirstLpexView

public LpexView getFirstLpexView()

Convenience method to retrieve the primary document view of the underlying LPEX text widget.


 

 

getLpexWindow

public LpexWindow getLpexWindow()

Convenience method to retrieve the active window of the underlying LPEX text widget, or otherwise the primary window.


 

 

getFirstLpexWindow

public LpexWindow getFirstLpexWindow()

Convenience method to retrieve the primary window of the underlying LPEX text widget.


 

 

initializeLpexView

public void initializeLpexView(LpexView lpexView)

Hook to initialize a newly instantiated primary or secondary LpexView used by this text editor's LpexSourceViewer. Extend this method to set any file/view-specific parameters for this LpexView.

Here, for example, you may set for a primary view any "File Open" preference-page settings for your solution's plug-in, such as sequenceNumbers, sourceEncoding, save.textLimit, and save.trim.

The updateProfile command will be run later.

Parameters:
lpexView - the primary or secondary view being initialized
See Also:
widgetContentsSet(LpexView), updateProfile(LpexView)


 

 

updateProfile

public void updateProfile()

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


 

 

updateProfile

public void updateProfile(LpexView lpexView)

Extend this method for post-updateProfile command processing. For example, define your own LPEX actions and assign them to keys, define your own LPEX commands, set style attributes for LPEX style characters you use, etc. Here, you may also call setLanguageHelp(com.ibm.lpex.alef.LpexLanguageHelp) when the language-documentation plug-in for the LPEX document parser running in this editor's text viewer is available.

Called when a new LpexSourceViewer is created (an LPEX document has been opened, and is, at this point, already loaded in the editor), a secondary view is created on the document, and whenever the updateProfile command is issued afterwards.

Parameters:
lpexView - the primary or secondary document view whose profile is being updated
See Also:
initializeLpexView(com.ibm.lpex.core.LpexView), widgetContentsSet(com.ibm.lpex.core.LpexView), handleDelegate(com.ibm.lpex.core.LpexView)


 

 

widgetContentsSet

protected void widgetContentsSet(LpexView lpexView)

Hook called once the LPEX text widget contents have been (re-)set from the Eclipse IDocument. When the LpexSourceViewer is first created for this editor, this notification is sent some time after the initializeLpexView() user hook. This notification is eventually followed by an updateProfile(LpexView).

This hook is used, for example, by WSED's z/OS Tools to trim trailing spaces spaces for a newly-opened document. Because the undo stack is cleared in here, this cannot be done in updateProfile(), which is called every time default editor settings are changed:

 
 // (a) set source encoding first
 lpexView.doDefaultCommand("set sourceEncoding " + remoteEncoding);
 // (b) set sequence numbers (defined in terms of byte columns in the source encoding) 
 lpexView.doDefaultCommand("set sequenceNumbers 73 8");
 // (c) trim trailing spaces (now that sequence numbers are gone from the elements)
 if (lpexView.queryOn("current.save.trim"))
  {
   lpexView.trimDocument();
   lpexView.doDefaultCommand("undo clear");
   // since we've trimmed blanks, we must ignore them on file compare
   lpexView.doDefaultCommand("set compare.ignoreTrailingBlanks on");
  } 

Parameters:
lpexView - the primary view of the document
See Also:
initializeLpexView(LpexView), updateProfile(LpexView)


 

 

handleDelegate

protected void handleDelegate(LpexView lpexView)

Redirect Lpex actions and commands to run in this plug-in's context. This method handles the redirection of actions and commands in com.ibm.samples.Lpex views of this editor's document. Additional Lpex views of this text editor's document may be opened with the openNewView action and command.

Actions redefined in here: help, save, saveAs, get. Commands redefined in here: help, save. Extend this method to redefine additional actions and commands of an Lpex document view, for examples those actions and commands your application already redefines in updateProfile().

Parameters:
lpexView - the Lpex document view whose actions and commands are delegated to us
See Also:
updateProfile(LpexView)


 

 

setDocumentSection

protected boolean setDocumentSection(int linesBeforeStart,
                                     int linesAfterEnd)

Establish the boundaries of the LPEX document section that was loaded or is going to be loaded in the text widget, and initiate the management of this document section.

Note that this feature is only made available for certain specific text editor applications. Normally, the LPEX text widget loads and operates on a complete document (underlying resource).

This method requires the LPEX text widget to have been already created. Initially, it must be called after calling super.createSourceViewer(), if the method createSourceViewer() is extended, or otherwise at any time after createPartControl(). Afterwards, this method may be called following document-section updates triggered by addLines() notifications.

A call to this method may fail under certain circumstances. For example, you cannot use the document section feature when several views have been opened on the same document. In such a case false will be returned.

Returns:
false if unsuccessful
See Also:
addLines(com.ibm.lpex.core.LpexView, int)


 

 

addLines

protected boolean addLines(LpexView lpexView,
                           int lineNeeded)

Hook for managing an LPEX text-widget document section.

This method is invoked when it was determined that the currently-loaded LPEX text-widget document section should be expanded. A minimum of about two screen rows of lines is expected to be loaded around the current (cursor) line at any time.

The current implementation of this method does nothing beyond returning false. The DocumentAdapter of this editor's text viewer is currently suspended from listening to both the Eclipse document and the LPEX document when calling this hook.

Parameters:
lpexView - the LPEX text-widget view
lineNeeded - the first line before the currently-loaded LPEX document section, or the last line after the currently-loaded LPEX document section, in the range of lines with which the current document section must be expanded; lineNeeded already includes the minimum threshold indicated
Returns:
true = try to restore the original position in the view (this is recommended when e.g., the document section was updated by replacing the entire contents of the text widget)
See Also:
setDocumentSection(int, int)


 

 

getInputResource

protected org.eclipse.core.resources.IResource getInputResource()

Retrieve the IResource underlying our editor input (file / storage). It is used to retrieve the IProject for save-as operations.


 

 

getEOL

public String getEOL()

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


 

 

createViewPreferenceNodes

protected void createViewPreferenceNodes(LpexSourceViewer lpexSourceViewer)

Hook to allow the solution plug-in create custom preference node(s) for view-scoped preference page(s) for this editor's source viewer.

A custom preference node is a subclass of LpexViewPreferenceNode. Custom nodes are added after the LPEX built-in view-scoped preference nodes, in the order in which they are created.

See Also:
LpexViewPreferenceNode, LpexSourceViewer.createViewPreferenceNodes(com.ibm.lpex.alef.LpexSourceViewer)


 

 

createViewPreferencePage

protected org.eclipse.jface.preference.IPreferencePage createViewPreferencePage(LpexView lpexView,
                                                                                int nodeType)

Factory method to create a view-scoped preference page to be used by this editor's source viewer.

Extend this method to create customized preference page(s) for the view-scoped preference node(s). The default implementation returns null, letting the source viewer create its own default view preference pages for the LPEX built-in node types.

Parameters:
nodeType - preference node type, one of
LpexViewPreferenceNode.VIEW_BASE_PREFERENCE_NODE, LpexViewPreferenceNode.VIEW_PARSER_PREFERENCE_NODE, LpexViewPreferenceNode.VIEW_SEQUENCE_NUMBERS_PREFERENCE_NODE, LpexViewPreferenceNode.VIEW_SOURCE_ENCODING_PREFERENCE_NODE
See Also:
LpexSourceViewer.createViewPreferencePage(com.ibm.lpex.core.LpexView, int)


 

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