Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.edit
Class ISeriesEditorUtilities

java.lang.Object
  extended by com.ibm.etools.systems.editor.SystemEditorUtilities
      extended by com.ibm.etools.iseries.edit.ISeriesEditorUtilities
All Implemented Interfaces:
IISeriesEditorConstants, IISeriesEditorConstantsColors, IISeriesEditorConstantsRPG, ISystemEditorConstants

public class ISeriesEditorUtilities
extends SystemEditorUtilities
implements IISeriesEditorConstantsRPG, IISeriesEditorConstants

Utilities class for iSeries Remote Systems LPEX Editor


Nested Class Summary
protected static class ISeriesEditorUtilities.RunnableSignon
           
 
Field Summary
protected static ResourceBundle _bundle
          the resource bundle
static String copyright
           
protected static Vector<Vector<Object>> editorList
           
 
Fields inherited from class com.ibm.etools.systems.editor.SystemEditorUtilities
Copyright
 
Fields inherited from interface com.ibm.etools.iseries.editor.IISeriesEditorConstantsRPG
_straSQLWords, _straSQLWordsWithComment, CMD_SETFORMATLINETEXT, CMD_SETTABS, COLUMN_C_FREE, COLUMN_C_OPCODE, COLUMN_COMMENT, COLUMN_FACTOR1, COLUMN_FACTOR2, COLUMN_KEYWORDS, COLUMN_PROC_NAME_BEGIN, COLUMN_PROC_NAME_END, COLUMN_PROC_SPEC, COLUMN_SPEC, FIELD_FACTOR1, FIELD_FACTOR2, FIELD_FROM, FIELD_OPCODE, FIELD_TOLENGTH, OPM_COLUMN_FACTOR1
 
Fields inherited from interface com.ibm.etools.iseries.edit.IISeriesEditorConstantsColors
COLOR_BLACK_WHITE, COLOR_BLUE_WHITE, COLOR_BRIGHTBLUE_WHITE, COLOR_BRIGHTGREEN_WHITE, COLOR_BRIGHTGREY_WHITE, COLOR_BRIGHTPINK_WHITE, COLOR_BRIGHTRED_WHITE, COLOR_BRIGHTRED_WHITE_SQUIGGLE, COLOR_BROWN_WHITE, COLOR_CYAN_WHITE, COLOR_DARK_BROWN_WHITE, COLOR_ERROR_HIGHLIGHT, COLOR_GREEN_WHITE, COLOR_GREY_WHITE, COLOR_HIGHLIGHT, COLOR_MAGENTA_WHITE, COLOR_PINK_WHITE, COLOR_RED_WHITE, COLOR_WHITE_BRIGHTRED
 
Fields inherited from interface com.ibm.etools.iseries.edit.IISeriesEditorConstants
ACTION_VERIFYPROGRAM_ID, APPLICATION_DIAGRAM, COMPILE_ERROR_MESSAGE_STYLE, FILE_TYPE_CL, FILE_TYPE_DDS, FILE_TYPE_OTHER, FILE_TYPE_RPGILE, FILE_TYPE_RPGOPM, MAX_DS_NESTING, OUTLINE_VIEW, PREF_AUTO_FORMAT, PREF_AUTO_FORMAT_T, PREF_AUTO_UPPER, PREF_AUTO_UPPER_T, PREF_BASE_PREFIX, PREF_BLANK, PREF_BLANK_SUFFIX, PREF_BLANK_T, PREF_COMMAND_POS, PREF_COMMAND_POS_T, PREF_HIGHLIGHT, PREF_HIGHLIGHT_BACKGROUND, PREF_HIGHLIGHT_BACKGROUND_T, PREF_HIGHLIGHT_T, PREF_INDENT, PREF_INDENT_T, PREF_INDENTATION, PREF_INDENTATION_T, PREF_LABEL_ABOVE_CMD, PREF_LABEL_ABOVE_CMD_T, PREF_LABEL_POS, PREF_LABEL_POS_T, PREF_LINE_LENGTH, PREF_LINE_LENGTH_T, PREF_ONE_PARM_PER_LINE, PREF_ONE_PARM_PER_LINE_T, PREF_PARSER_ASSOC, PREF_PARSER_STYLES, PREF_SIGNATURE_T, PREF_SQL_SYNTAX_CHECK, PREF_SQL_SYNTAX_CHECK_T, PREF_SYNTAX_CHECK, PREF_SYNTAX_CHECK_T, PREF_TAB, PREF_TAB_GENERAL, PREF_TAB_GENERAL_T, PREF_TAB_T, PREF_TOOLTIP_SUFFIX, PROGRAM_VERIFICATION
 
Fields inherited from interface com.ibm.etools.systems.editor.ISystemEditorConstants
COMPILE_ERROR_CLASS_NAME, ICON_EDITOR_COMPILE, ICON_EDITOR_COMPILE_D, ICON_EDITOR_COMPILE_D_ID, ICON_EDITOR_COMPILE_D_ROOT, ICON_EDITOR_COMPILE_ID, ICON_EDITOR_COMPILE_ROOT, ICON_EDITOR_NEXT_ERROR, ICON_EDITOR_NEXT_ERROR_D, ICON_EDITOR_NEXT_ERROR_D_ID, ICON_EDITOR_NEXT_ERROR_D_ROOT, ICON_EDITOR_NEXT_ERROR_ID, ICON_EDITOR_NEXT_ERROR_ROOT, ICON_EDITOR_PREVIOUS_ERROR, ICON_EDITOR_PREVIOUS_ERROR_D, ICON_EDITOR_PREVIOUS_ERROR_D_ID, ICON_EDITOR_PREVIOUS_ERROR_D_ROOT, ICON_EDITOR_PREVIOUS_ERROR_ID, ICON_EDITOR_PREVIOUS_ERROR_ROOT, ICON_EXT, ICON_RELATIVE_PATH_DLCL16, ICON_RELATIVE_PATH_ELCL16, ICON_RELATIVE_PATH_FULL, ICON_SUFFIX, PREFIX, SYNTAX_ERROR_CLASS_NAME
 
