public class NbEditorUtilities extends Object
Constructor and Description |
---|
NbEditorUtilities() |
Modifier and Type | Method and Description |
---|---|
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.
|
public static DataObject getDataObject(Document doc)
public static boolean isDocumentActive(Document doc)
public static FileObject getFileObject(Document doc)
public static int[] getIdentifierAndMethodBlock(BaseDocument doc, int offset) throws BadLocationException
BadLocationException
@Deprecated public static Line getLine(BaseDocument doc, int offset, boolean original)
Document
parameter.doc
- document for which the line is being retrievedoffset
- position in the documentoriginal
- whether to retrieve the original line (true) before
the modifications were done or the current line (false)public static Line getLine(Document doc, int offset, boolean original)
doc
- document for which the line is being retrievedoffset
- position in the documentoriginal
- whether to retrieve the original line (true) before
the modifications were done or the current line (false)public static Line getLine(JTextComponent target, boolean original)
public static TopComponent getTopComponent(JTextComponent target)
public static TopComponent getOuterTopComponent(JTextComponent target)
public static void addJumpListEntry(DataObject dob)
public static String[] mergeStringArrays(String[] a1, String[] a2)
public static String getMimeType(Document doc)
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
.doc
- The document to get the mime type for.null
.BaseDocument.MIME_TYPE_PROP
public static String getMimeType(JTextComponent component)
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.component
- The component to get the mime type for.null
.public static void invalidArgument(String bundleKey)