Rational Developer for Power Systems Software
V7.6

com.ibm.etools.systems.editor
Class SystemTextEditor

java.lang.Object
  extended by LpexTextEditor
      extended by com.ibm.etools.systems.editor.SystemTextEditor
Direct Known Subclasses:
SystemTextBrowser

public class SystemTextEditor
extends LpexTextEditor


Nested Class Summary
protected  class SystemTextEditor.SystemTextEditorAction
          Inner class to be used as vertical ruler double click action
 
Field Summary
protected  boolean _bDebugMode
           
protected  boolean _bReadOnly
           
protected static PropertyResourceBundle _bundleDummy
           
protected  ISystemTextEditorContextContributor _defaultTextEditorContextContributor
           
protected  SystemTextFileDocumentProvider _documentProvider
           
protected  ISystemTextEditorAdapterContributor _languageAdapterFactory
           
protected  LpexView _lpexView
           
protected  LpexParser _menubarParser
           
protected  IMenuManager _menuManager
           
protected  ISystemTextEditorProfile _profile
           
protected  IToolBarManager _toolBarManager
           
protected  LpexParser _toolbarParser
           
protected  LpexSourceViewer _viewer
           
protected  StructuredSelection compileObject
           
static String Copyright
           
 
Constructor Summary
SystemTextEditor()
          Constructor for SystemTextEditor
 
Method Summary
protected  void addDebugEditorMenuActions(IMenuManager menu, boolean isDebuggable, int currentElement)
           
protected  void addDebugEditorRulerActions(IMenuManager menu, boolean isDebuggable, int currentElement)
           
 void addEditorContentsReplacedListener(ISystemTextEditorContentsReplacedListener listener)
          There are a couple of ways the entire contents of the editor can be replaced.
 void addLpexViewInitializer(ILpexViewInitializer initializer)
          Add initializer to handle new Lpex view
protected  boolean availableOpenNewView(LpexView lpexView)
          Disable the 'View>Open new view' editor popup menu item if the user has set splitWindow off We do not want to allow external views related to performLpexCommand()
 void cleanupMenuBar()
          Method cleanupMenuBar.
 void cleanupToolBar()
          The tool bar context in the editor is being switched.
 void clearCurrentExecutionPointHighlighting()
           
protected  void createActions()
          Creates actions for the menu bars.
protected  MenuManager createContextMenuManager(String text, String id)
           
protected  void createDebugMenuActions()
           
protected  void createDebugRulerActions()
           
 void createPartControl(Composite parent)
           
protected  ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles)
           
 void doSave(IProgressMonitor progressMonitor)
           
protected  void doSetInput(IEditorInput input)
          Overrides the Lpex's method so that the title may be set properly.
protected  void editorContextMenuAboutToShow(IMenuManager menu)
           
 Object getAdapter(Class classRequired)
          Delegates the giving of adapters to the parser and then to the language adapter factory
static List getBreakpointMarkersFromResource(IResource resource, int lineNumber)
          Returns all markers on the editor's input which include the ruler's line of activity.
protected  IAction getBreakpointRulerAction()
           
 StructuredSelection getCompileSelectionObject()
          Optimized access to the compile object
 String getContent()
          Get the editor content
static IDebugTarget getCurrentDebugTarget()
          Returns the currently selected debug target in the Debug View Returns the first IDebugTarget in the selection If no debug target is selected, this method returns null.
 IDocument getDocument()
          Returns the IDocument representing the edited document Implement @see ISystemSourceEditor requirements
 ISystemTextEditorProfile getEditorProfile()
          Returns the profile associated with this editor instance.
 IFile getFile()
          Implement @see ISystemSourceEditor requirements
 IFile getIFile()
          Method getIFile.
 String getLanguage()
          Returns the language string from the parser
 ISystemTextEditorAdapterContributor getLanguageAdapterFactory()
          The language adapter factor is set by the language specific parser.
 IMenuManager getMenuManager()
          Returns the menu manager previously set by the context contributor.
 ISystemTextEditor getSystemTextEditor()
           
 String getTitle()
          Get the editor title
 IToolBarManager getToolBarManager()
          Returns the toolbar manager previously set by the context contributor.
 void gotoLine(int line)
           
 void gotoLine(int line, boolean highlight)
           
 void gotoLine(int line, boolean highlight, String colourString)
           
protected  void handleElementContentReplaced()
          Notification: - IDocument content (consequently, LPEX text widget content) was (re)set.
 void initializeLpexView(LpexView lpexView)
          Initializes the Lpex view.
 boolean isDirty()
           
 boolean isEditable()
          Overrides LpexAbstractTextEditor
protected  boolean isEditorInputIncludedInContextMenu()
           
protected  boolean isLineDebuggable(int iLine)
          Determines whether a line is debuggable by asking the parser.
 boolean isLocal()
          Queries whether the origin of the file is local.