Constructor Summary
ISeriesEditorUtilities()
           
 
Method Summary
static void addBiDirectionalMarkers(LpexView view, int iElement, int startRTLpos, int endRTLpos, int startNumberpos)
          Add bidirectional markers if needed to the source
static void addEditorInfo(LpexTextEditor editor, int iCCSID, IBMiConnection connection)
          Stores the editor info for retrieval when Saving As.
static QSYSEditableRemoteSourceFileMember browse(Shell shell, IBMiConnection connection, String libName, String fileName, String mbrName)
          Opens a given member member in the integrated LPEX editor, in browse mode.
static void cleanupMenuBar(IMenuManager menuManager)
          Method cleanupMenuBar.
static IQSYSFile COBOLgetFieldFile(LpexView view, IISeriesEditorParser parser)
          Method COBOLgetFieldFile.
static IQSYSMember COBOLgetIncludeMember(LpexView view, IISeriesEditorParser parser, boolean ILE)
          Method COBOLgetIncludeMember.
static boolean COBOLisValidFieldAction(LpexView view)
          Method COBOLisValidFieldAction.
static boolean COBOLisValidIncludeAction(LpexView view)
          Method COBOLisValidIncludeAction.
static IMenuManager createLanguageHelpMenu(ITextEditor editor, IMenuManager menuManager, String strPrefix, IMenuManager langHelpMenu)
          Method createLangaugeHelpMenu.
static IMenuManager createSourceMenu(ITextEditor editor, IMenuManager menuManager, IMenuManager sourceMenu)
          Method createSourceMenu.
static String determineRPGCFreeSpecOpcode(String strLineText)
          Determine the opcode of a C free spec line (returned uppercased)
static String determineRPGCSpecOpcode(String strLineText, boolean bILE)
          Determine the opcode of a C spec line (returned uppercased)
static String determineRPGCSpecOpcode(String strLineText, boolean bILE, boolean bPreserveCase)
          Determine the opcode of a C spec line (preserve case)
static String determineRPGOpcode(String strLineText, boolean bILE)
          Determine the opcode of a RPG line (returned uppercased)
static void enableMultipleViews(LpexView view)
          Enable multiple views in LPEX Editor
static void ensureVisible(LpexView lpexView, int element)
           
static String generateTabString(int[] iatabs)
          generateTabString From an Integer array, generate a string representing the int array
static LpexView[] getAllLpexViews(LpexTextEditor editor)
          Retrieves a list of all the view open in an editor.
static int getCCSID(IFile iFile, IBMiConnection connection)
          Method getCCSID.
static String getCommonFilterMenuItems()
          Method getCommonFilterMenuItems.
static StructuredSelection getCompileSelectionObject(ITextEditor editor)
          Method getCompileSelectionObject.
static int getCurrentLine(LpexView view)
          Deprecated.  
static int getDataLength(String[] straDataWords, String strLine)
          Returns the length of a data word, or zero if not a data word.
static int getDocumentElementBottom(LpexView view)
          Get the bottom most element
static int getDocumentElementNext(LpexView view, int iElement)
          Get the next element that is not a show line
static int getDocumentElementPrevious(LpexView view, int iElement)
          Get the previous line that is not a show line
static String getDocumentElementText(LpexView view, int iElement)
          Returns the view element's text appended with a null.
static String getDocumentElementTextDBCS(LpexView view, int iElement, boolean bPadDoubleByteCharacters)
          Returns a zero terminated line of text.
static int getDocumentElementTop(LpexView view)
          Returns the top most Element
static int getDocumentLineBottom(LpexView view)
          Deprecated. Get the bottom most line that is not a show line
static int getDocumentLineNext(LpexView view, int iLine)
          Deprecated.  
static int getDocumentLinePrevious(LpexView view, int iLine)
          Deprecated.  
static String getDocumentLineText(LpexView view, int iLine)
          Deprecated.  
static String getDocumentLineTextDBCS(LpexView view, int iLine, boolean bPadDoubleByteCharacters)
          Deprecated.  
static int getDocumentLineTop(LpexView view)
          Deprecated.  
static int getDocumentNumberOfLines(LpexView view)
          Method getDocumentNumberOfLines.
static Vector getEditorInfo(LpexTextEditor editor)
          Retrieves the editor information (CCSID & Connection).
static String getElementStringUpperWithSpace(LpexView view, int iElement, boolean bPadDoubleByteCharacters)
          Returns a line of text, upper case it, and padded with blank.
static String getElementTextDBCS(LpexView view, int iElement, boolean bPadDoubleByteCharacters)
          Returns a line of text.
static int getFirstNonBlankLineDown(int fromElement, int toElement, LpexView view, boolean skipSlashSlashComment)
          This element will find the last element in a CFree block.
static int getFirstNonBlankLineUp(int fromElement, int toElement, LpexView view, boolean skipSlashSlashComment, boolean insideNewLineCreationAction, long classForwardLink, long classBackwardLink)
          This element will find the last element in a CFree block.
static String getFullFilePath(ITextEditor editor)
          Method getFullFilePath.
static IBMiConnection getHostConnectionForLocalFile(boolean bPromptAllowed)
          Method getHostConnectionForLocalFile.
static IFile getIFile(ITextEditor editor)
          Method getIFile.
static IBMiConnection getISeriesConnection(ITextEditor editor)
          Method getISeriesConnection.
