Codota Logo
NbDocument.checkDocParameter
Code IndexAdd Codota to your IDE (free)

How to use
checkDocParameter
method
in
org.openide.text.NbDocument

Best Java code snippets using org.openide.text.NbDocument.checkDocParameter (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Mark part of a document as guarded (immutable to the user).
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as guarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void markGuarded (StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes (offset, len, ATTR_ADD, false);
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Inserts a text into given offset and marks it guarded.
* @param doc document to insert to
* @param offset offset of insertion
* @param txt string text to insert
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void insertGuarded (StyledDocument doc, int offset, String txt)
throws BadLocationException {
  checkDocParameter(doc);        
  doc.insertString (offset, txt, ATTR_ADD);
}
origin: org.netbeans.api/org-openide-text

/** Mark part of a document as guarded (immutable to the user).
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as guarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void markGuarded(StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes(offset, len, ATTR_ADD, false);
}
origin: org.netbeans.api/org-openide-text

/** Inserts a text into given offset and marks it guarded.
* @param doc document to insert to
* @param offset offset of insertion
* @param txt string text to insert
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void insertGuarded(StyledDocument doc, int offset, String txt)
throws BadLocationException {
  checkDocParameter(doc);
  doc.insertString(offset, txt, ATTR_ADD);
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Remove guarded mark on a block of a document.
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as unguarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void unmarkGuarded (StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes (offset, len, ATTR_REMOVE, false);
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Remove guarded mark on a block of a document.
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as unguarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void unmarkGuarded (StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes (offset, len, ATTR_REMOVE, false);
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Inserts a text into given offset and marks it guarded.
* @param doc document to insert to
* @param offset offset of insertion
* @param txt string text to insert
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void insertGuarded (StyledDocument doc, int offset, String txt)
throws BadLocationException {
  checkDocParameter(doc);        
  doc.insertString (offset, txt, ATTR_ADD);
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Mark part of a document as guarded (immutable to the user).
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as guarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void markGuarded (StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes (offset, len, ATTR_ADD, false);
}
origin: org.netbeans.api/org-openide-text

/** Remove guarded mark on a block of a document.
* @param doc styled document
* @param offset offset to start at
* @param len length of text to mark as unguarded
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void unmarkGuarded(StyledDocument doc, int offset, int len) {
  checkDocParameter(doc);
  doc.setCharacterAttributes(offset, len, ATTR_REMOVE, false);
}
origin: org.netbeans.api/org-openide-text

/** Locks the document to have exclusive access to it.
 * Documents implementing {@link Lockable} can specify exactly how to do this.
*
* @param doc document to lock
* @param run the action to run
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void runAtomic(StyledDocument doc, Runnable run) {
  checkDocParameter(doc);
  if (doc instanceof WriteLockable) {
    // use the method
    ((WriteLockable) doc).runAtomic(run);
  } else {
    // transfer the runnable to event dispatch thread
    synchronized (doc) {
      run.run();
    }
  }
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Locks the document to have exclusive access to it.
 * Documents implementing {@link Lockable} can specify exactly how to do this.
*
* @param doc document to lock
* @param run the action to run
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void runAtomic (StyledDocument doc, Runnable run) {
  checkDocParameter(doc);
  if (doc instanceof WriteLockable) {
    // use the method
    ((WriteLockable)doc).runAtomic (run);
  } else {
    // transfer the runnable to event dispatch thread
    synchronized (doc) {
      run.run ();
    }
  }
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Executes given runnable in "user mode" does not allowing any modifications
* to parts of text marked as guarded. The actions should be run as "atomic" so
* either happen all at once or none at all (if a guarded block should be modified).
*
* @param doc document to modify
* @param run runnable to run in user mode that will have exclusive access to modify the document
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
* @exception BadLocationException if a modification of guarded text occured
*   and that is why no changes to the document has been done.
*/
public static void runAtomicAsUser (StyledDocument doc, Runnable run) throws BadLocationException {
  checkDocParameter(doc);
  if (doc instanceof WriteLockable) {
    // use the method
    ((WriteLockable)doc).runAtomicAsUser (run);
  } else {
    // transfer the runnable to event dispatch thread
    synchronized (doc) {
      run.run ();
    }
  }
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Locks the document to have exclusive access to it.
 * Documents implementing {@link Lockable} can specify exactly how to do this.
*
* @param doc document to lock
* @param run the action to run
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static void runAtomic (StyledDocument doc, Runnable run) {
  checkDocParameter(doc);
  if (doc instanceof WriteLockable) {
    // use the method
    ((WriteLockable)doc).runAtomic (run);
  } else {
    // transfer the runnable to event dispatch thread
    synchronized (doc) {
      run.run ();
    }
  }
}
origin: org.netbeans.api/org-openide-text

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
@Deprecated
public static void markNormal(StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle(NORMAL_STYLE_NAME);
  if (st == null) {
    st = doc.addStyle(NORMAL_STYLE_NAME, null);
  }
  if (st != null) {
    doc.setLogicalStyle(offset, st);
  }
}

origin: org.netbeans.api/org-openide-text

/** Find the root element of all lines.
* All conforming NetBeans documents
* should return a valid element.
*
* @param doc styled document (expecting NetBeans document)
* @return the root element
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static Element findLineRootElement(StyledDocument doc) {
  checkDocParameter(doc);
  Element e = doc.getParagraphElement(0).getParentElement();
  if (e == null) {
    // try default root (should work for text/plain)
    e = doc.getDefaultRootElement();
  }
  return e;
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Find the root element of all lines.
* All conforming NetBeans documents
* should return a valid element.
*
* @param doc styled document (expecting NetBeans document)
* @return the root element
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static Element findLineRootElement (StyledDocument doc) {
  checkDocParameter(doc);
  Element e = doc.getParagraphElement (0).getParentElement ();
  if (e == null) {
    // try default root (should work for text/plain)
    e = doc.getDefaultRootElement ();
  }
  return e;
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Find the root element of all lines.
* All conforming NetBeans documents
* should return a valid element.
*
* @param doc styled document (expecting NetBeans document)
* @return the root element
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*/
public static Element findLineRootElement (StyledDocument doc) {
  checkDocParameter(doc);
  Element e = doc.getParagraphElement (0).getParentElement ();
  if (e == null) {
    // try default root (should work for text/plain)
    e = doc.getDefaultRootElement ();
  }
  return e;
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
public static void markNormal (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle (NORMAL_STYLE_NAME);
  if (st == null)
    st = doc.addStyle (NORMAL_STYLE_NAME, null);
  if (st != null) {
    doc.setLogicalStyle (offset, st);
  }
}
origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/**
 * Mark a line as normal (no special attributes).
 * This uses the dummy style named {@link #NORMAL_STYLE_NAME}.
 * This method should be used to undo the effect of {@link #markBreakpoint}, {@link #markError} and {@link #markCurrent}.
 * @param doc the document
 * @param offset identified the line to unmark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
 *
 * @deprecated since 1.20. Use addAnnotation() instead
 */
public static void markNormal (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style st = doc.getStyle (NORMAL_STYLE_NAME);
  if (st == null)
    st = doc.addStyle (NORMAL_STYLE_NAME, null);
  if (st != null) {
    doc.setLogicalStyle (offset, st);
  }
}
origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Marks a line as current (e.g.&nbsp;for the debugger).
* If the document has a defined style named {@link #CURRENT_STYLE_NAME}, it is used.
* Otherwise, a new style is defined.
*
* @param doc the document
* @param offset identifies the line to mark
 * @exception NullPointerException If the <code>doc</code> parameter
 *                                 is <code>null</code>.
*
* @deprecated since 1.20. Use addAnnotation() instead
*/
public static void markCurrent (StyledDocument doc, int offset) {
  checkDocParameter(doc);
  Style bp = doc.getStyle (CURRENT_STYLE_NAME);
  if (bp == null) {
    // create the style
    bp = doc.addStyle (CURRENT_STYLE_NAME, null);
    if (bp == null) return;
    bp.addAttribute (
      StyleConstants.ColorConstants.Background, Color.blue
    );
    bp.addAttribute (
      StyleConstants.ColorConstants.Foreground, Color.white
    );
  }
  doc.setLogicalStyle (offset, bp);
}
org.openide.textNbDocumentcheckDocParameter

Javadoc

Helper method for checking document parameter validity.

Popular methods of NbDocument

  • findLineNumber
    For given document and an offset, find the line number.
  • findLineOffset
    Finds offset of the beginning of a line.
  • findLineColumn
    Finds column number given an offset.
  • findLineRootElement
    Find the root element of all lines. All conforming NetBeans documents should return a valid element.
  • runAtomic
    Locks the document to have exclusive access to it. Documents implementing Lockable can specify exact
  • createPosition
    Creates position with a bias. If the bias is javax.swing.text.Position.Bias#Backwardthen if an inser
  • findRecentEditorPane
    Gets recently selected editor pane opened by editor cookie Can be called from AWT event thread only.
  • addAnnotation
    Add annotation to the document. For annotation of whole line the length parameter can be ignored (sp
  • removeAnnotation
    Removal of added annotation. Note: since 6.35 the requests (delegated to document) are no longer rep
  • findPageable
    Find a way to print a given document. If the document implements the correct interface(s) then the d
  • getDocument
    Get the document associated with a file.Method will throw org.openide.util.UserQuestionExceptionexce
  • markBreakpoint
    Attach a breakpoint to a line in the document. If the document has a defined style named #BREAKPOINT
  • getDocument,
  • markBreakpoint,
  • markCurrent,
  • markError,
  • markNormal,
  • runAtomicAsUser,
  • doOpen,
  • doShow,
  • getEditToBeUndoneRedoneOfType

Popular in Java

  • Finding current android device location
  • findViewById (Activity)
  • getContentResolver (Context)
  • putExtra (Intent)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • BitSet (java.util)
    This class implements a vector of bits that grows as needed. Each component of the bit set has a boo
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now