protected  boolean isPrefQuickDiffAlwaysOn()
          Returns
 boolean isRemote()
          Queries whether the origin of the file is remote.
protected static boolean isTargetDebuggable(IDebugTarget dbgtarget)
           
 void loadProfile()
          Loads the editor profile for the file being edited.
 void notifyLpexViewInitializers(LpexView newView)
          Notifies other lpex initializers of new view This is required by Edmund Reinhardt
 void parse()
          Parse the current text showing in the editor.
protected  boolean performLpexCommand(LpexView lpexView)
          Returns true to ensure that external Lpex Windows are not opened if window splitting is disabled or the current window can no longer be split.
 void performSaveAs(IProgressMonitor progressMonitor)
          Calls the profile's performSaveAs function.
 void performSaveAs(IProgressMonitor progressMonitor, IFile file)
          Calls the profile's performSaveAs function.
 void performSaveAs(IProgressMonitor progressMonitor, String strFileName)
          Calls the profile's performSaveAs function.
 void refresh()
           
protected  void registerSourceViewerConfiguration(LpexView view)
           
 void removeEditorContentsReplacedListener(ISystemTextEditorContentsReplacedListener listener)
          Remove listener from being notified of the editor content's being replaced.
 void removeLpexViewInitializer(ILpexViewInitializer initializer)
          Remove initalizer from being notified of the creation of a new Lpex view.
protected  void resetMarkers()
           
protected  void rulerContextMenuAboutToShow(IMenuManager menu)
          Presents breakpoint popup menu actions for debuggable lines.
 void selectionChanged(IWorkbenchPart part, ISelection selection)
           
 void selectText(int charStart, int charEnd)
           
 void setContent(String content)
          Set the editor content
 void setDebugMode(boolean bDebugMode)
          Sets debug mode and notifies the parsers of the mode change.
 void setEditorInput(IEditorInput input)
           
 void setLanguageAdapterFactory(ISystemTextEditorAdapterContributor languageAdapterFactory)
           
 void setReadOnly(boolean bReadOnly)
          Specify whether editor should be in read only mode or not
 void switchMenuBarContext(IMenuManager menuManager)
          The menu bar context in the editor is being switched.
 void switchToolBarContext(IToolBarManager toolBarManager)
          The tool bar context in the editor is being switched.
 void updateDirtyIndicator()
           
 void updateProfile(LpexView lpexView)
           
 void updateTitle()
           
protected  void widgetContentsSet(LpexView lpexView)
          Notification: - LPEX text widget content was (re)set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

_profile

protected ISystemTextEditorProfile _profile

_defaultTextEditorContextContributor

protected ISystemTextEditorContextContributor _defaultTextEditorContextContributor

_menuManager

protected IMenuManager _menuManager

_toolBarManager

protected IToolBarManager _toolBarManager

_toolbarParser

protected LpexParser _toolbarParser

_menubarParser

protected LpexParser _menubarParser

_documentProvider

protected SystemTextFileDocumentProvider _documentProvider

_viewer

protected LpexSourceViewer _viewer

_bDebugMode

protected boolean _bDebugMode

_lpexView

protected LpexView _lpexView

_bReadOnly

protected boolean _bReadOnly

compileObject

protected StructuredSelection compileObject

_languageAdapterFactory

protected ISystemTextEditorAdapterContributor _languageAdapterFactory

_bundleDummy

protected static PropertyResourceBundle _bundleDummy
Constructor Detail

SystemTextEditor

public SystemTextEditor()
Constructor for SystemTextEditor

Method Detail

cleanupMenuBar

public void cleanupMenuBar()
Method cleanupMenuBar. removes old menu items from the menu bar


cleanupToolBar

public void cleanupToolBar()
The tool bar context in the editor is being switched.


createActions

protected void createActions()
Creates actions for the menu bars.


createSourceViewer

protected ISourceViewer createSourceViewer(Composite parent,
                                           IVerticalRuler ruler,
                                           int styles)

doSave

public void doSave(IProgressMonitor progressMonitor)

doSetInput

protected void doSetInput(IEditorInput input)
                   throws CoreException
Overrides the Lpex's method so that the title may be set properly. The super class' behaviour displays the local file name. The ISeries member name may have double quote characters in it. When the local file is created on a Windows system, the double quote characters are converted into _34. So the member name "Abc123".rpgle is shown on the editor tab as _034Abc123_034.rpgle. We now call the profile to obtain the name.

Throws:
CoreException

editorContextMenuAboutToShow

protected void editorContextMenuAboutToShow(IMenuManager menu)

getAdapter

public Object getAdapter(Class classRequired)
Delegates the giving of adapters to the parser and then to the language adapter factory

See Also:
ISystemTextEditorAdapterContributor, getLanguageAdapterFactory()