static IBMiConnection getISeriesConnection(ITextEditor editor, boolean checkProjects)
          Method getISeriesConnection.
static IQSYSMember getISeriesMember(ITextEditor editor)
          Method getIQSYSMember.
static String getLineText(LpexView view, int iLine)
          Deprecated. use _view.elementText(iElement)
static String getLineTextDBCS(LpexView view, int iLine, boolean bPadDoubleByteCharacters)
          Deprecated. use getElementTextDBCS
static LpexTextEditor getLpexEditor()
          Returns the active lpex editor, or null if there isn't one.
static LpexTextEditor getLpexEditorForPrimaryView(LpexView view)
          Retrieves the editor object that has the specified primary view
static int getMacroLength(String[] straMacroWords, String strLine)
          Returns the macro length or zero if not a macro
static int getMacroType(String[] straMacroWords, String strLine)
          Returns the macro type
static IPath getParseFilePath(IFile sourceFile)
           
static IPath getParseFilePath(IFile sourceFile, int mode)
           
static URL getParseFileURL(IFile sourceFile)
           
static IISeriesEditorParser getParserForPrimaryLpexView(LpexTextEditor editor)
          Determine the parser for the primary lpex view for the lpex editor
static LpexView getPrimaryLpexView(LpexTextEditor editor)
          Used to retrieve the primary view in an editor
static int getRecordLength(LpexView view)
          Method getRecordLength.
static int getRPGILEAutoIndentValue()
          get RPG ILE auto indent preference value
static IRunnableContext getRunnableContext()
          Returns a progress monitor context.
static String getSignature()
          Get the signature
static int getSQLLength(String[] straSQLWords, String strLine)
          Returns the length of the SQL word, or zero if not an SQL word
static boolean hasSemicolon(String strLine)
          Check for any semi-colon before a comment Port of evfritok.c, semiFound D62355 - also need to check if a "//" is inside a quote.
static boolean indentRPGILECFreeOpcode(String strOpcode)
          determines if the opcode should have the following line indented
static int indexOfStringNotInsideAQuote(String inputString, String stringToFind, char quote)
           
static void initializeBasePreferences(LpexView view, IISeriesEditorParser parser)
          Method initializeBasePreferences.
static boolean isCFComment(String strElement)
          Returns true if it is a CF Comment line.
static boolean isCFEnd(String strLine)
          Returns true if CF-Spec start
static boolean isCFSQLStart(LpexView view, int iElement)
          Returns true if start of SQL Statement in C free-form and source type is SQLRPGLE.
static boolean isCFSQLStart(String strLine)
          Returns true if start of SQL Statement in C free-form and source type is SQLRPGLE.
static boolean isCFStart(String strLine)
          Returns true if CF-Spec end
static boolean isData(String[] straDataWords, String strLine)
          Returns true if line is a DATA statement
static boolean isExtendedFactorTwoOpcode(String[] straXF2_opcodes, String[] straXF2_possible_opcodes, String strLine)
          Returns whether 'C' line an extended Factor2 C spec.
static boolean isIFSFile(IFile iFile)
          Returns true if is an IFS file, false otherwise Defect 61409
static boolean isMacro(String[] straMacroWords, String strLine)
           
static boolean isNumeric(String strNumeric)
          Returns whether a string is base 10 numeric.
static boolean isPrimaryLpexView(LpexView lpexView)
          Returns if Lpex view is the primary view
static boolean isSlashComment(String strLine, int iIndex)
           
static boolean isSQL(String[] straSQLWords, LpexView view, int iElement)
          Returns true if line is an SQL statement (convenient for the caller, so it does not need to get the string of a line first) cmvc64662
static boolean isSQL(String[] straSQLWords, String strLine)
          Returns true if line is an SQL statement
static boolean isSQLEnd(String strLine)
          Returns true if end of SQL Statement
static boolean isSQLStart(String strLine)
          Returns true if start of SQL Statement
static void issueLpexMessage(LpexTextEditor editor, String message, Throwable exception)
          Display error message on editor message line as well as in the log file
static boolean isWhiteSpace(char c)
          Returns whether a character is white space
static boolean nonBlankInColumn6Or7(String strElement)
          Returns true if either of column 6 or 7 is not.
static QSYSEditableRemoteSourceFileMember open(Shell shell, IBMiConnection connection, String libName, String fileName, String mbrName)
          Opens a given member member in the integrated LPEX editor.
static IEditorPart open(Shell shell, String projectName, String remoteMemberName)
          Open the specified member in the default editor for that member type.
static IEditorPart open(Shell shell, String projectName, String remoteMemberName, boolean openIfClosed)
           
static void openEditable(QSYSEditableRemoteSourceFileMember editable, String objectName)
           
static boolean outdentRPGILECFreeOpcode(String strOpcode)
          determines if the opcode should have the current line outdented
static void positionCursor(LpexTextEditor _editor, LpexView _view, int iLineCursor, int startPosition, int selectedLength)
          Called when the selection has changed in the content outline view.
static String prependLineWithSignature(String strLine)
          Prepend line with signature (if enabled)
static void printLineClassesValue(int startElement, int endElement, LpexView view)
           
static void printLineStyles(int startElement, int endElement, LpexView view)
           
static void refreshAllViews(LpexTextEditor editor)
          This method refreshs all the views open in an editor.
static void refreshBasePreferences(LpexView view)
          Method refreshBasePreferences.
static void removeEditorInfo(LpexTextEditor editor)
          Cleans up information for the editor.
static void selectionLinesChanged(LpexTextEditor _editor, int iLineOrigin, int iLineExtent, int iLineCursor, int startPosition, int selectedLength)
          Called when the selection has changed in the content outline view.
