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


Java HaxeComponentIndex类代码示例

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


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

示例1: getClassesByName

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
@NotNull
protected List<PsiClass> getClassesByName(final String name,
                                          final boolean checkBoxState,
                                          final String pattern,
                                          final GlobalSearchScope searchScope) {
  List<HaxeComponent> components = HaxeComponentIndex.getItemsByName(name, getProject(), searchScope);
  List<PsiClass> classes = new ArrayList<PsiClass>();

  for (HaxeComponent component : components) {
    if (component instanceof PsiClass) {
      classes.add((PsiClass)component);
    }
  }

  return classes;
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:17,代码来源:TreeHaxeClassChooserDialog.java

示例2: addVariantsFromIndex

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
private static void addVariantsFromIndex(final CompletionResultSet resultSet,
                                         final PsiFile targetFile,
                                         @Nullable String prefixPackage,
                                         @Nullable final InsertHandler<LookupElement> insertHandler) {
  final Project project = targetFile.getProject();
  final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(targetFile);
  final MyProcessor processor = new MyProcessor(resultSet, prefixPackage, insertHandler);
  HaxeComponentIndex.processAll(project, processor, scope);

  if (insertHandler != null) {
    targetFile.acceptChildren(new HaxeRecursiveVisitor() {
      @Override
      public void visitImportStatement(@NotNull HaxeImportStatement importStatement) {
        final List<HaxeModel> exposedMembers = importStatement.getModel().getExposedMembers();
        final String alias = importStatement.getAlias() != null ? importStatement.getAlias().getText() : null;

        for (HaxeModel member : exposedMembers) {
          LookupElementBuilder lookupElement = createLookupElement(member, alias);
          if (lookupElement != null) resultSet.addElement(lookupElement);
          if (alias != null) return;
        }
      }
    });
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:26,代码来源:HaxeClassNameCompletionContributor.java

示例3: findTestsForClass

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
@NotNull
@Override
public Collection<PsiElement> findTestsForClass(@NotNull PsiElement element) {
  final HaxeClass haxeClass = findSourceElement(element);
  if (haxeClass == null) {
    return Collections.emptyList();
  }
  final Collection<PsiElement> result = new THashSet<PsiElement>();
  final Pair<String, String> packageAndName = HaxeResolveUtil.splitQName(haxeClass.getQualifiedName());
  final GlobalSearchScope searchScope = GlobalSearchScope.projectScope(element.getProject());
  result.addAll(HaxeComponentIndex.getItemsByName(packageAndName.getSecond() + "Test", element.getProject(), searchScope));
  result.addAll(HaxeComponentIndex.getItemsByName("Test" + packageAndName.getSecond(), element.getProject(), searchScope));
  return result;
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:15,代码来源:HaxeTestFinder.java

示例4: getItemsByName

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
@NotNull
@Override
public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
  final GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
  final Collection<HaxeComponent> result = HaxeComponentIndex.getItemsByName(name, project, scope);
  return result.toArray(new NavigationItem[result.size()]);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:8,代码来源:HaxeClassContributor.java

示例5: tryCreateAnnotation

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
private void tryCreateAnnotation(HaxeReferenceExpression expression) {
  final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(expression);
  final List<HaxeComponent> components =
    HaxeComponentIndex.getItemsByName(expression.getText(), expression.getProject(), scope);
  if (!components.isEmpty()) {
    myHolder.createErrorAnnotation(expression, HaxeBundle.message("haxe.unresolved.type"))
      .registerFix(new HaxeTypeAddImportIntentionAction(expression, components));
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:10,代码来源:HaxeTypeAnnotator.java

示例6: doTest

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
public void doTest() {
  final PsiFile file = PsiDocumentManager.getInstance(myFixture.getProject()).getPsiFile(myFixture.getEditor().getDocument());
  assertNotNull(file);
  final HaxeType type = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), HaxeType.class, false);
  assertNotNull(type);
  final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(type);
  new HaxeTypeAddImportIntentionAction(type, HaxeComponentIndex
    .getItemsByName(type.getReferenceExpression().getText(), type.getProject(), scope))
    .execute();
  FileDocumentManager.getInstance().saveAllDocuments();
  myFixture.checkResultByFile(getTestName(false) + ".txt");
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:13,代码来源:HaxeTypeAddImportIntentionActionTest.java

示例7: addVariantsFromIndex

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
private static void addVariantsFromIndex(final CompletionResultSet resultSet,
                                         final PsiFile targetFile,
                                         @Nullable String prefixPackage,
                                         @Nullable final InsertHandler<LookupElement> insertHandler) {
  final Project project = targetFile.getProject();
  final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(targetFile);
  HaxeComponentIndex.processAll(project, new MyProcessor(resultSet, prefixPackage, insertHandler), scope);
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:9,代码来源:HaxeClassNameCompletionContributor.java

示例8: doTest

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
public void doTest() {
  final PsiFile file = PsiDocumentManager.getInstance(myFixture.getProject()).getPsiFile(myFixture.getEditor().getDocument());
  assertNotNull(file);
  final HaxeType type = PsiTreeUtil.getParentOfType(file.findElementAt(myFixture.getCaretOffset()), HaxeType.class, false);
  assertNotNull(type);
  final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(type);
  new HaxeTypeAddImportIntentionAction(type, HaxeComponentIndex
    .getItemsByName(type.getReferenceExpression().getText(), type.getProject(), scope))
    .execute();
  myFixture.checkResultByFile(getTestName(false) + ".txt");
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:12,代码来源:HaxeTypeAddImportIntentionActionTest.java

示例9: processTransferableData

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
@Override
public void processTransferableData(Project project, Editor editor, RangeMarker marker, int caretOffset, Ref<Boolean> indented, List<HaxeTextBlockTransferableData> values) {
  PsiDocumentManager.getInstance(project).commitAllDocuments();
  final PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
  if (file == null) {
    return;
  }
  int[] startOffsets = new int[]{marker.getStartOffset()};
  int[] endOffsets = new int[]{marker.getEndOffset()};

  List<String> haxeClassList = new ArrayList<String>();

  String qualifiedName;
  for (int j = 0; j < startOffsets.length; j++) {
    final int startOffset = startOffsets[j];
    for (final PsiElement element : CollectHighlightsUtil.getElementsInRange(file, startOffset, endOffsets[j])) {
      if (element instanceof HaxeReferenceExpression) {
        HaxeReferenceExpression referenceExpression = (HaxeReferenceExpression)element;

        if (referenceExpression.resolve() == null) {
          final GlobalSearchScope scope = HaxeResolveUtil.getScopeForElement(referenceExpression);
          final List<HaxeComponent> components =
            HaxeComponentIndex.getItemsByName(referenceExpression.getText(), project, scope);
          if (!components.isEmpty() && components.size() == 1) {
            qualifiedName = ((HaxeClass)components.get(0)).getQualifiedName();
            if (!haxeClassList.contains(qualifiedName)) {
              haxeClassList.add(qualifiedName);
            }
          }
        }
      }
    }
  }

  if (haxeClassList.isEmpty()) {
    return;
  }

  HaxeRestoreReferencesDialog dialog = new HaxeRestoreReferencesDialog(project, ArrayUtil.toStringArray(haxeClassList));
  dialog.show();
  String[] selectedObjects = dialog.getSelectedElements();

  for (final String object : selectedObjects) {
    new WriteCommandAction(project, file) {
      @Override
      protected void run(@NotNull Result result) throws Throwable {
        HaxeAddImportHelper.addImport(object, file);
      }
    }.execute();
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:52,代码来源:HaxeReferenceCopyPasteProcessor.java

示例10: getNames

import com.intellij.plugins.haxe.ide.index.HaxeComponentIndex; //导入依赖的package包/类
@NotNull
@Override
public String[] getNames(Project project, boolean includeNonProjectItems) {
  final Collection<String> result = HaxeComponentIndex.getNames(project);
  return ArrayUtil.toStringArray(result);
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:7,代码来源:HaxeClassContributor.java


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