getLanguageAdapterFactory

public ISystemTextEditorAdapterContributor getLanguageAdapterFactory()
The language adapter factor is set by the language specific parser. It is called when the editor is asked for an Adapter. It allows language specific objects to be created that will interact with the outline view and other dependent views.

Returns:
Returns the langugeAdapterFactory.

setLanguageAdapterFactory

public void setLanguageAdapterFactory(ISystemTextEditorAdapterContributor languageAdapterFactory)
Parameters:
langugeAdapterFactory - The langugeAdapterFactory to set.

getContent

public String getContent()
Get the editor content

Returns:
the text being displayed in the editor

getEditorProfile

public ISystemTextEditorProfile getEditorProfile()
Returns the profile associated with this editor instance.


getCurrentDebugTarget

public static IDebugTarget getCurrentDebugTarget()
Returns the currently selected debug target in the Debug View Returns the first IDebugTarget in the selection If no debug target is selected, this method returns null.


performLpexCommand

protected boolean performLpexCommand(LpexView lpexView)
Returns true to ensure that external Lpex Windows are not opened if window splitting is disabled or the current window can no longer be split.

See Also:
com.ibm.lpex.alef.LpexAbstractTextEditor#performLpexCommand(com.ibm.lpex.core.LpexView)

availableOpenNewView

protected boolean availableOpenNewView(LpexView lpexView)
Disable the 'View>Open new view' editor popup menu item if the user has set splitWindow off We do not want to allow external views related to performLpexCommand()


isEditable

public boolean isEditable()
Overrides LpexAbstractTextEditor


isLocal

public boolean isLocal()
Queries whether the origin of the file is local. If a file is local, it is not remote.

Returns:
true if opened file is local, false otherwise

isRemote

public boolean isRemote()
Queries whether the origin of the file is remote. If a file is remote, it is not local.

Returns:
true if the opened file is remote, false otherwise

getMenuManager

public IMenuManager getMenuManager()
Returns the menu manager previously set by the context contributor.


getLanguage

public String getLanguage()
Returns the language string from the parser


getTitle

public String getTitle()
Get the editor title


getToolBarManager

public IToolBarManager getToolBarManager()
Returns the toolbar manager previously set by the context contributor.


gotoLine

public void gotoLine(int line)

gotoLine

public void gotoLine(int line,
                     boolean highlight,
                     String colourString)

gotoLine

public void gotoLine(int line,
                     boolean highlight)

selectText

public void selectText(int charStart,
                       int charEnd)

isLineDebuggable

protected boolean isLineDebuggable(int iLine)
Determines whether a line is debuggable by asking the parser. The line number is 1 based.


loadProfile

public void loadProfile()
Loads the editor profile for the file being edited. If a profile is not found, the default profile is used.


parse

public void parse()
Parse the current text showing in the editor.


performSaveAs

public void performSaveAs(IProgressMonitor progressMonitor,
                          String strFileName)
Calls the profile's performSaveAs function. The default editor's saveAs is performed if the profile returns true.


performSaveAs

public void performSaveAs(IProgressMonitor progressMonitor,
                          IFile file)
Calls the profile's performSaveAs function. The default editor's saveAs is performed if the profile returns true.


updateTitle

public void updateTitle()

performSaveAs

public void performSaveAs(IProgressMonitor progressMonitor)
Calls the profile's performSaveAs function. The default editor's saveAs is performed if the profile returns true.


registerSourceViewerConfiguration

protected void registerSourceViewerConfiguration(LpexView view)

rulerContextMenuAboutToShow

protected void rulerContextMenuAboutToShow(IMenuManager menu)
Presents breakpoint popup menu actions for debuggable lines.


setContent

public void setContent(String content)
Set the editor content

Parameters:
the - text that the editor should display

setDebugMode

public void setDebugMode(boolean bDebugMode)
Sets debug mode and notifies the parsers of the mode change.


setReadOnly

public void setReadOnly(boolean bReadOnly)
Specify whether editor should be in read only mode or not

Parameters:
true - if read-only is required, false otherwise

switchMenuBarContext

public void switchMenuBarContext(IMenuManager menuManager)
The menu bar context in the editor is being switched.


switchToolBarContext

public void switchToolBarContext(IToolBarManager toolBarManager)
The tool bar context in the editor is being switched.


updateProfile

public void updateProfile(LpexView lpexView)
See Also:
com.ibm.lpex.alef.LpexAbstractTextEditor#updateProfile(com.ibm.lpex.core.LpexView)

selectionChanged

public void selectionChanged(IWorkbenchPart part,
                             ISelection selection)
See Also:
ISelectionListener

resetMarkers

protected void resetMarkers()

getBreakpointRulerAction

protected IAction getBreakpointRulerAction()

createDebugRulerActions