static void selectionLinesChanged(LpexTextEditor _editor, LpexView _view, int iLineOrigin, int iLineExtent, int iLineCursor, int startPosition, int selectedLength)
          Called when the selection has changed in the content outline view.
static void setDocumentElementText(LpexView view, int iElement, String strElement)
          Associates the text with the editor element line Removes the null at the end of the string
static void setDocumentLineText(LpexView view, int iLine, String strLine)
          Deprecated.  
static void setElementColors(LpexView view, int iElement, String strStyles, boolean bFixedLengthFields)
          Sets an Lpex element's color style.
static int setEncoding(LpexTextEditor editor, LpexView view, boolean allowPrompting)
          Method setEncoding.
static void setEncoding(LpexView view, int iCCSID)
          Method setEncoding.
static void setHighlightRange(LpexTextEditor _editor, LpexView _view, int iLineOrigin, int iLineExtent)
          Highlight the range of lines that correspond to the select language construct.
static void setLineColors(LpexView view, int iLine, String strStyles, boolean bFixedLengthFields)
          Deprecated.  
static void setMessageElementColors(LpexView view, int iElement, String strStyles)
          Sets the style colours for a message element where everything is in Unicode, so no DBCS considerations are applied.
static void showBlockNesting(LpexView view, boolean showNesting)
           
static int skipFixFormComment(LpexView view, int iElement)
           
 
Methods inherited from class com.ibm.etools.systems.editor.SystemEditorUtilities
getBaseEditorAction, getSourceMenu, removeAllShowLines, removeAllShowLines, removeMessages, removeMessages, removeMessages, setDateArea, updateEditors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

editorList

protected static Vector<Vector<Object>> editorList

copyright

public static final String copyright
See Also:
Constant Field Values

_bundle

protected static ResourceBundle _bundle
the resource bundle

Constructor Detail

ISeriesEditorUtilities

public ISeriesEditorUtilities()
Method Detail

cleanupMenuBar

public static void cleanupMenuBar(IMenuManager menuManager)
Method cleanupMenuBar. used to remove the menu items when switching editors

Parameters:
menuManager - the menu to remove items from

getFullFilePath

public static String getFullFilePath(ITextEditor editor)
Method getFullFilePath. retrieves the full file path from the IFile

Parameters:
editor - the editor that the file is open in
Returns:
String the full path name

getCompileSelectionObject

public static StructuredSelection getCompileSelectionObject(ITextEditor editor)
Method getCompileSelectionObject. retrieves the object needed for the compile actions

Parameters:
editor - the editor that the source is open in
Returns:
StructuredSelection the selection object to pass to the compile actions

getCCSID

public static int getCCSID(IFile iFile,
                           IBMiConnection connection)
Method getCCSID. Retrieves the CCSID for a parser. Called by the parsers AND the verifiers! CCSID is retrieved in the following manner:

the iFile properties are retrieved and the CCSID stored within is checked

1) if the CCSID is not 0, and not 65535, then that is the CCSID used 2) If the CCSID is 0 or 65535, then

a) if the user is connected, then the active job CCSID is used. b) if the user is disconnected, the cache is first checked for CCSID, if found then that CCSID is used

c) if the user is disconnected and if the cache doesn't contain a CCSID (the user never signed on), then the session property is used

d) if the user is disconnected and if the session property doesn't exist then the user is prompted to signon (unless working offline). If signon successful, then the job CCSID is used. The Session property is set to this CCSID.

e) If the signon failed (user pressed cancel) then the CCSID defaults to 37, and the session CCSID is set to 37.

SE25654: Extended this method to support a null value for (iFile) parameter: For calling from ISeriesLibTableView, to let it get the CCSID for the job, even though it is not an editor application.

Parameters:
parser - the parser that the source is open in
Returns:
int the CCSID that the parser should use.

createLanguageHelpMenu

public static IMenuManager createLanguageHelpMenu(ITextEditor editor,
                                                  IMenuManager menuManager,
                                                  String strPrefix,
                                                  IMenuManager langHelpMenu)
Method createLangaugeHelpMenu. Creates the language help menu on the Help menu

Parameters:
editor -
menuManager - the menu manager
strPrefix - the prefix for the item from the resource bundle
langHelpManager - the language help menu (if it exits, or null)
Returns:
IMenuManager the language help menu, so additional items can be added by the parser

createSourceMenu

public static IMenuManager createSourceMenu(ITextEditor editor,
                                            IMenuManager menuManager,
                                            IMenuManager sourceMenu)
Method createSourceMenu. Creates the source menu and adds the common menu items

Parameters:
editor - the lpex text editor to add the source menu
menuManager - the menu manager
Returns:
IMenuManager the source menu, so additional items can be added by the parser

determineRPGCSpecOpcode

public static String determineRPGCSpecOpcode(String strLineText,
                                             boolean bILE)
Determine the opcode of a C spec line (returned uppercased)

Parameters:
strLineText - - a c spec line
bILE - - true if ILE RPG
Returns:
opcode - uppercased opcode or ""

determineRPGCSpecOpcode

public static String determineRPGCSpecOpcode(String strLineText,
                                             boolean bILE,
                                             boolean bPreserveCase)
Determine the opcode of a C spec line (preserve case)

Parameters:
strLineText - - a c spec line
bILE - - true if ILE RPG
bPreserveCase - - indicates if case should be preserved
Returns:
opcode - uppercased opcode or ""

determineRPGCFreeSpecOpcode

public static String determineRPGCFreeSpecOpcode(String strLineText)
Determine the opcode of a C free spec line (returned uppercased)

Parameters:
strLineText - - a c free spec line
Returns:
opcode - uppercased opcode or ""

determineRPGOpcode

public static String determineRPGOpcode(String strLineText,
                                        boolean bILE)
