Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

oracle.ide.util
Class IdeUtil

java.lang.Object
  extended by oracle.ide.util.IdeUtil

public final class IdeUtil
extends java.lang.Object


Method Summary
static void addAll(java.util.Collection target, java.util.Iterator toAdd)
          Adds all objects in the Iterator to target.
static void addAll(java.util.Collection target, java.lang.Object[] toAdd)
          Adds all objects in toAdd to target.
static void addComboBoxDocumentListener(javax.swing.JComboBox jcomboBox, javax.swing.event.DocumentListener documentListener)
           
static void centerTreeSelection(javax.swing.JTree tree)
          Centers the current tree selection within its scroll pane.
static void centerWindow(java.awt.Container parent, java.awt.Component child)
          Center a component over another.
static void comboBoxSelectItem(javax.swing.JComboBox comboBox, java.lang.Object item)
           
static boolean containsAny(java.util.AbstractCollection set, java.util.Collection collection)
           
static java.lang.String[] convertStringToStringArray(java.lang.String s)
           
static java.lang.String[] convertStringToStringArray(java.lang.String s, boolean allowQuotedStrings, boolean keepQuotes)
           
static void copyToClipboard(java.lang.String s)
           
static java.lang.String decodeHTMLReservedCharacters(java.lang.String s)
          Replaces the HTML reserved characters that have been previously encoded with the appropriate entity.
static void expandAllTreeRows(javax.swing.JTree tree)
          Expands all the rows in the specified JTree.
static void expandTreeToDepth(javax.swing.JTree tree, int depth)
          Expands the rows in the specified JTree up to the specified tree depth; all other rows are collapsed.
static java.awt.Window findActiveModalWindow()
          Finds the window in the container hierarchy which is visible, modal and active.
static java.awt.Dialog findDialog(java.awt.Component component)
          Finds the first parent of the specified Component that is an instance of Dialog.
static java.awt.Frame findFrame(java.awt.Component component)
           
static java.lang.String getDigitsFromString(java.lang.String inString)
          Takes a string and strips out any non-digit characters and returns an int
static java.lang.String getDocumentVersion(java.net.URL url)
          Deprecated. since 11.0 with no replacement. This API is product specific and should not be in the IDE api.
static java.lang.String getIdeEncoding()
          Retrieves the IDE-wide encoding.
static java.lang.String getIdeIanaEncoding()
          Retrieves the IDE-wide IANA encoding.
static java.awt.Frame getMainWindow()
           
static java.lang.String getProgramName()
           
static java.lang.String getProgramShortName()
           
static java.lang.String getSubString(java.lang.String sIn, char c, boolean bBefore)
          Returns the string before the first occurence of c if bBefore is true or the string after the first occurence of c if bBefore is false
static javax.swing.Icon grayIcon(javax.swing.Icon icon)
           
static void invokeAfterRepaint(java.lang.Runnable runnable)
          Deprecated. This method was introduced to fix the "gray rectangle" problem in Swing. Now the issue is fixed in Java 1.6 (sun bug no: 4967886), we no longer need this method. Clients are requested to use SwingUtilities.invokeLater if they feel the need to use this method. For now, this method is same as SwingUtilities.invokeLater. If the runnable is is doing lots of processing or significant work in the event dispatch thread, then it should happen in a separate thread. Clients can use SwingWorker for that.
static boolean isHeadless()
          Use to determine if the Ide is running in headless mode
static boolean isJavaIdentifier(java.lang.String name)
          Returns true if the specified String is a valid Java identifier.
static boolean isJavaKeyword(java.lang.String name)
          Returns true if the specified String is a Java keyword.
static boolean isJavaReservedWord(java.lang.String name)
          Returns true if the specified String is a Java reserved word.
static boolean isPackageIdentifier(java.lang.String name)
          Returns true if the specified String is a valid package identifier.
static java.lang.String list2String(java.util.List list)
           
static java.awt.Window modalDialogOwner()
          Finds the window in the container hierarchy which is visible, modal and active.
static java.awt.Component moveFocusAway()
          Since the JDK sends inconsistent focus messages when a focused component is removed from the screen, it is often necessary to move that focus away before to move a component to another container or to remove the component.
static java.lang.String prepad(java.lang.String s, char c, int len)
          Return a string where the beginning of the string has been padded to obtain a desired length.
static java.lang.String removeChars(java.lang.String sIn, java.lang.String sRemove)
          Return a sIn without any character found is sRemove
static java.lang.String replaceHTMLReservedCharacters(java.lang.String s)
          Replaces the HTML reserved characters with the appropriate entity.
static void runNow(java.lang.Runnable r)
           
static void setIdeEncoding(java.lang.String encoding)
          Sets the IDE-wide encoding.
static void setMainWindow(javax.swing.JFrame frame)
           
