本文整理汇总了Java中com.intellij.codeInsight.TailType.insertChar方法的典型用法代码示例。如果您正苦于以下问题:Java TailType.insertChar方法的具体用法?Java TailType.insertChar怎么用?Java TailType.insertChar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.codeInsight.TailType
的用法示例。
在下文中一共展示了TailType.insertChar方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRParenth
import com.intellij.codeInsight.TailType; //导入方法依赖的package包/类
public static int addRParenth(Editor editor, int oldTail, boolean space_within_cast_parentheses) {
int offset = -1;
final HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(oldTail);
while (!iterator.atEnd()) {
final IElementType tokenType = iterator.getTokenType();
if (TokenSets.WHITE_SPACES_OR_COMMENTS.contains(tokenType)) {
iterator.advance();
continue;
}
if (tokenType == GroovyTokenTypes.mRPAREN) {
offset = iterator.getEnd();
}
break;
}
if (offset != -1) return offset;
offset = oldTail;
if (space_within_cast_parentheses) {
offset = TailType.insertChar(editor, oldTail, ' ');
}
return TailType.insertChar(editor, offset, ')');
}
示例2: addRParenth
import com.intellij.codeInsight.TailType; //导入方法依赖的package包/类
public static int addRParenth(Editor editor, int oldTail, boolean space_within_cast_parentheses) {
int offset = -1;
final HighlighterIterator iterator = ((EditorEx)editor).getHighlighter().createIterator(oldTail);
while (!iterator.atEnd()) {
final IElementType tokenType = iterator.getTokenType();
if (WHITE_SPACES_OR_COMMENTS.contains(tokenType)) {
iterator.advance();
continue;
}
if (tokenType == mRPAREN) {
offset = iterator.getEnd();
}
break;
}
if (offset != -1) return offset;
offset = oldTail;
if (space_within_cast_parentheses) {
offset = TailType.insertChar(editor, oldTail, ' ');
}
return TailType.insertChar(editor, offset, ')');
}
示例3: handleInsert
import com.intellij.codeInsight.TailType; //导入方法依赖的package包/类
@Override
public void handleInsert(InsertionContext insertionContext, LookupElement item)
{
Editor editor = insertionContext.getEditor();
int offset = editor.getCaretModel().getOffset();
boolean isVoidReturnType = DotNetTypeRefUtil.isVmQNameEqual(myPseudoMethod.getReturnTypeRef(), myPseudoMethod, DotNetTypes.System.Void);
if(!isVoidReturnType)
{
TailType.insertChar(editor, offset, ' ');
TailType.insertChar(editor, offset + 1, ';');
}
else
{
TailType.insertChar(editor, offset, ';');
}
insertionContext.getEditor().getCaretModel().moveToOffset(offset + 1);
if(!isVoidReturnType)
{
AutoPopupController.getInstance(editor.getProject()).autoPopupMemberLookup(editor, null);
}
}
示例4: handleInsert
import com.intellij.codeInsight.TailType; //导入方法依赖的package包/类
@Override
public void handleInsert(InsertionContext context, LookupElement item)
{
if(context.getCompletionChar() != ' ')
{
int tailOffset = context.getTailOffset();
TailType.insertChar(context.getEditor(), tailOffset, ' ');
context.getEditor().getCaretModel().moveToOffset(tailOffset + 1);
}
}