Determine the opcode of a RPG line (returned uppercased)

Parameters:
strLineText - - a line
Returns:
opcode - uppercased opcode or ""

generateTabString

public static String generateTabString(int[] iatabs)
generateTabString From an Integer array, generate a string representing the int array


getCurrentLine

public static int getCurrentLine(LpexView view)
Deprecated. 

Returns the current line


getDataLength

public static int getDataLength(String[] straDataWords,
                                String strLine)
Returns the length of a data word, or zero if not a data word.


getDocumentLineBottom

public static int getDocumentLineBottom(LpexView view)
Deprecated. Get the bottom most line that is not a show line


getDocumentElementBottom

public static int getDocumentElementBottom(LpexView view)
Get the bottom most element


getDocumentLineNext

public static int getDocumentLineNext(LpexView view,
                                      int iLine)
Deprecated. 

Get the next line that is not a show line


getDocumentElementNext

public static int getDocumentElementNext(LpexView view,
                                         int iElement)
Get the next element that is not a show line


getDocumentLinePrevious

public static int getDocumentLinePrevious(LpexView view,
                                          int iLine)
Deprecated. 

Get the previous line that is not a show line


getDocumentElementPrevious

public static int getDocumentElementPrevious(LpexView view,
                                             int iElement)
Get the previous line that is not a show line


getDocumentLineText

public static String getDocumentLineText(LpexView view,
                                         int iLine)
Deprecated. 

Returns the view element's text appended with a null.


getDocumentElementText

public static String getDocumentElementText(LpexView view,
                                            int iElement)
Returns the view element's text appended with a null.


getDocumentLineTextDBCS

public static String getDocumentLineTextDBCS(LpexView view,
                                             int iLine,
                                             boolean bPadDoubleByteCharacters)
Deprecated. 

Returns a zero terminated line of text. If the source encoding is DBCS,


getDocumentElementTextDBCS

public static String getDocumentElementTextDBCS(LpexView view,
                                                int iElement,
                                                boolean bPadDoubleByteCharacters)
Returns a zero terminated line of text. If the source encoding is DBCS,


getDocumentLineTop

public static int getDocumentLineTop(LpexView view)
Deprecated. 

Returns the top most line that is not a show line


getDocumentElementTop

public static int getDocumentElementTop(LpexView view)
Returns the top most Element


getDocumentNumberOfLines

public static int getDocumentNumberOfLines(LpexView view)
Method getDocumentNumberOfLines. Retrieve the number of lines in a document

Parameters:
view - the view in which the document is open
Returns:
int the number of lines in a document

getLineText

public static String getLineText(LpexView view,
                                 int iLine)
Deprecated. use _view.elementText(iElement)

Returns the text of the given line. If the codepage is a DBCS codepage, then, shift in, shift out and padding characters are added.


getLineTextDBCS

public static String getLineTextDBCS(LpexView view,
                                     int iLine,
                                     boolean bPadDoubleByteCharacters)
Deprecated. use getElementTextDBCS

Returns a line of text. If the source encoding is DBCS,


getElementTextDBCS

public static String getElementTextDBCS(LpexView view,
                                        int iElement,
                                        boolean bPadDoubleByteCharacters)
Returns a line of text. If the source encoding is DBCS,


getElementStringUpperWithSpace

public static String getElementStringUpperWithSpace(LpexView view,
                                                    int iElement,
                                                    boolean bPadDoubleByteCharacters)
Returns a line of text, upper case it, and padded with blank. D62355 If the source encoding is DBCS,


getMacroLength

public static int getMacroLength(String[] straMacroWords,
                                 String strLine)
Returns the macro length or zero if not a macro


getMacroType

public static int getMacroType(String[] straMacroWords,
                               String strLine)
Returns the macro type


getIFile

public static IFile getIFile(ITextEditor editor)
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

getISeriesConnection

public static IBMiConnection getISeriesConnection(ITextEditor editor)
Method getISeriesConnection. Given a text editor, determine the connection (if any) for the source

Parameters:
editor - the text editor to find the connection for
Returns:
ISeriesConnection the connection found, or null if there is no ISeriesConnection for the source (ie local source)

getISeriesConnection

public static IBMiConnection getISeriesConnection(ITextEditor editor,
                                                  boolean checkProjects)
Method getISeriesConnection. Given a text editor, determine the connection (if any) for the source

Parameters:
editor - the text editor to find the connection for
checkProjects - Whether or not to delegate to i Projects if the file is from the project. Generally the first time we allow the project to be checked, but after that we don't (if projects didn't provide a connection the first time, then there is no reason to re-query).
Returns:
ISeriesConnection the connection found, or null if there is no ISeriesConnection for the source (ie local source)

getISeriesMember

public static IQSYSMember getISeriesMember(ITextEditor editor)
Method getIQSYSMember. Returns the IQSYSMember given the text editor

Parameters:
editor - the editor that the member is open in
Returns:
IQSYSMember the IQSYSMember object for this editor, null if source is not a member

getCommonFilterMenuItems

public static String getCommonFilterMenuItems()
Method getCommonFilterMenuItems. returns the list of common filter items as pairs of (menu string, LpexAction name)

Returns:
String the list of common filter item: By Date

getParserForPrimaryLpexView

public static IISeriesEditorParser getParserForPrimaryLpexView(LpexTextEditor editor)
Determine the parser for the primary lpex view for the lpex editor

Parameters:
editor -
Returns:
parser

getRecordLength

public static int getRecordLength(LpexView view)
Method getRecordLength. Returns the record length for the source

Parameters:
view - the view which contains the source
Returns:
int the record length, 0 if there is no record length (ie local file)

getRunnableContext

public static IRunnableContext getRunnableContext()
Returns a progress monitor context.


