Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit.language.model
Class DdsModelLpexAdapter

java.lang.Object
  extended by com.ibm.etools.iseries.edit.language.model.DdsModelLpexAdapter
All Implemented Interfaces:
IDdsLanguageModel, com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter, ISystemTextEditorAdapterContributor

public class DdsModelLpexAdapter
extends Object
implements IDdsLanguageModel, ISystemTextEditorAdapterContributor, com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

This class manages a DdsModel for a particular LpexTextEditor. It keeps the contents of the editor and model in synch and manages the broadcasting of selection events.


Nested Class Summary
 class DdsModelLpexAdapter.LpexFileReader
           
 class DdsModelLpexAdapter.LpexSourceFile
          This class enables the DDS parser to parse the contents of an Lpex editor
 class DdsModelLpexAdapter.ParseDdsModelJob
          Asynchronously reparse the DDS file and refresh the outline view This job belongs to the family of jobs that parse the DDS model for this editor.
 class DdsModelLpexAdapter.ParseJobScheduler
          This class schedules jobs to parse the model from the editor's contents in the background.
 
Field Summary
 
Fields inherited from interface com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor
Copyright
 
Fields inherited from interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
copyright
 
Constructor Summary
DdsModelLpexAdapter(LpexTextEditor editor)
          Constructor if you do not have the connection and CCSID already computed.
DdsModelLpexAdapter(LpexTextEditor editor, int iCCSID, IBMiConnection connection)
          Constructor used from an ISeriesEditorParser that already has computed the necessary parameters
 
Method Summary
 void addDdsElementSelectionListener(com.ibm.etools.iseries.edit.propertysheet.dds.IDdsElementSelectionListener listener)
          IDdsPropertySheetAdapter implementation Whenever a different IDdsElement is selected in the editor, this listener should be notified
 void addDdsSelectionListener(IDdsParserListener listener)
          Add listener which will be notified whenever the cursor moves to a different DDS element in the source
 String convertToAS400Layout(String text)
          Convert given text to the ordering scheme of the iSeries
 String convertToJavaLayout(String text)
          Convert given text to the ordering scheme of the Java
 Object getAdapter(LpexTextEditor editor, Class classRequired)
          Adapter factory for creating DDS language model objects
 AS400BidiTransform getBidiTransform()
          Get the JTOpen transform that is able transform between the BIDI representation on the iSeries and the representation in a Java String.
 IDdsParserAdapter getDdsCursorListener()
          Return the singleton cursor listener that implements IDdsAdaptable.
 DdsModel getDdsModel()
          Retrieve DDS model corresponding to the source in the editor.
 DdsModel getDdsModelSynchronously()
          Retrieve DDS model corresponding to the source in the editor.
 IBMiConnection getISeriesConnection(boolean bPromptAllowed)
          IDdsPropertySheetAdapter implementation For the purposes of resolved database references, the DdsPropertySheetPage needs access to the IBMiConnection
 com.ibm.etools.iseries.edit.language.model.DdsParserListener getLpexDdsParserListener()
          Get the IDdsParserListener for this Lpex editor.
 DdsModelLpexAdapter.ParseJobScheduler getParseJobScheduler()
           
 com.ibm.etools.iseries.edit.propertysheet.dds.IPropertySheetTester getPropertySheetTester()
          IDdsPropertySheetAdapter implementation Return the tester that will create all of the tabs in the property sheet in order to test all of the MRI for TVT
 List<IDdsElement> getSelectedElement()
          IDdsPropertySheetAdapter implementation Initially the property sheet needs to be able query the current selected IDdsElement
 void handleFileRename()
          From the editor find the file that is currently being edited Set the current DDS type based on its extension
 boolean hasSequenceNumbers()
           
 boolean incrementallyUpdateModel(DdsChange change)
          Update the model with the changed/inserted line If we could not do this return true