static void setProgramName(java.lang.String name)
           
static void setProgramShortName(java.lang.String name)
           
static void setStartupWindow(javax.swing.JFrame frame)
          The startup window is a JFrame upon which dialogs and other UI may be parented before the showing of the main window.
static void string2List(java.lang.String string, java.util.List list)
           
static void tryToRestoreFocus(java.awt.Component cPreferred)
          This method tries to set the focus on cPreferred.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

centerWindow

public static void centerWindow(java.awt.Container parent,
                                java.awt.Component child)
Center a component over another. If parent is null, the component is centered over the screen.


centerTreeSelection

public static void centerTreeSelection(javax.swing.JTree tree)
Centers the current tree selection within its scroll pane. If the specified JTree is null or is not hosted in a JScrollPane, the this method does nothing.

Parameters:
tree - The JTree whose selection is to be centered.

expandAllTreeRows

public static void expandAllTreeRows(javax.swing.JTree tree)
Expands all the rows in the specified JTree. This method assumes that the JTree is in single-selection mode; if any row was selected prior to expanding all rows, then that row will remain selected after all rows have been expanded.


expandTreeToDepth

public static void expandTreeToDepth(javax.swing.JTree tree,
                                     int depth)
Expands the rows in the specified JTree up to the specified tree depth; all other rows are collapsed. The depth of a row is defined as the length of the TreePath's path for that row.

This method assumes that the JTree is in single-selection mode; if any row was selected prior to expanding all rows, then that row will remain selected after all rows have been expanded.

Parameters:
tree - the JTree to expand.
depth - the desired expansion depth; a depth of <=0 expands all rows in the tree.

findDialog

public static java.awt.Dialog findDialog(java.awt.Component component)
Finds the first parent of the specified Component that is an instance of Dialog. If the component itself is a Dialog, then it is returned. If the component is null then null is returned.


findFrame

public static java.awt.Frame findFrame(java.awt.Component component)

isJavaKeyword

public static boolean isJavaKeyword(java.lang.String name)
Returns true if the specified String is a Java keyword.

Parameters:
name - the String to test.

isJavaReservedWord

public static boolean isJavaReservedWord(java.lang.String name)
Returns true if the specified String is a Java reserved word. A Java reserved word is either a keyword, a boolean literal, or the null literal.

Parameters:
name - the String to test.

isJavaIdentifier

public static boolean isJavaIdentifier(java.lang.String name)
Returns true if the specified String is a valid Java identifier.

Parameters:
name - the String to test.

isPackageIdentifier

public static boolean isPackageIdentifier(java.lang.String name)
Returns true if the specified String is a valid package identifier.


list2String

public static java.lang.String list2String(java.util.List list)

string2List

public static void string2List(java.lang.String string,
                               java.util.List list)

convertStringToStringArray

public static java.lang.String[] convertStringToStringArray(java.lang.String s)

convertStringToStringArray

public static java.lang.String[] convertStringToStringArray(java.lang.String s,
                                                            boolean allowQuotedStrings,
                                                            boolean keepQuotes)

getSubString

public static java.lang.String getSubString(java.lang.String sIn,
                                            char c,
                                            boolean bBefore)
Returns the string before the first occurence of c if bBefore is true or the string after the first occurence of c if bBefore is false


removeChars

public static java.lang.String removeChars(java.lang.String sIn,
                                           java.lang.String sRemove)
Return a sIn without any character found is sRemove


prepad

public static java.lang.String prepad(java.lang.String s,
                                      char c,
                                      int len)
Return a string where the beginning of the string has been padded to obtain a desired length.

Parameters:
s - the String to pad.
c - the character to use when padding.
len - the desired length of the string.

addAll

public static void addAll(java.util.Collection target,
                          java.lang.Object[] toAdd)
Adds all objects in toAdd to target.

Parameters:
target - the Collection to which the elements are added.
toAdd - the objects to add to the target. Cannot be null.

addAll

public static void addAll(java.util.Collection target,
                          java.util.Iterator toAdd)
Adds all objects in the Iterator to target.

Parameters:
target - the Collection to which the elements are added.
toAdd - the objects to add to the target. Cannot be null.

containsAny

public static boolean containsAny(java.util.AbstractCollection set,
                                  java.util.Collection collection)
Returns:
true if the set contains any of the objects in the collection

getDocumentVersion

public static java.lang.String getDocumentVersion(java.net.URL url)
Deprecated. since 11.0 with no replacement. This API is product specific and should not be in the IDE api.

Reads the header information of the file pointed to by the given url and determines the version number. If the document is an XML file, the version number is taken from the XML namespace URI, assuming that the namespace URI follows the format used by JDeveloper. A namespace URI is expected to a have a format like this: http://xmlns.oracle.com/jdeveloper/#####/... where ##### is the version string and ... is any text after the version string to identify the specific document type.