getRPGILEAutoIndentValue

public static int getRPGILEAutoIndentValue()
get RPG ILE auto indent preference value

Returns:
0-20

getSignature

public static String getSignature()
Get the signature

Returns:
null if signature not enabled, otherwise 5 character signature

getSQLLength

public static int getSQLLength(String[] straSQLWords,
                               String strLine)
Returns the length of the SQL word, or zero if not an SQL word


hasSemicolon

public static boolean hasSemicolon(String strLine)
Check for any semi-colon before a comment Port of evfritok.c, semiFound D62355 - also need to check if a "//" is inside a quote. then it will not be counted as comment eg. "insert into mylib/myfile (fld1) values('ab // cde'); "


indentRPGILECFreeOpcode

public static boolean indentRPGILECFreeOpcode(String strOpcode)
determines if the opcode should have the following line indented

Returns:
true if should indent

initializeBasePreferences

public static void initializeBasePreferences(LpexView view,
                                             IISeriesEditorParser parser)
Method initializeBasePreferences. initializes the base parser preferences and applies it to the view

Parameters:
view - the view used to apply the preferences to
parser - the parser for the view

enableMultipleViews

public static void enableMultipleViews(LpexView view)
Enable multiple views in LPEX Editor

Parameters:
view -

isCFEnd

public static boolean isCFEnd(String strLine)
Returns true if CF-Spec start


isCFComment

public static boolean isCFComment(String strElement)
Returns true if it is a CF Comment line. D62355


isCFStart

public static boolean isCFStart(String strLine)
Returns true if CF-Spec end


isSQLStart

public static boolean isSQLStart(String strLine)
Returns true if start of SQL Statement


isSQLEnd

public static boolean isSQLEnd(String strLine)
Returns true if end of SQL Statement


isCFSQLStart

public static boolean isCFSQLStart(LpexView view,
                                   int iElement)
Returns true if start of SQL Statement in C free-form and source type is SQLRPGLE. D62355 - Don't need to check the source extension.


isCFSQLStart

public static boolean isCFSQLStart(String strLine)
Returns true if start of SQL Statement in C free-form and source type is SQLRPGLE. D62355 - Don't need to check the source extension.


nonBlankInColumn6Or7

public static boolean nonBlankInColumn6Or7(String strElement)
Returns true if either of column 6 or 7 is not. D62355


isData

public static boolean isData(String[] straDataWords,
                             String strLine)
Returns true if line is a DATA statement


isExtendedFactorTwoOpcode

public static boolean isExtendedFactorTwoOpcode(String[] straXF2_opcodes,
                                                String[] straXF2_possible_opcodes,
                                                String strLine)
Returns whether 'C' line an extended Factor2 C spec. XF2_opcodes contains the list of opcodes which could take an extended factor 2. (such as CALLP, EVAL, EVALR, RETURN etc.) note: "FOR " is in list instead of "FOR" to account for "FORCE" XF2_possible_opcodes contains the list of opcodes which could or could not take an an extended factor 2 depending on what follows it. Therefore, if the opcode falls into this category, you have to look at the next character to determine whether or not it can take an extended factor 2 (such as DOWxx, DOUxx, IFxx, WHENxx) OUTPUT: returns TRUE if the opcode can take an extended factor 2 FALSE otherwise.


isMacro

public static boolean isMacro(String[] straMacroWords,
                              String strLine)

isNumeric

public static boolean isNumeric(String strNumeric)
Returns whether a string is base 10 numeric.


isPrimaryLpexView

public static boolean isPrimaryLpexView(LpexView lpexView)
Returns if Lpex view is the primary view

Returns:
true if it is the primary view

getLpexEditor

public static LpexTextEditor getLpexEditor()
Returns the active lpex editor, or null if there isn't one.


getLpexEditorForPrimaryView

public static LpexTextEditor getLpexEditorForPrimaryView(LpexView view)
Retrieves the editor object that has the specified primary view

Parameters:
view - the primary view to search for the editor object
Returns:
The editor object that the view belongs to.

getAllLpexViews

public static LpexView[] getAllLpexViews(LpexTextEditor editor)
Retrieves a list of all the view open in an editor.

Parameters:
editor - the editor to retrieve the view.
Returns:
an array of LpexView. If the view was not split, then there will only be the primary view in the list.
Since:
6.0 57887A

getPrimaryLpexView

public static LpexView getPrimaryLpexView(LpexTextEditor editor)
Used to retrieve the primary view in an editor

Parameters:
editor - the editor to search for a primary view
Returns:
the primary view if found, null otherwise
Since:
6.0 57887A

refreshAllViews

public static void refreshAllViews(LpexTextEditor editor)
This method refreshs all the views open in an editor.

It is needed because adding text programmatically (ie wizards)to one view doesn't trigger a parse in all the views.

Parameters:
editor - The editor to refresh all its view.
Since:
6.0 57887A

isSlashComment

public static boolean isSlashComment(String strLine,
                                     int iIndex)
Parameters:
strLine -
iIndex -
Returns:

isSQL

public static boolean isSQL(String[] straSQLWords,
                            String strLine)
Returns true if line is an SQL statement


isSQL

public static boolean isSQL(String[] straSQLWords,
                            LpexView view,
                            int iElement)
Returns true if line is an SQL statement (convenient for the caller, so it does not need to get the string of a line first) cmvc64662


isWhiteSpace

public static boolean isWhiteSpace(char c)
Returns whether a character is white space


outdentRPGILECFreeOpcode

public static boolean outdentRPGILECFreeOpcode(String strOpcode)
determines if the opcode should have the current line outdented

Returns:
true if should outdent

prependLineWithSignature

public static String prependLineWithSignature(String strLine)
Prepend line with signature (if enabled)

