public class JavaQuoteHandler extends SimpleTokenSetQuoteHandler implements JavaLikeQuoteHandler, MultiCharQuoteHandler
myLiteralTokenSet| Constructor and Description |
|---|
JavaQuoteHandler() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.CharSequence |
getClosingQuote(HighlighterIterator iterator,
int offset)
Returns a closing quote for an opening quote placed immediately before offset, or
null when there is no matching quote. |
TokenSet |
getConcatenatableStringTokenTypes() |
java.lang.String |
getStringConcatenationOperatorRepresentation() |
TokenSet |
getStringTokenTypes() |
boolean |
hasNonClosedLiteral(Editor editor,
HighlighterIterator iterator,
int offset)
Called after the quote has been inserted in the editor to check that it belongs
to an empty string literal that has only the opening quote and therefore, can be completed
by inserting the respective closing one.
|
void |
insertClosingQuote(Editor editor,
int offset,
PsiFile file,
java.lang.CharSequence closingQuote)
Should insert the
closingQuote returned from MultiCharQuoteHandler.getClosingQuote(HighlighterIterator, int) into the document. |
boolean |
isAppropriateElementTypeForLiteral(IElementType tokenType) |
boolean |
isClosingQuote(HighlighterIterator iterator,
int offset)
Checks whether there is the closing quote or the last one of the set of closing quotes
of a string literal at the given offset.
|
boolean |
isOpeningQuote(HighlighterIterator iterator,
int offset)
Checks whether there is the opening quote or the last one of the set of opening quotes
of a string literal at the given offset.
|
boolean |
needParenthesesAroundConcatenation(PsiElement element) |
isInsideLiteral, isNonClosedLiteralclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanBeConcatenatedinsertClosingQuoteisInsideLiteralpublic boolean isOpeningQuote(HighlighterIterator iterator, int offset)
QuoteHandlerisOpeningQuote in interface QuoteHandlerisOpeningQuote in class SimpleTokenSetQuoteHandleriterator - highlighting iterator at the state corresponding to the offsetoffset - the offset at which the quote was insertedpublic boolean isClosingQuote(HighlighterIterator iterator, int offset)
QuoteHandlerUpon insertion, this method is called before the quote is actually inserted in the editor in order to check whether it's going to be typed over an existing one closing a string literal and, thus, should be omitted (only the caret position will be adjusted in this case).
isClosingQuote in interface QuoteHandlerisClosingQuote in class SimpleTokenSetQuoteHandleriterator - highlighting iterator at the state corresponding to the offsetoffset - the offset at which the quote is going to be inserted/deletedpublic TokenSet getConcatenatableStringTokenTypes()
getConcatenatableStringTokenTypes in interface JavaLikeQuoteHandlerpublic java.lang.String getStringConcatenationOperatorRepresentation()
getStringConcatenationOperatorRepresentation in interface JavaLikeQuoteHandlerpublic TokenSet getStringTokenTypes()
getStringTokenTypes in interface JavaLikeQuoteHandlerpublic boolean isAppropriateElementTypeForLiteral(IElementType tokenType)
isAppropriateElementTypeForLiteral in interface JavaLikeQuoteHandlerpublic boolean needParenthesesAroundConcatenation(PsiElement element)
needParenthesesAroundConcatenation in interface JavaLikeQuoteHandlerpublic java.lang.CharSequence getClosingQuote(HighlighterIterator iterator, int offset)
MultiCharQuoteHandlernull when there is no matching quote.getClosingQuote in interface MultiCharQuoteHandlerpublic boolean hasNonClosedLiteral(Editor editor, HighlighterIterator iterator, int offset)
QuoteHandler
If both this method and QuoteHandler.isOpeningQuote(HighlighterIterator, int)
return true, the respective closing quote will be inserted automatically.
hasNonClosedLiteral in interface QuoteHandlerhasNonClosedLiteral in class SimpleTokenSetQuoteHandlereditor - an editor instance where the quote was insertediterator - highlighting iterator at the state corresponding to the offsetoffset - the offset at which the quote was insertedQuoteHandler.isOpeningQuote(HighlighterIterator, int)public void insertClosingQuote(Editor editor, int offset, PsiFile file, java.lang.CharSequence closingQuote)
MultiCharQuoteHandlerclosingQuote returned from MultiCharQuoteHandler.getClosingQuote(HighlighterIterator, int) into the document.
Override this method for languages with multi-root PSI.insertClosingQuote in interface MultiCharQuoteHandler