protected  void initializeDdsModel()
          When this object is created - a DdsModel is not immediately created until it is requested by someone.
 boolean isDdsModelParsed()
          Has the DDS Model been parsed yet?
 boolean isDdsModelParsePending()
          Is there a DDS parse already in progress
 boolean isReadOnly()
          Returns whether the input is allowed to be modified.
 DdsModel parseDdsModel()
          Parse the model
 void propertyChangeFromPropertySheetEnded()
          IDdsPropertySheetAdapter implementation This pair of functions notifies the editor when a change to the model by the property sheet begins and ends.
 void propertyChangeFromPropertySheetStarting()
           
 void refreshModel()
          Refresh the model based on the changed source in Lpex.
 void removeDdsElementSelectionListener(com.ibm.etools.iseries.edit.propertysheet.dds.IDdsElementSelectionListener listener)
          Remove the listener from listening to IDdsElement selections
 void setEditor(LpexTextEditor editor)
          Set the view for the first time May need to set up listeners Computes the DDS type
 void setIFile(IFile file)
           
 void setISeriesConnection(IBMiConnection connection)
          IDdsPropertySheetAdapter implementation If #getISeriesConnnection(boolean) returns null, then the local connection will be resolved by the property sheet and set back to the editor, since it will be required for resolving database references.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DdsModelLpexAdapter

public DdsModelLpexAdapter(LpexTextEditor editor,
                           int iCCSID,
                           IBMiConnection connection)
Constructor used from an ISeriesEditorParser that already has computed the necessary parameters


DdsModelLpexAdapter

public DdsModelLpexAdapter(LpexTextEditor editor)
Constructor if you do not have the connection and CCSID already computed.

Method Detail

getAdapter

public Object getAdapter(LpexTextEditor editor,
                         Class classRequired)
Adapter factory for creating DDS language model objects

Specified by:
getAdapter in interface ISystemTextEditorAdapterContributor
See Also:
com.ibm.etools.systems.editor.ISystemTextEditorAdapterContributor#getAdapter(com.ibm.lpex.alef.LpexTextEditor, java.lang.Class)

getDdsCursorListener

public IDdsParserAdapter getDdsCursorListener()
Return the singleton cursor listener that implements IDdsAdaptable. Lazily create the singleton.


addDdsSelectionListener

public void addDdsSelectionListener(IDdsParserListener listener)
Add listener which will be notified whenever the cursor moves to a different DDS element in the source

Specified by:
addDdsSelectionListener in interface IDdsLanguageModel
Parameters:
listener - IDdsParserListener

initializeDdsModel

protected void initializeDdsModel()
When this object is created - a DdsModel is not immediately created until it is requested by someone. This is the method by which it is requested.


setEditor

public void setEditor(LpexTextEditor editor)
Set the view for the first time May need to set up listeners Computes the DDS type

Parameters:
initialView - The Lpex view to set.

setIFile

public void setIFile(IFile file)
Parameters:
file - The iFile to set.

handleFileRename

public void handleFileRename()
From the editor find the file that is currently being edited Set the current DDS type based on its extension


getDdsModel

public DdsModel getDdsModel()
Retrieve DDS model corresponding to the source in the editor. Returns null if no model has been parsed

Specified by:
getDdsModel in interface IDdsLanguageModel
Returns:

getDdsModelSynchronously

public DdsModel getDdsModelSynchronously()
Retrieve DDS model corresponding to the source in the editor. Parse and create model if it does not exist. Will only return null if the user has cancelled the operation or the thread is interrupted for some unknown reason.

Specified by:
getDdsModelSynchronously in interface IDdsLanguageModel
Returns:

isDdsModelParsed

public boolean isDdsModelParsed()
Has the DDS Model been parsed yet?

Specified by:
isDdsModelParsed in interface IDdsLanguageModel
Returns:

isDdsModelParsePending

public boolean isDdsModelParsePending()
Is there a DDS parse already in progress

Specified by:
isDdsModelParsePending in interface IDdsLanguageModel

parseDdsModel

public DdsModel parseDdsModel()
Parse the model

Returns:

getBidiTransform

public AS400BidiTransform getBidiTransform()
Get the JTOpen transform that is able transform between the BIDI representation on the iSeries and the representation in a Java String. Typically on the iSeries the data is in visual order but in Java Strings it is always in logical order. When IFile are downloaded they are transformed to logical. But the parser expects the source in the same order that it was entered on the iSeries.