Returns:
updated line

refreshBasePreferences

public static void refreshBasePreferences(LpexView view)
Method refreshBasePreferences. refreshes the base parser preferences and applies them to the specified view

Parameters:
view - the view to apply the preferences to

setDocumentLineText

public static void setDocumentLineText(LpexView view,
                                       int iLine,
                                       String strLine)
Deprecated. 

Associates the text with the editor element line Removes the null at the end of the string


setDocumentElementText

public static void setDocumentElementText(LpexView view,
                                          int iElement,
                                          String strElement)
Associates the text with the editor element line Removes the null at the end of the string


setElementColors

public static void setElementColors(LpexView view,
                                    int iElement,
                                    String strStyles,
                                    boolean bFixedLengthFields)
Sets an Lpex element's color style.


setEncoding

public static int setEncoding(LpexTextEditor editor,
                              LpexView view,
                              boolean allowPrompting)
Method setEncoding. Sets the encoding for a view

Parameters:
view - the view to set the encoding
editor - the editor for the view
allowPrompting - allow this to prompt for a connection if not in the ifile
Since:
6.0.1 ES BIDI support in editor

setEncoding

public static void setEncoding(LpexView view,
                               int iCCSID)
Method setEncoding. Sets the encoding for a view based on the CCSID

Parameters:
view - the view to set the encoding
iCCSID - the ccsid to convert

setLineColors

public static void setLineColors(LpexView view,
                                 int iLine,
                                 String strStyles,
                                 boolean bFixedLengthFields)
Deprecated. 

Sets an Lpex line's color style.


setMessageElementColors

public static void setMessageElementColors(LpexView view,
                                           int iElement,
                                           String strStyles)
Sets the style colours for a message element where everything is in Unicode, so no DBCS considerations are applied.


getHostConnectionForLocalFile

public static IBMiConnection getHostConnectionForLocalFile(boolean bPromptAllowed)
Method getHostConnectionForLocalFile. Helper method to retrieve a connection to use for a local file

Parameters:
bPromptAllowed - whether or not the user should be prompted
Returns:
ISeriesConnection the connection specified by the user.

COBOLgetFieldFile

public static IQSYSFile COBOLgetFieldFile(LpexView view,
                                          IISeriesEditorParser parser)
Method COBOLgetFieldFile. Does the getFieldFile logic for all COBOL parsers

Parameters:
view - the view that the show fields action is running in
parser - the parser for the view
Returns:
ISeriesFile the file to show fields

COBOLisValidFieldAction

public static boolean COBOLisValidFieldAction(LpexView view)
Method COBOLisValidFieldAction. returns whether or not the show fields action is valid for a COBOL source

Parameters:
view - the view that the source is open in
Returns:
boolean true if show fields can be run

COBOLisValidIncludeAction

public static boolean COBOLisValidIncludeAction(LpexView view)
Method COBOLisValidIncludeAction. returns whether or not copy book can be edited or browsed for a COBOL source

Parameters:
view - the view that the source is open in
Returns:
boolean true if the action is valid, false otherwise

COBOLgetIncludeMember

public static IQSYSMember COBOLgetIncludeMember(LpexView view,
                                                IISeriesEditorParser parser,
                                                boolean ILE)
Method COBOLgetIncludeMember.

Parameters:
view -
parser -
ILE -
Returns:
ISeriesMember

getParseFilePath

public static IPath getParseFilePath(IFile sourceFile)

getParseFilePath

public static IPath getParseFilePath(IFile sourceFile,
                                     int mode)

getParseFileURL

public static URL getParseFileURL(IFile sourceFile)

ensureVisible

public static void ensureVisible(LpexView lpexView,
                                 int element)

setHighlightRange

public static void setHighlightRange(LpexTextEditor _editor,
                                     LpexView _view,
                                     int iLineOrigin,
                                     int iLineExtent)
Highlight the range of lines that correspond to the select language construct.

Parameters:
editor - LpexTextEditor within which to select the text
view - LpexView containing text to select
iLineOrigin - first line of higlighted range (ONE-based)
iLineExtent - number of lines in highlighted range

selectionLinesChanged

public static void selectionLinesChanged(LpexTextEditor _editor,
                                         LpexView _view,
                                         int iLineOrigin,
                                         int iLineExtent,
                                         int iLineCursor,
                                         int startPosition,
                                         int selectedLength)
Called when the selection has changed in the content outline view. The line numbers are used to highlight the editor's vertical ruler.

Parameters:
editor - - LpexTextEditor within which to select the text
view - - LpexView containing text to select
iLineOrigin - - begin of higlighted range
iLineExtent - - number of lines in highlighted range
iLineCursor - - cursored line
startPosition - - column of begin of selection

positionCursor

public static void positionCursor(LpexTextEditor _editor,
                                  LpexView _view,
                                  int iLineCursor,
                                  int startPosition,
                                  int selectedLength)
Called when the selection has changed in the content outline view. The line numbers are used to highlight the editor's vertical ruler.

Parameters:
editor - - LpexTextEditor within which to select the text
view - - LpexView containing text to select
iLineOrigin - - begin of higlighted range
iLineExtent - - number of lines in highlighted range
iLineCursor - - cursored line
startPosition - - column of begin of selection

selectionLinesChanged

public static void selectionLinesChanged(LpexTextEditor _editor,
                                         int iLineOrigin,
                                         int iLineExtent,
                                         int iLineCursor,
                                         int startPosition,
                                         int selectedLength)
Called when the selection has changed in the content outline view. Convenience method that selects text in the active view of the given editor

Parameters:
editor - - LpexTextEditor within which to select the text
view - - LpexView containing text to select
iLineCursor - - cursored line
startPosition - - column of begin of selection
selectedLength - - length of selection