protected void createDebugRulerActions()

createDebugMenuActions

protected void createDebugMenuActions()

addDebugEditorMenuActions

protected void addDebugEditorMenuActions(IMenuManager menu,
                                         boolean isDebuggable,
                                         int currentElement)

addDebugEditorRulerActions

protected void addDebugEditorRulerActions(IMenuManager menu,
                                          boolean isDebuggable,
                                          int currentElement)

isTargetDebuggable

protected static boolean isTargetDebuggable(IDebugTarget dbgtarget)

isDirty

public boolean isDirty()

updateDirtyIndicator

public void updateDirtyIndicator()

refresh

public void refresh()

getBreakpointMarkersFromResource

public static List getBreakpointMarkersFromResource(IResource resource,
                                                    int lineNumber)
Returns all markers on the editor's input which include the ruler's line of activity.


clearCurrentExecutionPointHighlighting

public void clearCurrentExecutionPointHighlighting()

addEditorContentsReplacedListener

public void addEditorContentsReplacedListener(ISystemTextEditorContentsReplacedListener listener)
There are a couple of ways the entire contents of the editor can be replaced. Some language models may want to be notified of this so they can maintain an accurate model. This can be accomplished by implementing ISystemTextEditorContentsReplacedListener and calling #addEditorContentsReplacedListener(IEditorContentsReplacedListener)


removeEditorContentsReplacedListener

public void removeEditorContentsReplacedListener(ISystemTextEditorContentsReplacedListener listener)
Remove listener from being notified of the editor content's being replaced.

Parameters:
listener - ISystemTextEditorContentsReplacedListener

widgetContentsSet

protected void widgetContentsSet(LpexView lpexView)
Notification: - LPEX text widget content was (re)set. Source: - initial opening of a file in an Eclipse workbench edit part - Eclipse action "Save As". LPEX hook method.

See Also:
com.ibm.lpex.alef.LpexAbstractTextEditor#widgetContentsSet(com.ibm.lpex.core.LpexView)

handleElementContentReplaced

protected void handleElementContentReplaced()
Notification: - IDocument content (consequently, LPEX text widget content) was (re)set. Source: - "Replace With" - e.g., "Previous from Local History" in the Navigator window - Eclipse action "Revert to Saved". Eclipse AbstractTextEditor method to allow subclasses to perform any additional action necessary after the input document's content has been replaced.

See Also:
com.ibm.lpex.alef.LpexAbstractTextEditor#handleElementContentReplaced()

createPartControl

public void createPartControl(Composite parent)

initializeLpexView

public void initializeLpexView(LpexView lpexView)
Initializes the Lpex view.


notifyLpexViewInitializers

public void notifyLpexViewInitializers(LpexView newView)
Notifies other lpex initializers of new view This is required by Edmund Reinhardt

Parameters:
newView - new lpex view

addLpexViewInitializer

public void addLpexViewInitializer(ILpexViewInitializer initializer)
Add initializer to handle new Lpex view

Parameters:
initializer - ILpexViewInitializer

removeLpexViewInitializer

public void removeLpexViewInitializer(ILpexViewInitializer initializer)
Remove initalizer from being notified of the creation of a new Lpex view.

Parameters:
initializer - ILpexViewInitializer

getCompileSelectionObject

public StructuredSelection getCompileSelectionObject()
Optimized access to the compile object

Returns:
The object to use for compiling the source in this editor

isEditorInputIncludedInContextMenu

protected boolean isEditorInputIncludedInContextMenu()

getSystemTextEditor

public ISystemTextEditor getSystemTextEditor()
See Also:
com.ibm.etools.systems.core.resources.ISystemEditor#getSystemTextEditor()

setEditorInput

public void setEditorInput(IEditorInput input)
See Also:
com.ibm.etools.systems.core.resources.ISystemEditor#setEditorInput(org.eclipse.ui.IEditorInput)

isPrefQuickDiffAlwaysOn

protected boolean isPrefQuickDiffAlwaysOn()
Returns

See Also:
com.ibm.lpex.alef.LpexAbstractDecoratedTextEditor#isPrefQuickDiffAlwaysOn()

getIFile

public IFile getIFile()
Method getIFile. retrieves the IFile object for source open in an editor

Parameters:
editor - the editor in which the source is open
Returns:
IFile the IFile found

createContextMenuManager

protected MenuManager createContextMenuManager(String text,
                                               String id)
See Also:
com.ibm.lpex.alef.LpexAbstractTextEditor#createContextMenuManager(java.lang.String, java.lang.String)

getFile

public IFile getFile()
Implement @see ISystemSourceEditor requirements


getDocument

public IDocument getDocument()
Returns the IDocument representing the edited document Implement @see ISystemSourceEditor requirements


Rational Developer for Power Systems Software
V7.6

Copyright © 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.