当前位置: 首页>>代码示例>>Java>>正文


Java TailType.insertChar方法代码示例

本文整理汇总了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, ')');
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:GroovyCompletionUtil.java

示例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, ')');
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:GroovyCompletionUtil.java

示例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);
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:23,代码来源:CSharpStatementCompletionContributor.java

示例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);
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:11,代码来源:SpaceInsertHandler.java


注:本文中的com.intellij.codeInsight.TailType.insertChar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。