addEditorInfo

public static void addEditorInfo(LpexTextEditor editor,
                                 int iCCSID,
                                 IBMiConnection connection)
Stores the editor info for retrieval when Saving As.

Parameters:
editor - The editor to store information for
iCCSID - The CCSID to store
connection - The connection to store
Since:
6.0.1.1

getEditorInfo

public static Vector getEditorInfo(LpexTextEditor editor)
Retrieves the editor information (CCSID & Connection). Returns null if no information stored.

Parameters:
editor - The editor to retrieve the information for.
Returns:
A vector which contains the CCSID & connection. Null if no info is stored for the editor
Since:
6.0.1.1

removeEditorInfo

public static void removeEditorInfo(LpexTextEditor editor)
Cleans up information for the editor. Called during terminate parser. The cleanup only occurs if the editor is no longer open, which allows the information to remain during Save As processing.

Parameters:
editor - The editor to cleanup info for.
Since:
6.0.1.1

addBiDirectionalMarkers

public static void addBiDirectionalMarkers(LpexView view,
                                           int iElement,
                                           int startRTLpos,
                                           int endRTLpos,
                                           int startNumberpos)
Add bidirectional markers if needed to the source

Parameters:
view -
iElement -
startRTLpos - - column to start looking for a RTL character
endRTLpos - - column to stop looking for a RTL character
startNumberpos - - column to check if a number exists (must be larger than startRTLpos)
Since:
6.0.1 60039

isIFSFile

public static boolean isIFSFile(IFile iFile)
Returns true if is an IFS file, false otherwise Defect 61409


issueLpexMessage

public static void issueLpexMessage(LpexTextEditor editor,
                                    String message,
                                    Throwable exception)
Display error message on editor message line as well as in the log file

Parameters:
message - - String containing log message
exception - - that caused the error condition

showBlockNesting

public static void showBlockNesting(LpexView view,
                                    boolean showNesting)

indexOfStringNotInsideAQuote

public static int indexOfStringNotInsideAQuote(String inputString,
                                               String stringToFind,
                                               char quote)

printLineClassesValue

public static void printLineClassesValue(int startElement,
                                         int endElement,
                                         LpexView view)

printLineStyles

public static void printLineStyles(int startElement,
                                   int endElement,
                                   LpexView view)

getFirstNonBlankLineUp

public static int getFirstNonBlankLineUp(int fromElement,
                                         int toElement,
                                         LpexView view,
                                         boolean skipSlashSlashComment,
                                         boolean insideNewLineCreationAction,
                                         long classForwardLink,
                                         long classBackwardLink)
This element will find the last element in a CFree block. D62355 changed by defect 65338


getFirstNonBlankLineDown

public static int getFirstNonBlankLineDown(int fromElement,
                                           int toElement,
                                           LpexView view,
                                           boolean skipSlashSlashComment)
This element will find the last element in a CFree block. Xuan


skipFixFormComment

public static int skipFixFormComment(LpexView view,
                                     int iElement)

open

public static IEditorPart open(Shell shell,
                               String projectName,
                               String remoteMemberName)
                        throws SystemMessageException
Open the specified member in the default editor for that member type. The search order for finding the member is the same search order used by the program verifiers:
  1. The specified iSeries project
  2. Any iSeries projects referenced by the specified project. The referenced projects are searched in the order they are returned from the IProject.getReferencedProjects() api.
  3. The remote object from the iSeries
the member exists in the specified project then it is opened from the project, otherwise the remote copy of the member is opened.

Parameters:
shell - A valid shell used to display the progress monitor when downloading the member (if required) and opening the editor.
project - A valid iSeries project name
member - The name of the member in library/file(member) syntax
Returns:
The IEditorPart with the member opened in the editor, or null if the member could not be opened in an editor.
Throws:
SystemMessageException

open

public static IEditorPart open(Shell shell,
                               String projectName,
                               String remoteMemberName,
                               boolean openIfClosed)
                        throws SystemMessageException
Throws:
SystemMessageException

open

public static QSYSEditableRemoteSourceFileMember open(Shell shell,
                                                      IBMiConnection connection,
                                                      String libName,
                                                      String fileName,
                                                      String mbrName)
                                               throws SystemMessageException,
                                                      InterruptedException
Opens a given member member in the integrated LPEX editor. Static version.

Parameters:
shell - The shell needed to host the logon prompt dialog, if needed. Can be null, in which case the currently active workbench shell is used.
connection - An ISeriesConnection object. If you only have a SystemConnection object, then use the static getConnection(SystemConnection) method in ISeriesConnection
libName - Library containing the file containing the member
fileName - File containing the member
mbrName - Name of the member to open
Returns:
null if the member doesn't exist, else an object representing the local editable copy of it.
Throws:
InterruptedException
SystemMessageException

browse

public static QSYSEditableRemoteSourceFileMember browse(Shell shell,
                                                        IBMiConnection connection,
                                                        String libName,
                                                        String fileName,
                                                        String mbrName)
                                                 throws SystemMessageException,
                                                        InterruptedException
Opens a given member member in the integrated LPEX editor, in browse mode. Static version.

Parameters:
shell - The shell needed to host the logon prompt dialog, if needed. Can be null, in which case the currently active workbench shell is used.
connection - An ISeriesConnection object. If you only have a SystemConnection object, then use the static getConnection(SystemConnection) method in ISeriesConnection
libName - Library containing the file containing the member
fileName - File containing the member
mbrName - Name of the member to open
Returns:
null if the member doesn't exist, else an object representing the local editable copy of it.
Throws:
InterruptedException
SystemMessageException

openEditable

public static void openEditable(QSYSEditableRemoteSourceFileMember editable,
                                String objectName)

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.