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


Java AutoPopupController类代码示例

本文整理汇总了Java中com.intellij.codeInsight.AutoPopupController的典型用法代码示例。如果您正苦于以下问题:Java AutoPopupController类的具体用法?Java AutoPopupController怎么用?Java AutoPopupController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AutoPopupController类属于com.intellij.codeInsight包,在下文中一共展示了AutoPopupController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(InsertionContext context) {
  if (getObject() instanceof PsiVariable && context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR) {
    context.commitDocument();
    replaceMethodCallIfNeeded(context);
  }
  context.commitDocument();
  myPosition = getPosition(context, this);

  TailType tailType = computeTailType(context);

  super.handleInsert(context);

  if (tailType == TailType.COMMA) {
    AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SmartCompletionDecorator.java

示例2: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
public void handleInsert(InsertionContext context, LookupElement item) {
  Editor editor = context.getEditor();
  if (context.getCompletionChar() == ' ') return;
  Project project = editor.getProject();
  if (project != null) {
    if (!isCharAtSpace(editor)) {
      EditorModificationUtil.insertStringAtCaret(editor, " ");
      PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
    }
    else {
      editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + 1);
    }
    if (myTriggerAutoPopup) {
      AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:AddSpaceInsertHandler.java

示例3: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
public void handleInsert(InsertionContext context, LookupElement item) {
  final Editor editor = context.getEditor();
  final Document document = editor.getDocument();
  if (context.getCompletionChar() == '(') {
    context.setAddCompletionChar(false);
    final int offset = context.getTailOffset();
    document.insertString(offset, "()");

    PyClass pyClass = (PyClass) item.getObject();
    PyFunction init = pyClass.findInitOrNew(true, null);
    if (init != null && PyFunctionInsertHandler.hasParams(context, init)) {
      editor.getCaretModel().moveToOffset(offset+1);
      AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), init);
    }
    else {
      editor.getCaretModel().moveToOffset(offset+2);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PyClassInsertHandler.java

示例4: charTyped

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public Result charTyped(char c, Project project, @NotNull Editor editor, @NotNull PsiFile file) {
  if (needToInsertQuotes) {
    int offset = editor.getCaretModel().getOffset();
    PsiElement fileContext = file.getContext();
    String toInsert= "\"\"";

    if(fileContext != null) {
      if (fileContext.getText().startsWith("\"")) toInsert = "''";
    }
    editor.getDocument().insertString(offset, toInsert);
    editor.getCaretModel().moveToOffset(offset + 1);
    AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
  }
  needToInsertQuotes = false;
  return super.charTyped(c, project, editor, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XmlEqTypedHandler.java

示例5: charTyped

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public Result charTyped(char c, Project project, @NotNull Editor editor, @NotNull PsiFile file) {
  if (c == '?' && file.getLanguage() == XMLLanguage.INSTANCE) {
    int offset = editor.getCaretModel().getOffset();
    if (offset >= 2 && editor.getDocument().getCharsSequence().charAt(offset - 2) == '<') {
      PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
      PsiElement at = file.findElementAt(offset - 2);
      if (at != null && at.getNode().getElementType() == XmlTokenType.XML_PI_START &&
          editor.getDocument().getText().indexOf("?>", offset) == -1) {

        editor.getDocument().insertString(offset, " ?>");
        AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
      }
    }
  }
  return super.charTyped(c, project, editor, file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XmlPiTypedHandler.java

示例6: checkAutoPopup

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public Result checkAutoPopup(
    char charTyped, final Project project, final Editor editor, final PsiFile file) {
  if (!(file instanceof BuildFile)) {
    return Result.CONTINUE;
  }
  if (LookupManager.getActiveLookup(editor) != null) {
    return Result.CONTINUE;
  }

  if (charTyped != '/' && charTyped != ':') {
    return Result.CONTINUE;
  }
  PsiElement psi = file.findElementAt(editor.getCaretModel().getOffset());
  if (psi != null && psi.getParent() instanceof StringLiteral) {
    AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
    return Result.STOP;
  }
  return Result.CONTINUE;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:21,代码来源:BuildCompletionAutoPopupHandler.java

示例7: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的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

示例8: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
public void handleInsert(InsertionContext context, LookupElement item) {
  Editor editor = context.getEditor();
  char completionChar = context.getCompletionChar();
  if (completionChar == ' ' || StringUtil.containsChar(myIgnoreOnChars, completionChar)) return;
  Project project = editor.getProject();
  if (project != null) {
    if (!isCharAtSpace(editor)) {
      EditorModificationUtil.insertStringAtCaret(editor, " ");
      PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
    }
    else if (shouldOverwriteExistingSpace(editor)) {
      editor.getCaretModel().moveToOffset(editor.getCaretModel().getOffset() + 1);
    }
    if (myTriggerAutoPopup) {
      AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:AddSpaceInsertHandler.java

示例9: checkAutoPopup

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public Result checkAutoPopup(char charTyped, final Project project, final Editor editor, final PsiFile file) {
  LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(editor);

  if (LOG.isDebugEnabled()) {
    LOG.debug("checkAutoPopup: character=" + charTyped + ";");
    LOG.debug("phase=" + CompletionServiceImpl.getCompletionPhase());
    LOG.debug("lookup=" + lookup);
    LOG.debug("currentCompletion=" + CompletionServiceImpl.getCompletionService().getCurrentCompletion());
  }

  if (lookup != null) {
    if (editor.getSelectionModel().hasSelection()) {
      lookup.performGuardedChange(() -> EditorModificationUtil.deleteSelectedText(editor));
    }
    return Result.STOP;
  }

  if (Character.isLetter(charTyped) || charTyped == '_') {
    AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
    return Result.STOP;
  }

  return Result.CONTINUE;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:CompletionAutoPopupHandler.java

示例10: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(InsertionContext context)
{
	if(getObject() instanceof PsiVariable && context.getCompletionChar() == Lookup.REPLACE_SELECT_CHAR)
	{
		context.commitDocument();
		replaceMethodCallIfNeeded(context);
	}
	context.commitDocument();
	myPosition = getPosition(context, this);

	TailType tailType = computeTailType(context);

	super.handleInsert(context);

	if(tailType == TailType.COMMA)
	{
		AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), null);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:21,代码来源:SmartCompletionDecorator.java

示例11: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(final InsertionContext context, LookupElement lookupElement)
{
	context.commitDocument();

	TailType tailType = getTailType(context.getCompletionChar(), (LookupItem) lookupElement);

	final Editor editor = context.getEditor();
	editor.getCaretModel().moveToOffset(context.getSelectionEndOffset());
	tailType.processTail(editor, context.getSelectionEndOffset());
	editor.getSelectionModel().removeSelection();

	if(tailType == TailType.DOT || context.getCompletionChar() == '.')
	{
		AutoPopupController.getInstance(context.getProject()).autoPopupMemberLookup(editor, null);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:18,代码来源:DefaultInsertHandler.java

示例12: checkAutoPopup

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public Result checkAutoPopup(char charTyped, Project project, Editor editor, PsiFile file) {
    if (!(file instanceof LuaPsiFile)) return Result.CONTINUE;

    if (charTyped == ':' || charTyped == '.') {
      AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
      return Result.STOP;
    }

    return Result.CONTINUE;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:12,代码来源:LuaAutoPopupHandler.java

示例13: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(final InsertionContext context, LookupElement lookupElement) {
  context.commitDocument();

  TailType tailType = getTailType(context.getCompletionChar(), (LookupItem)lookupElement);

  final Editor editor = context.getEditor();
  editor.getCaretModel().moveToOffset(context.getSelectionEndOffset());
  tailType.processTail(editor, context.getSelectionEndOffset());
  editor.getSelectionModel().removeSelection();

  if (tailType == TailType.DOT || context.getCompletionChar() == '.') {
    AutoPopupController.getInstance(context.getProject()).autoPopupMemberLookup(editor, null);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:DefaultInsertHandler.java

示例14: autoPopupMemberLookup

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
private static void autoPopupMemberLookup(Project project, final Editor editor) {
  AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition<PsiFile>() {
    @Override
    public boolean value(final PsiFile file) {
      int offset = editor.getCaretModel().getOffset();

      PsiElement lastElement = file.findElementAt(offset - 1);
      if (lastElement == null) {
        return false;
      }

      //do not show lookup when typing varargs ellipsis
      final PsiElement prevSibling = PsiTreeUtil.prevVisibleLeaf(lastElement);
      if (prevSibling == null || ".".equals(prevSibling.getText())) return false;
      PsiElement parent = prevSibling;
      do {
        parent = parent.getParent();
      } while(parent instanceof PsiJavaCodeReferenceElement || parent instanceof PsiTypeElement);
      if (parent instanceof PsiParameterList || parent instanceof PsiParameter) return false;

      if (!".".equals(lastElement.getText()) && !"#".equals(lastElement.getText())) {
        return JavaClassReferenceCompletionContributor.findJavaClassReference(file, offset - 1) != null;
      }
      else{
        final PsiElement element = file.findElementAt(offset);
        return element == null ||
               !"#".equals(lastElement.getText()) ||
               PsiTreeUtil.getParentOfType(element, PsiDocComment.class) != null;
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:JavaTypedHandler.java

示例15: autoPopupJavadocLookup

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
private static void autoPopupJavadocLookup(final Project project, final Editor editor) {
  AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition<PsiFile>() {
    @Override
    public boolean value(PsiFile file) {
      int offset = editor.getCaretModel().getOffset();

      PsiElement lastElement = file.findElementAt(offset - 1);
      return lastElement != null && StringUtil.endsWithChar(lastElement.getText(), '@');
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaTypedHandler.java


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