LPEX
3.6.6

com.ibm.lpex.core
Class LpexUtilities

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

public final class LpexUtilities
extends Object

This class implements various utilities which have dependency on a particular development platform and/or operating system. This implementation is for SWT LPEX, the Eclipse technology version of the editor.


Method Summary
static Widget commandLineFocusWidget(LpexView lpexView)
          Returns the command line widget with the input focus, if any.
static FontData[] fontDataFromString(String fontDataString)
          Returns the array of SWT FontData objects described by the given fontDataString.
static String fontDataToString(FontData[] fontData)
          Returns a string representation of the given array of SWT FontData objects.
static int getPlatform()
          Returns the underlying development platform of this LPEX widget.
static String getUserHomeDirectory()
          Returns the default directory for LPEX settings.
static boolean okToUse(Widget widget)
          Query whether the specified SWT Widget is usable.
static void setHelp(MenuItem menuItem, String contextHelpId)
          Sets the context help for a menu item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPlatform

public static int getPlatform()
Returns the underlying development platform of this LPEX widget.

Returns:
LpexConstants.PLATFORM_SWT - Eclipse (SWT)

okToUse

public static boolean okToUse(Widget widget)
Query whether the specified SWT Widget is usable.

Parameters:
widget - the Widget to check
Returns:
false if the widget is null or disposed

commandLineFocusWidget

public static Widget commandLineFocusWidget(LpexView lpexView)
Returns the command line widget with the input focus, if any. This information is not available from the FocusEvent notifications of a FocusListener on the command line, as these events' widget field is set to the command-line Composite.


getUserHomeDirectory

public static String getUserHomeDirectory()
Returns the default directory for LPEX settings. See also the defaultProfile and editorLog parameters.

This directory is platform dependent. It is assembled using the "user.home" Java system property. This is the resulting path on various platforms:

   Windows XP, 2000:
     %SystemDrive%:\Documents and Settings\<userid>\Application Data\IBM\LpexEditor
   Windows NT:
     %SystemDrive%:\\Profiles\<userid>\Application Data\IBM\LpexEditor
   Unix:
     /home/<userid>/.ibm/LpexEditor 

Editor applications may use a different directory.

Returns:
the OS-dependent path for saving the application settings

fontDataToString

public static String fontDataToString(FontData[] fontData)
Returns a string representation of the given array of SWT FontData objects. The string representation has the form "FontData;FontData". It only includes the non-null entries.

Parameters:
fontData - an array of one or more FontData objects
See Also:
fontDataFromString(java.lang.String)

fontDataFromString

public static FontData[] fontDataFromString(String fontDataString)
Returns the array of SWT FontData objects described by the given fontDataString. The string is in the form "FontData;FontData".

Parameters:
fontDataString - string representation of one or more FontData objects, or null if incorrect fontDataString
See Also:
fontDataToString(FontData[])

setHelp

public static void setHelp(MenuItem menuItem,
                           String contextHelpId)
Sets the context help for a menu item. The current implementation of this method assumes an LPEX instance running inside the Eclipse workbench, and a context-help id defined in the LPEX Editor plug-in.


LPEX
3.6.6

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