Returns:
the version string in the document or null if the version could not be determined. Note that if the file pointed to by the url does not exists, this method assumes this is a new file that will be written using the current product version.

addComboBoxDocumentListener

public static void addComboBoxDocumentListener(javax.swing.JComboBox jcomboBox,
                                               javax.swing.event.DocumentListener documentListener)

comboBoxSelectItem

public static void comboBoxSelectItem(javax.swing.JComboBox comboBox,
                                      java.lang.Object item)

grayIcon

public static javax.swing.Icon grayIcon(javax.swing.Icon icon)

runNow

public static void runNow(java.lang.Runnable r)

copyToClipboard

public static void copyToClipboard(java.lang.String s)

getMainWindow

public static java.awt.Frame getMainWindow()

setMainWindow

public static void setMainWindow(javax.swing.JFrame frame)

setStartupWindow

public static void setStartupWindow(javax.swing.JFrame frame)
The startup window is a JFrame upon which dialogs and other UI may be parented before the showing of the main window.


getProgramName

public static java.lang.String getProgramName()

setProgramName

public static void setProgramName(java.lang.String name)

getProgramShortName

public static java.lang.String getProgramShortName()

setProgramShortName

public static void setProgramShortName(java.lang.String name)

getIdeEncoding

public static java.lang.String getIdeEncoding()
Retrieves the IDE-wide encoding.


setIdeEncoding

public static void setIdeEncoding(java.lang.String encoding)
Sets the IDE-wide encoding.


getIdeIanaEncoding

public static java.lang.String getIdeIanaEncoding()
Retrieves the IDE-wide IANA encoding.


replaceHTMLReservedCharacters

public static java.lang.String replaceHTMLReservedCharacters(java.lang.String s)
Replaces the HTML reserved characters with the appropriate entity. (Encodes the string for HTML) Specifically it finds '>' '<' '&' '&' with the appropriate encoded character sequence

Parameters:
s - string to decode
Returns:
string with any reserved characters decoded

decodeHTMLReservedCharacters

public static java.lang.String decodeHTMLReservedCharacters(java.lang.String s)
Replaces the HTML reserved characters that have been previously encoded with the appropriate entity. (Decodes the string for HTML). Specifically it finds ">" "<" "&" """ with the appropriate character.

Parameters:
s - string to decode
Returns:
string with any reserved characters decoded

moveFocusAway

public static java.awt.Component moveFocusAway()
Since the JDK sends inconsistent focus messages when a focused component is removed from the screen, it is often necessary to move that focus away before to move a component to another container or to remove the component. This method moves the focus to the menu bar.

Returns:
the component that had the focus.
See Also:
tryToRestoreFocus(java.awt.Component)

tryToRestoreFocus

public static void tryToRestoreFocus(java.awt.Component cPreferred)
This method tries to set the focus on cPreferred. If cPreferred is null, not visible or disabled, it will focus the top editor. If there is no editor, it tries to activate the first dockable. If there is no dockable visible, it will focus the main window.

See Also:
moveFocusAway()

modalDialogOwner

public static final java.awt.Window modalDialogOwner()
Finds the window in the container hierarchy which is visible, modal and active. If no such window was found, returns the main window.

Returns:
the active modal window.
Since:
11.1.1

findActiveModalWindow

public static final java.awt.Window findActiveModalWindow()
Finds the window in the container hierarchy which is visible, modal and active.

Returns:
the window, or null if no active modal windows were found.

getDigitsFromString

public static java.lang.String getDigitsFromString(java.lang.String inString)
Takes a string and strips out any non-digit characters and returns an int

Parameters:
inString -
Returns:
string of the digits found in inString

invokeAfterRepaint

@Deprecated
public static void invokeAfterRepaint(java.lang.Runnable runnable)
Deprecated. This method was introduced to fix the "gray rectangle" problem in Swing. Now the issue is fixed in Java 1.6 (sun bug no: 4967886), we no longer need this method. Clients are requested to use SwingUtilities.invokeLater if they feel the need to use this method. For now, this method is same as SwingUtilities.invokeLater. If the runnable is is doing lots of processing or significant work in the event dispatch thread, then it should happen in a separate thread. Clients can use SwingWorker for that.

This method is similar to SwingUtilities.invokeLater(Runnable) except that the runnable is started after all the pending repaints.

Parameters:
runnable -
See Also:
SwingUtils.invokeAfterRepaint(java.lang.Runnable)

isHeadless

public static boolean isHeadless()
Use to determine if the Ide is running in headless mode

Returns:
true if the Ide is running in headless mode; false otherwise

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.4.0)

E13403-05

Copyright © 1997, 2011, Oracle. All rights reserved.