|
SWT LPEX v3.0.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
com.ibm.lpex.alef.LpexAbstractTextEditor
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.
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() } |
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 |
public static final String DEFAULT_EDITOR_CONTEXT_MENU_ID
public static final String DEFAULT_RULER_CONTEXT_MENU_ID
protected static final int VERTICAL_RULER_WIDTH
protected static final com.ibm.lpex.alef.LpexAbstractTextEditor.IdMapEntry[] ACTION_MAP
protected final String fErrorLabel
Constructor Detail |
protected LpexAbstractTextEditor()
Method Detail |
public org.eclipse.ui.texteditor.IDocumentProvider getDocumentProvider()
protected final org.eclipse.jface.preference.IPreferenceStore getPreferenceStore()
protected final org.eclipse.jface.text.source.Annotation getRangeIndicator()
protected final org.eclipse.jface.text.source.SourceViewerConfiguration getSourceViewerConfiguration()
protected final org.eclipse.jface.text.source.ISourceViewer getSourceViewer()
public final org.eclipse.jface.text.source.IVerticalRuler getVerticalRuler()
protected final String getEditorContextMenuId()
protected final String getRulerContextMenuId()
protected void setDocumentProvider(org.eclipse.ui.texteditor.IDocumentProvider provider)
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.
protected void setSourceViewerConfiguration(org.eclipse.jface.text.source.SourceViewerConfiguration configuration)
protected void setRangeIndicator(org.eclipse.jface.text.source.Annotation rangeIndicator)
protected void setEditorContextMenuId(String contextMenuId)
protected void setRulerContextMenuId(String contextMenuId)
protected final void setCompatibilityMode(boolean compatible)
public org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider()
protected void rememberSelection()
Subclasses should implement this method including all necessary state. This default implementation remembers the textual range only and is thus purely syntactic.
protected void restoreSelection()
protected final org.eclipse.jface.action.IMenuListener getContextMenuListener()
protected final org.eclipse.swt.events.MouseListener getRulerMouseListener()
protected boolean affectsTextPresentation(org.eclipse.jface.util.PropertyChangeEvent event)
protected void handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent event)
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).
protected final void internalInit(org.eclipse.ui.IWorkbenchWindow window, org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException
protected org.eclipse.jface.text.source.IVerticalRuler createVerticalRuler()
protected org.eclipse.jface.text.source.ISourceViewer createSourceViewer(org.eclipse.swt.widgets.Composite parent, org.eclipse.jface.text.source.IVerticalRuler ruler, int styles)
Called from createPartControl().
public void createPartControl(org.eclipse.swt.widgets.Composite parent)
This is a multistep process:
protected void setDocumentProvider(org.eclipse.ui.IEditorInput input)
protected void doSetInput(org.eclipse.ui.IEditorInput input) throws org.eclipse.core.runtime.CoreException
public final void setInput(org.eclipse.ui.IEditorInput input)
protected void setPreferenceStore(org.eclipse.jface.preference.IPreferenceStore store)
public void close(boolean save)
public void dispose()
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.
protected void disposeDocumentProvider()
public void doSave(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
The implementation of this IEditorPart method may be extended by subclasses.
protected void enableSanityChecking(boolean enable)
protected void safelySanityCheckState(org.eclipse.ui.IEditorInput input)
protected void sanityCheckState(org.eclipse.ui.IEditorInput input)
protected void enableStateValidation(boolean enable)
protected void validateState(org.eclipse.ui.IEditorInput input)
protected void updateState(org.eclipse.ui.IEditorInput input)
protected void performSave(boolean overwrite, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
protected void handleExceptionOnSave(org.eclipse.core.runtime.CoreException exception, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
public void doSaveAs()
The LpexAbstractTextEditor implementation of this IEditorPart method calls performSaveAs().
protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor, String fileName)
public boolean isSaveAsAllowed()
public boolean isSaveOnCloseNeeded()
public boolean isDirty()
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).
public void doRevertToSaved()
The implementation of this ITextEditor method may be extended by subclasses.
protected void performRevert()
protected void handleElementContentReplaced()
public void setAction(String actionName, org.eclipse.jface.action.IAction action)
public org.eclipse.jface.action.IAction getAction(String actionName)
public void markAsPropertyDependentAction(String actionId, boolean mark)
protected void updatePropertyDependentActions()
protected void createNavigationActions()
Subclasses may extend.
protected void createActions()
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.
protected final void addAction(org.eclipse.jface.action.IMenuManager menu, String actionName)
protected final void addAction(org.eclipse.jface.action.IMenuManager menu, String group, String actionName)
protected final void addGroup(org.eclipse.jface.action.IMenuManager menu, String existingGroup, String newGroup)
protected void rulerContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
Subclasses may extend to add other actions.
protected void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
Subclasses may extend to add other actions. LPEX document parsers normally use LpexCommonParser.getPopupItems(int) to update the popup editor parameter.
public Object getAdapter(Class required)
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.
public void setFocus()
protected void setHelpContextId(String helpContextId)
protected final String getHelpContextId()
protected void setLanguageHelp(LpexLanguageHelp lsh)
protected void setKeyBindingScopes(String[] scopes)
protected void setKeyBindingScopes(LpexView lpexView, String[] scopes)
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:
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).
protected String[] getKeyBindingScopes(LpexView lpexView)
protected org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
protected void handleEditorInputChanged()
public boolean showsHighlightRangeOnly()
public void showHighlightRangeOnly(boolean showHighlightRangeOnly)
public void setHighlightRange(int offset, int len, boolean moveCursor)
public org.eclipse.jface.text.IRegion getHighlightRange()
public void setActionActivationCode(String actionName, char activationCharacter, int activationKeyCode, int activationStateMask)
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.
public void removeActionActivationCode(String actionName)
Removes any installed activation code for the specified action. If no activation code is installed, this method does not have any effect.
public void resetHighlightRange()
protected void adjustHighlightRange(int offset, int len)
public void selectAndReveal(int start, int len)
public org.eclipse.ui.INavigationLocation createEmptyNavigationLocation()
public org.eclipse.ui.INavigationLocation createNavigationLocation()
protected void markInNavigationHistory()
protected void editorSaved()
protected void firePropertyChange(int property)
public void setStatusField(org.eclipse.ui.texteditor.IStatusField field, String category)
protected org.eclipse.ui.texteditor.IStatusField getStatusField(String category)
protected void updateStatusField(String category)
protected void updateStatusFields()
protected String getCursorPosition()
public boolean isEditable()
public boolean isEditorInputReadOnly()
public boolean isEditorInputModifiable()
public void addRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)
public void removeRulerContextMenuListener(org.eclipse.jface.action.IMenuListener listener)
protected boolean canHandleMove(org.eclipse.ui.IEditorInput originalElement, org.eclipse.ui.IEditorInput movedElement)
protected static final int widgetOffset2ModelOffset(org.eclipse.jface.text.source.ISourceViewer viewer, int widgetOffset)
protected static final int modelOffset2WidgetOffset(org.eclipse.jface.text.source.ISourceViewer viewer, int modelOffset)
protected static final org.eclipse.jface.text.IRegion getCoverage(org.eclipse.jface.text.source.ISourceViewer viewer)
protected static final boolean isVisible(org.eclipse.jface.text.source.ISourceViewer viewer, int offset, int len)
public void showChangeInformation(boolean show)
public boolean isChangeInformationShowing()
public LpexView getLpexView()
public LpexView getFirstLpexView()
public LpexWindow getLpexWindow()
public LpexWindow getFirstLpexWindow()
public void initializeLpexView(LpexView 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.
public void updateProfile()
public void updateProfile(LpexView lpexView)
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.
protected void widgetContentsSet(LpexView 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"); } |
protected void handleDelegate(LpexView lpexView)
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().
protected boolean setDocumentSection(int linesBeforeStart, int linesAfterEnd)
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.
protected boolean addLines(LpexView lpexView, int lineNeeded)
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.
protected org.eclipse.core.resources.IResource getInputResource()
public String getEOL()
protected void createViewPreferenceNodes(LpexSourceViewer lpexSourceViewer)
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.
protected org.eclipse.jface.preference.IPreferencePage createViewPreferencePage(LpexView lpexView, int nodeType)
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.
|
SWT LPEX v3.0.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |