• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AutoPopupController类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(InsertionContext context) {
  PsiFile file = context.getFile();
  boolean addDot = !(file instanceof PsiJavaCodeReferenceCodeFragment) || ((PsiJavaCodeReferenceCodeFragment)file).isClassesAccepted();
  if (addDot) {
    context.setAddCompletionChar(false);
    TailType.DOT.processTail(context.getEditor(), context.getTailOffset());
  }
  if (addDot || context.getCompletionChar() == '.') {
    AutoPopupController.getInstance(context.getProject()).scheduleAutoPopup(context.getEditor());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:PackageLookupItem.java


示例17: 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(new Runnable() {
        @Override
        public void run() {
          EditorModificationUtil.deleteSelectedText(editor);
        }
      });
    }
    return Result.STOP;
  }

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

  return Result.CONTINUE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:CompletionAutoPopupHandler.java


示例18: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(final InsertionContext context) {
  LookupElement item = getDelegate();
  Project project = context.getProject();
  Editor editor = context.getEditor();

  PsiDocumentManager.getInstance(project).commitAllDocuments();

  TextRange range = myState.getCurrentVariableRange();
  final TemplateLookupSelectionHandler handler = item.getUserData(TemplateLookupSelectionHandler.KEY_IN_LOOKUP_ITEM);
  if (handler != null && range != null) {
    handler.itemSelected(item, context.getFile(), context.getDocument(), range.getStartOffset(), range.getEndOffset());
  }
  else {
    super.handleInsert(context);
  }

  if (context.getCompletionChar() == '.') {
    EditorModificationUtil.insertStringAtCaret(editor, ".");
    AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, null);
    return;
  }

  if (!myState.isFinished()) {
    myState.calcResults(true);
  }

  myState.nextTab();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:TemplateExpressionLookupElement.java


示例19: handleInsert

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void handleInsert(InsertionContext context, LookupElement item) {
  super.handleInsert(context, item);
  if (hasParams(context, item)) {
    AutoPopupController.getInstance(context.getProject()).autoPopupParameterInfo(context.getEditor(), (PyFunction) item.getObject());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyFunctionInsertHandler.java


示例20: invoke

import com.intellij.codeInsight.AutoPopupController; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project,
                   @NotNull PsiFile file,
                   @Nullable("is null when called from inspection") final Editor editor,
                   @NotNull PsiElement startElement,
                   @NotNull PsiElement endElement) {
  final XmlAttribute attribute = PsiTreeUtil.getNonStrictParentOfType(startElement, XmlAttribute.class);
  if (attribute == null || attribute.getValue() != null) {
    return;
  }

  if (!FileModificationService.getInstance().prepareFileForWrite(attribute.getContainingFile())) {
    return;
  }

  new WriteCommandAction(project) {
    @Override
    protected void run(@NotNull final Result result) {
      final XmlAttribute attributeWithValue = XmlElementFactory.getInstance(getProject()).createXmlAttribute(attribute.getName(), "");
      final PsiElement newAttribute = attribute.replace(attributeWithValue);
      
      if (editor != null && newAttribute != null && newAttribute instanceof XmlAttribute && newAttribute.isValid()) {
        final XmlAttributeValue valueElement = ((XmlAttribute)newAttribute).getValueElement();
        if (valueElement != null) {
          editor.getCaretModel().moveToOffset(valueElement.getTextOffset());
          AutoPopupController.getInstance(newAttribute.getProject()).scheduleAutoPopup(editor);
        }
      }
    }
  }.execute();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:AddAttributeValueIntentionFix.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CouchDbClient类代码示例发布时间:2022-05-21
下一篇:
Java JWTDecodeException类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap