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


Java CompletionProcess类代码示例

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


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

示例1: hasTemplatePrefix

import com.intellij.codeInsight.completion.CompletionProcess; //导入依赖的package包/类
public static boolean hasTemplatePrefix(LookupImpl lookup, char shortcutChar) {
  lookup.refreshUi(false, false); // to bring the list model up to date

  CompletionProcess completion = CompletionService.getCompletionService().getCurrentCompletion();
  if (completion == null || !completion.isAutopopupCompletion()) {
    return false;
  }

  if (lookup.isSelectionTouched()) {
    return false;
  }

  final PsiFile file = lookup.getPsiFile();
  if (file == null) return false;

  final Editor editor = lookup.getEditor();
  PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());
  
  return ((TemplateManagerImpl)TemplateManager.getInstance(file.getProject())).prepareTemplate(editor, shortcutChar, null) != null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ChooseItemAction.java

示例2: hasTemplatePrefix

import com.intellij.codeInsight.completion.CompletionProcess; //导入依赖的package包/类
public static boolean hasTemplatePrefix(LookupImpl lookup, char shortcutChar) {
  lookup.refreshUi(false, false); // to bring the list model up to date

  CompletionProcess completion = CompletionService.getCompletionService().getCurrentCompletion();
  if (completion == null || !completion.isAutopopupCompletion()) {
    return false;
  }

  if (lookup.isSelectionTouched()) {
    return false;
  }

  final PsiFile file = lookup.getPsiFile();
  if (file == null) return false;

  final Editor editor = lookup.getEditor();
  final int offset = editor.getCaretModel().getOffset();
  PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());

  final LiveTemplateLookupElement liveTemplateLookup = ContainerUtil.findInstance(lookup.getItems(), LiveTemplateLookupElement.class);
  if (liveTemplateLookup == null || !liveTemplateLookup.sudden) {
    // Lookup doesn't contain sudden live templates. It means that 
    // - there are no live template with given key:
    //    in this case we should find live template with appropriate prefix (custom live templates doesn't participate in this action). 
    // - completion provider worked too long:
    //    in this case we should check custom templates that provides completion lookup.
    if (LiveTemplateCompletionContributor.customTemplateAvailableAndHasCompletionItem(shortcutChar, editor, file, offset)) {
      return true;
    }

    List<TemplateImpl> templates = TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier(editor, file, false);
    TemplateImpl template = LiveTemplateCompletionContributor.findFullMatchedApplicableTemplate(editor, offset, templates);
    if (template != null && shortcutChar == TemplateSettings.getInstance().getShortcutChar(template)) {
      return true;
    }
    return false;
  }

  return liveTemplateLookup.getTemplateShortcut() == shortcutChar;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:ChooseItemAction.java

示例3: hasTemplatePrefix

import com.intellij.codeInsight.completion.CompletionProcess; //导入依赖的package包/类
public static boolean hasTemplatePrefix(LookupImpl lookup, char shortcutChar) {
  lookup.refreshUi(false, false); // to bring the list model up to date

  CompletionProcess completion = CompletionService.getCompletionService().getCurrentCompletion();
  if (completion == null || !completion.isAutopopupCompletion()) {
    return false;
  }

  if (lookup.isSelectionTouched()) {
    return false;
  }

  final PsiFile file = lookup.getPsiFile();
  if (file == null) return false;

  final Editor editor = lookup.getEditor();
  final int offset = editor.getCaretModel().getOffset();
  PsiDocumentManager.getInstance(file.getProject()).commitDocument(editor.getDocument());

  final LiveTemplateLookupElement liveTemplateLookup = ContainerUtil.findInstance(lookup.getItems(), LiveTemplateLookupElement.class);
  if (liveTemplateLookup == null || !liveTemplateLookup.sudden) {
    // Lookup doesn't contain sudden live templates. It means that
    // - there are no live template with given key:
    //    in this case we should find live template with appropriate prefix (custom live templates doesn't participate in this action).
    // - completion provider worked too long:
    //    in this case we should check custom templates that provides completion lookup.
    if (LiveTemplateCompletionContributor.customTemplateAvailableAndHasCompletionItem(shortcutChar, editor, file, offset)) {
      return true;
    }

    List<TemplateImpl> templates = TemplateManagerImpl.listApplicableTemplateWithInsertingDummyIdentifier(editor, file, false);
    TemplateImpl template = LiveTemplateCompletionContributor.findFullMatchedApplicableTemplate(editor, offset, templates);
    if (template != null && shortcutChar == TemplateSettings.getInstance().getShortcutChar(template)) {
      return true;
    }
    return false;
  }

  return liveTemplateLookup.getTemplateShortcut() == shortcutChar;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:ChooseItemAction.java


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