hasSequenceNumbers

public boolean hasSequenceNumbers()

convertToAS400Layout

public String convertToAS400Layout(String text)
Convert given text to the ordering scheme of the iSeries

Parameters:
text -

convertToJavaLayout

public String convertToJavaLayout(String text)
Convert given text to the ordering scheme of the Java

Parameters:
text -

incrementallyUpdateModel

public boolean incrementallyUpdateModel(DdsChange change)
Update the model with the changed/inserted line If we could not do this return true

Specified by:
incrementallyUpdateModel in interface IDdsLanguageModel
Parameters:
change - - what change occurred it encapsulates lineNumber - the line number of the line to be changed/inserted typeOfChange - the type of change of the line - an update or an insert
Returns:
true if the model has been refreshed since it cannot be updated incrementally

refreshModel

public void refreshModel()
Refresh the model based on the changed source in Lpex.

Specified by:
refreshModel in interface IDdsLanguageModel

getParseJobScheduler

public DdsModelLpexAdapter.ParseJobScheduler getParseJobScheduler()

addDdsElementSelectionListener

public void addDdsElementSelectionListener(com.ibm.etools.iseries.edit.propertysheet.dds.IDdsElementSelectionListener listener)
IDdsPropertySheetAdapter implementation Whenever a different IDdsElement is selected in the editor, this listener should be notified

Specified by:
addDdsElementSelectionListener in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

removeDdsElementSelectionListener

public void removeDdsElementSelectionListener(com.ibm.etools.iseries.edit.propertysheet.dds.IDdsElementSelectionListener listener)
Description copied from interface: com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
Remove the listener from listening to IDdsElement selections

Specified by:
removeDdsElementSelectionListener in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

getLpexDdsParserListener

public com.ibm.etools.iseries.edit.language.model.DdsParserListener getLpexDdsParserListener()
Get the IDdsParserListener for this Lpex editor. Use lazy initialization to create the listener and have it listen to the DdsCursorListener.


getSelectedElement

public List<IDdsElement> getSelectedElement()
IDdsPropertySheetAdapter implementation Initially the property sheet needs to be able query the current selected IDdsElement

Specified by:
getSelectedElement in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

getISeriesConnection

public IBMiConnection getISeriesConnection(boolean bPromptAllowed)
IDdsPropertySheetAdapter implementation For the purposes of resolved database references, the DdsPropertySheetPage needs access to the IBMiConnection

Specified by:
getISeriesConnection in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
Parameters:
bPromptAllowed - - whether or not a GUI prompt is allowed - this parameter is always false when called from the DdsPropertySheetPage
Returns:
IBMiConnection

setISeriesConnection

public void setISeriesConnection(IBMiConnection connection)
IDdsPropertySheetAdapter implementation If #getISeriesConnnection(boolean) returns null, then the local connection will be resolved by the property sheet and set back to the editor, since it will be required for resolving database references.

Specified by:
setISeriesConnection in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
Parameters:
connection -

propertyChangeFromPropertySheetEnded

public void propertyChangeFromPropertySheetEnded()
IDdsPropertySheetAdapter implementation This pair of functions notifies the editor when a change to the model by the property sheet begins and ends.

Specified by:
propertyChangeFromPropertySheetEnded in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

propertyChangeFromPropertySheetStarting

public void propertyChangeFromPropertySheetStarting()
Specified by:
propertyChangeFromPropertySheetStarting in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

getPropertySheetTester

public com.ibm.etools.iseries.edit.propertysheet.dds.IPropertySheetTester getPropertySheetTester()
IDdsPropertySheetAdapter implementation Return the tester that will create all of the tabs in the property sheet in order to test all of the MRI for TVT

Specified by:
getPropertySheetTester in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
Returns:
IPropertySheetTester

isReadOnly

public boolean isReadOnly()
Description copied from interface: com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter
Returns whether the input is allowed to be modified. The property sheet will enable/disable its property pages accordingly.

Specified by:
isReadOnly in interface com.ibm.etools.iseries.edit.propertysheet.dds.IDdsPropertySheetAdapter

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.