| java.lang.Object org.netbeans.modules.cnd.editor.cplusplus.BracketCompletion
BracketCompletion | public class BracketCompletion (Code) | | This static class groups the whole aspect of bracket
completion. It is defined to clearly separate the functionality
and keep actions clean.
The methods of the class are called from different actions as
KeyTyped, DeletePreviousChar.
|
Inner Class :static class MyTokenProcessor implements TokenProcessor | |
Method Summary | |
static void | charBackspaced(BaseDocument doc, int dotPos, Caret caret, char ch) Hook called after a character *ch* was backspace-deleted from
doc*. | static void | charInserted(BaseDocument doc, int dotPos, Caret caret, char ch) A hook method called after a character was inserted into the
document. | static int | getRowOrBlockEnd(BaseDocument doc, int caretOffset) Returns position of the first unpaired closing paren/brace/bracket from the caretOffset
till the end of caret row. | static boolean | isAddRightBrace(BaseDocument doc, int caretOffset) Resolve whether pairing right curly should be added automatically
at the caret position or not.
There must be only whitespace or line comment or block comment
between the caret position
and the left brace and the left brace must be on the same line
where the caret is located.
The caret must not be "contained" in the opened block comment token.
Parameters: doc - document in which to operate. Parameters: caretOffset - offset of the caret. | static boolean | isSkipClosingBracket(BaseDocument doc, int caretOffset, TokenID bracketId) Check whether the typed bracket should stay in the document
or be removed. | static boolean | isUnclosedStringAtLineEnd(BaseDocument doc, int dotPos, TokenID[] tokenIDs) | static boolean | matchIDs(TokenID toCheck, TokenID[] checkWith) | static boolean | posWithinAnyQuote(BaseDocument doc, int dotPos) | static boolean | posWithinQuotes(BaseDocument doc, int dotPos, char quote, TokenID[] tokenIDs) Generalized posWithingString to any token and delimiting
character. | static boolean | posWithinString(BaseDocument doc, int dotPos) posWithinString(doc, pos) iff position *pos* is within a string
literal in document doc. |
charBackspaced | static void charBackspaced(BaseDocument doc, int dotPos, Caret caret, char ch) throws BadLocationException(Code) | | Hook called after a character *ch* was backspace-deleted from
doc*. The function possibly removes bracket or quote pair if
appropriate.
Parameters: doc - the document Parameters: dotPos - position of the change Parameters: caret - caret Parameters: ch - the character that was deleted |
charInserted | static void charInserted(BaseDocument doc, int dotPos, Caret caret, char ch) throws BadLocationException(Code) | | A hook method called after a character was inserted into the
document. The function checks for special characters for
completion ()[]'"{} and other conditions and optionally performs
changes to the doc and or caret (complets braces, moves caret,
etc.)
Parameters: doc - the document where the change occurred Parameters: dotPos - position of the character insertion Parameters: caret - caret Parameters: ch - the character that was inserted throws: BadLocationException - if dotPos is not correct |
getRowOrBlockEnd | static int getRowOrBlockEnd(BaseDocument doc, int caretOffset) throws BadLocationException(Code) | | Returns position of the first unpaired closing paren/brace/bracket from the caretOffset
till the end of caret row. If there is no such element, position after the last non-white
character on the caret row is returned.
|
isAddRightBrace | static boolean isAddRightBrace(BaseDocument doc, int caretOffset) throws BadLocationException(Code) | | Resolve whether pairing right curly should be added automatically
at the caret position or not.
There must be only whitespace or line comment or block comment
between the caret position
and the left brace and the left brace must be on the same line
where the caret is located.
The caret must not be "contained" in the opened block comment token.
Parameters: doc - document in which to operate. Parameters: caretOffset - offset of the caret. true if a right brace '}' should be addedor false if not. |
isSkipClosingBracket | static boolean isSkipClosingBracket(BaseDocument doc, int caretOffset, TokenID bracketId) throws BadLocationException(Code) | | Check whether the typed bracket should stay in the document
or be removed.
This method is called by skipClosingBracket() .
Parameters: doc - document into which typing was done. Parameters: caretOffset - |
isUnclosedStringAtLineEnd | static boolean isUnclosedStringAtLineEnd(BaseDocument doc, int dotPos, TokenID[] tokenIDs)(Code) | | |
matchIDs | static boolean matchIDs(TokenID toCheck, TokenID[] checkWith)(Code) | | |
posWithinAnyQuote | static boolean posWithinAnyQuote(BaseDocument doc, int dotPos)(Code) | | |
posWithinQuotes | static boolean posWithinQuotes(BaseDocument doc, int dotPos, char quote, TokenID[] tokenIDs)(Code) | | Generalized posWithingString to any token and delimiting
character. It works for tokens are delimited by *quote* and
extend up to the other *quote* or whitespace in case of an
incomplete token.
Parameters: doc - the document Parameters: dotPos - position to be tested |
posWithinString | static boolean posWithinString(BaseDocument doc, int dotPos)(Code) | | posWithinString(doc, pos) iff position *pos* is within a string
literal in document doc.
Parameters: doc - the document Parameters: dotPos - position to be tested |
|
|