站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

NbEditorUtilities (Editor Module) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor/3 1.32.0

org.netbeans.modules.editor
Class NbEditorUtilities

java.lang.Object
  extended by org.netbeans.modules.editor.NbEditorUtilities

public class NbEditorUtilities
extends Object

Various utilities


Constructor Summary
NbEditorUtilities()
           
 
Method Summary
static void addJumpListEntry(DataObject dob)
          Add the jump-list entry for the for the component that's opened over the given dataobject if any.
static DataObject getDataObject(Document doc)
          Get the dataobject from the document's StreamDescriptionProperty property.
static FileObject getFileObject(Document doc)
          Get the fileobject from the document's StreamDescriptionProperty property.
static int[] getIdentifierAndMethodBlock(BaseDocument doc, int offset)
          This method is a composition of Utilities.getIdentifierBlock() and SyntaxSupport.getFunctionBlock().
static Line getLine(BaseDocument doc, int offset, boolean original)
          Deprecated. Replaced by more generic method having Document parameter.
static Line getLine(Document doc, int offset, boolean original)
          Get the line object from the given position.
static Line getLine(JTextComponent target, boolean original)
          Get the line object from the component's document and caret position
static String getMimeType(Document doc)
          Gets the mime type of a document.
static String getMimeType(JTextComponent component)
          Gets the mime type of a document in JTextComponent.
static TopComponent getOuterTopComponent(JTextComponent target)
          Get the top-component for the target copmonent
static TopComponent getTopComponent(JTextComponent target)
          Get the top-component for the target copmonent
static void invalidArgument(String bundleKey)
          Displays ErrorManager window with the localized message.
static boolean isDocumentActive(Document doc)
          Verify whether the given document is still being actively used by the corresponding editor support.
static String[] mergeStringArrays(String[] a1, String[] a2)
          Merge two string arrays into one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NbEditorUtilities

public NbEditorUtilities()
Method Detail

getDataObject

public static DataObject getDataObject(Document doc)
Get the dataobject from the document's StreamDescriptionProperty property.


isDocumentActive

public static boolean isDocumentActive(Document doc)
Verify whether the given document is still being actively used by the corresponding editor support.


getFileObject

public static FileObject getFileObject(Document doc)
Get the fileobject from the document's StreamDescriptionProperty property.


getIdentifierAndMethodBlock

public static int[] getIdentifierAndMethodBlock(BaseDocument doc,
                                                int offset)
                                         throws BadLocationException
This method is a composition of Utilities.getIdentifierBlock() and SyntaxSupport.getFunctionBlock().

Returns:
null if there's no identifier at the given position. identifier block if there's identifier but it's not a function call. three member array for the case that there is an identifier followed by the function call character. The first two members are members of the identifier block and the third member is the second member of the function block.
Throws:
BadLocationException

getLine

public static Line getLine(BaseDocument doc,
                           int offset,
                           boolean original)
Deprecated. Replaced by more generic method having Document parameter.

Get the line object from the given position.

Parameters:
doc - document for which the line is being retrieved
offset - position in the document
original - whether to retrieve the original line (true) before the modifications were done or the current line (false)
Returns:
the line object

getLine

public static Line getLine(Document doc,
                           int offset,
                           boolean original)
Get the line object from the given position.

Parameters:
doc - document for which the line is being retrieved
offset - position in the document
original - whether to retrieve the original line (true) before the modifications were done or the current line (false)
Returns:
the line object

getLine

public static Line getLine(JTextComponent target,
                           boolean original)
Get the line object from the component's document and caret position


getTopComponent

public static TopComponent getTopComponent(JTextComponent target)
Get the top-component for the target copmonent


getOuterTopComponent

public static TopComponent getOuterTopComponent(JTextComponent target)
Get the top-component for the target copmonent


addJumpListEntry

public static void addJumpListEntry(DataObject dob)
Add the jump-list entry for the for the component that's opened over the given dataobject if any.


mergeStringArrays

public static String[] mergeStringArrays(String[] a1,
                                         String[] a2)
Merge two string arrays into one.


getMimeType

public static String getMimeType(Document doc)
Gets the mime type of a document. If the mime type can't be determined this method will return null. This method should work reliably for Netbeans documents that have their mime type stored in a special property. For any other documents it will probably just return null.

Parameters:
doc - The document to get the mime type for.
Returns:
The mime type of the document or null.
See Also:
NbEditorDocument.MIME_TYPE_PROP

getMimeType

public static String getMimeType(JTextComponent component)
Gets the mime type of a document in JTextComponent. If the mime type can't be determined this method will return null. It tries to determine the document's mime type first and if that does not work it uses mime type from the EditorKit attached to the component.

Parameters:
component - The component to get the mime type for.
Returns:
The mime type of a document opened in the component or null.
Since:
1.29

invalidArgument

public static void invalidArgument(String bundleKey)
Displays ErrorManager window with the localized message. If bundleKey parameter is not founded in bundle it is considered as displayable text value.


org.netbeans.modules.editor/3 1.32.0

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.