LPEX
3.6.8

com.ibm.lpex.core
Class Utilities

java.lang.Object
  extended by com.ibm.lpex.core.Utilities

public final class Utilities
extends Object

Various LPEX internal-use (non-API) utilities.


Method Summary
static void addStatusLineListener(LpexWindow lpexWindow, StatusLineListener listener)
           
static void commentUncommentCobolLines(LpexView lpexView, int commentOffset, boolean comment)
          Implements CobolParser's comment and uncomment actions.
static String currentPopupMenu(LpexView lpexView)
          Returns the current value for building the pop-up menu for the view.
static int fullTextToTextPosition(LpexView lpexView, int element, int position)
          Could be made public API?!
static int getBaseline(LpexView lpexView)
           
static LpexDocumentLocation getTextLocationAtPoint(LpexView lpexView, int x, int y)
          Returns the document position at the given coordinates inside the text of this view's text window.
static int notifyTruncateDocument(LpexView lpexView, LpexDocumentListener listener, int textLimit)
          Issues document-listener notifications for the text-limit truncation of a document as done during save.
static void notifyTruncateDocumentRestore(LpexView lpexView, LpexDocumentListener listener, int textLimit, int firstTruncatedElement)
          Issues document-listener notifications to restore the changes resulting from the text-limit truncation of a document as done during save.
static void processLpexKey(LpexView lpexView, String lpexKey)
           
static void profileChanged()
           
static void removeStatusLineListener(LpexWindow lpexWindow, StatusLineListener listener)
           
static void resetText(LpexView lpexView, String text, boolean keepEnvironment)
          Like LpexView#setText(text), but tries to keep the same edit environment.
static void setProfileHandler(ProfileHandler profileHandler)
           
static int textToFullTextPosition(LpexView lpexView, int element, int position)
          Could be made public API?!
static void unnumber(LpexView lpexView, boolean trim)
          Implements RDz LPEX Editor's UNNUMBER command.
static boolean updateText(LpexView lpexView, int line, int position, int deleteToLine, int deleteToPosition, String text)
          SWT JLPEX alef.DocumentAdapter call to update LPEX text from stream-oriented IDocument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

updateText

public static boolean updateText(LpexView lpexView,
                                 int line,
                                 int position,
                                 int deleteToLine,
                                 int deleteToPosition,
                                 String text)
SWT JLPEX alef.DocumentAdapter call to update LPEX text from stream-oriented IDocument.

Parameters:
line - line
position - full-text position
deleteToLine - 1st delete-to line
deleteToPosition - 1st delete-to full-text position
text - 2nd [full] text to insert

resetText

public static void resetText(LpexView lpexView,
                             String text,
                             boolean keepEnvironment)
Like LpexView#setText(text), but tries to keep the same edit environment. Could be made public API?!


addStatusLineListener

public static void addStatusLineListener(LpexWindow lpexWindow,
                                         StatusLineListener listener)

removeStatusLineListener

public static void removeStatusLineListener(LpexWindow lpexWindow,
                                            StatusLineListener listener)

textToFullTextPosition

public static int textToFullTextPosition(LpexView lpexView,
                                         int element,
                                         int position)
Could be made public API?!


fullTextToTextPosition

public static int fullTextToTextPosition(LpexView lpexView,
                                         int element,
                                         int position)
Could be made public API?!


getBaseline

public static int getBaseline(LpexView lpexView)

processLpexKey

public static void processLpexKey(LpexView lpexView,
                                  String lpexKey)

currentPopupMenu

public static String currentPopupMenu(LpexView lpexView)
Returns the current value for building the pop-up menu for the view. This includes *dynamically*-added menu items (which do not appear in "current.popup"), shown for special cases such as the "Compare" submenu when this view is in a compare session.


getTextLocationAtPoint

public static LpexDocumentLocation getTextLocationAtPoint(LpexView lpexView,
                                                          int x,
                                                          int y)
Returns the document position at the given coordinates inside the text of this view's text window.

If the x coordinate of the point is beyond the center of a character, the returned position is after that character.

Returns:
null if there are no visible elements / the given point is not inside the text

notifyTruncateDocument

public static int notifyTruncateDocument(LpexView lpexView,
                                         LpexDocumentListener listener,
                                         int textLimit)
Issues document-listener notifications for the text-limit truncation of a document as done during save. No actual changes are done in the LPEX document.

During a save operation, text elements saved to the file are truncated to the text-limit value in effect, under these conditions:

Returns:
the first truncated text element in the document, or 0 if no truncations needed
See Also:
notifyTruncateDocumentRestore(com.ibm.lpex.core.LpexView, com.ibm.lpex.core.LpexDocumentListener, int, int)

notifyTruncateDocumentRestore

public static void notifyTruncateDocumentRestore(LpexView lpexView,
                                                 LpexDocumentListener listener,
                                                 int textLimit,
                                                 int firstTruncatedElement)
Issues document-listener notifications to restore the changes resulting from the text-limit truncation of a document as done during save. No actual changes are done in the LPEX document.

See Also:
notifyTruncateDocument(com.ibm.lpex.core.LpexView, com.ibm.lpex.core.LpexDocumentListener, int)

commentUncommentCobolLines

public static void commentUncommentCobolLines(LpexView lpexView,
                                              int commentOffset,
                                              boolean comment)
Implements CobolParser's comment and uncomment actions. Comments are indicated by a '*' or '/' in column 7.

Parameters:
commentOffset - comment's offset in the element
comment - true = add line comments, or false = remove line comments from the start of the line's text

setProfileHandler

public static void setProfileHandler(ProfileHandler profileHandler)

profileChanged

public static void profileChanged()

unnumber

public static void unnumber(LpexView lpexView,
                            boolean trim)
Implements RDz LPEX Editor's UNNUMBER command. For the *exclusive* use of this editor.


LPEX
3.6.8

Copyright © 2013 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.