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


Java ContainerUtil.toArray方法代码示例

本文整理汇总了Java中com.intellij.util.containers.ContainerUtil.toArray方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtil.toArray方法的具体用法?Java ContainerUtil.toArray怎么用?Java ContainerUtil.toArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.util.containers.ContainerUtil的用法示例。


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

示例1: resolve

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public ResolveResult[] resolve(@NotNull AntDomPropertyReference antDomPropertyReference, boolean incompleteCode) {
  final List<ResolveResult> result = new ArrayList<ResolveResult>();
  final AntDomProject project = antDomPropertyReference.myInvocationContextElement.getParentOfType(AntDomProject.class, true);
  if (project != null) {
    final AntDomProject contextAntProject = project.getContextAntProject();
    final String propertyName = antDomPropertyReference.getCanonicalText();
    final Trinity<PsiElement,Collection<String>,PropertiesProvider> resolved = 
      PropertyResolver.resolve(contextAntProject, propertyName, antDomPropertyReference.myInvocationContextElement);
    final PsiElement mainDeclaration = resolved.getFirst();

    if (mainDeclaration != null) {
      result.add(new MyResolveResult(mainDeclaration, resolved.getThird()));
    }

    final List<PsiElement> antCallParams = AntCallParamsFinder.resolve(project, propertyName);
    for (PsiElement param : antCallParams) {
      result.add(new MyResolveResult(param, null));
    }
  }
  return ContainerUtil.toArray(result, new ResolveResult[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntDomPropertyReference.java

示例2: browse

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public void browse(MouseEvent e, PsiElement element) {
  PsiElement parent = element.getParent();
  if (!(parent instanceof GrField)) return;
  final GrField field = (GrField)parent;
  final List<GrAccessorMethod> accessors = GroovyPropertyUtils.getFieldAccessors(field);
  final ArrayList<PsiMethod> superMethods = new ArrayList<PsiMethod>();
  for (GrAccessorMethod method : accessors) {
    Collections.addAll(superMethods, method.findSuperMethods(false));
  }
  if (superMethods.isEmpty()) return;
  final PsiMethod[] supers = ContainerUtil.toArray(superMethods, new PsiMethod[superMethods.size()]);
  boolean showMethodNames = !PsiUtil.allMethodsHaveSameSignature(supers);
  PsiElementListNavigator.openTargets(e, supers, 
                                      DaemonBundle.message("navigation.title.super.method", field.getName()),
                                      DaemonBundle.message("navigation.findUsages.title.super.method", field.getName()),
                                      new MethodCellRenderer(showMethodNames));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyMarkerTypes.java

示例3: getModuleDependencies

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public Module[] getModuleDependencies(boolean includeTests) {
  final List<Module> result = new ArrayList<Module>();

  for (OrderEntry entry : getOrderEntries()) {
    if (entry instanceof ModuleOrderEntry) {
      ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)entry;
      final DependencyScope scope = moduleOrderEntry.getScope();
      if (!includeTests && !scope.isForProductionCompile() && !scope.isForProductionRuntime()) {
        continue;
      }
      final Module module1 = moduleOrderEntry.getModule();
      if (module1 != null) {
        result.add(module1);
      }
    }
  }

  return result.isEmpty() ? Module.EMPTY_ARRAY : ContainerUtil.toArray(result, new Module[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:RootModelBase.java

示例4: findTargets

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
private static PsiElement[] findTargets(@NotNull PsiMember e) {
  if (e instanceof PsiClass) {
    PsiClass aClass = (PsiClass)e;
    List<PsiClass> allSupers = new ArrayList<PsiClass>(Arrays.asList(aClass.getSupers()));
    for (Iterator<PsiClass> iterator = allSupers.iterator(); iterator.hasNext(); ) {
      PsiClass superClass = iterator.next();
      if (CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) iterator.remove();
    }
    return ContainerUtil.toArray(allSupers, new PsiClass[allSupers.size()]);
  }
  else if (e instanceof PsiMethod) {
    return getSupers((PsiMethod)e);
  }
  else {
    LOG.assertTrue(e instanceof GrField);
    List<PsiMethod> supers = new ArrayList<PsiMethod>();
    for (GrAccessorMethod method : GroovyPropertyUtils.getFieldAccessors((GrField)e)) {
      supers.addAll(Arrays.asList(getSupers(method)));
    }
    return ContainerUtil.toArray(supers, new PsiMethod[supers.size()]);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GroovyGotoSuperHandler.java

示例5: init

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
protected void init() {
  List<String> settingNames = mySettingsToShow.getSettings(getSettingsType());
  String[] names = ContainerUtil.toArray(settingNames, new String[settingNames.size()]);
  showStandardOptions(names);
  initTables();

  myOptionsTree = createOptionsTree();
  myOptionsTree.setCellRenderer(new MyTreeCellRenderer());

  JBScrollPane pane = new JBScrollPane(myOptionsTree) {
    @Override
    public Dimension getMinimumSize() {
      return super.getPreferredSize();
    }
  };

  myPanel = new JPanel(new BorderLayout());
  myPanel.add(pane);

  isFirstUpdate = false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CodeFragmentCodeStyleSettingsPanel.java

示例6: getVariants

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
public Object[] getVariants() {
  final TargetResolver.Result result = doResolve(getCanonicalText());
  if (result == null) {
    return EMPTY_ARRAY;
  }
  final Map<String, AntDomTarget> variants = result.getVariants();                                                                          
  final List resVariants = new ArrayList();
  final Set<String> existing = getExistingNames();
  for (String s : variants.keySet()) {
    if (existing.contains(s)){
      continue;
    }
    final LookupElementBuilder builder = LookupElementBuilder.create(s).withCaseSensitivity(false);
    final LookupElement element = AutoCompletionPolicy.GIVE_CHANCE_TO_OVERWRITE.applyPolicy(builder);
    resVariants.add(element);
  }
  return ContainerUtil.toArray(resVariants, new Object[resVariants.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AntDomTargetReference.java

示例7: createXmlTagValue

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
public static XmlTagValue createXmlTagValue(XmlTag tag) {
  final List<XmlTagChild> bodyElements = new ArrayList<XmlTagChild>();

  tag.processElements(new PsiElementProcessor() {
    boolean insideBody = false;
    @Override
    public boolean execute(@NotNull PsiElement element) {
      final ASTNode treeElement = element.getNode();
      if (insideBody) {
        if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_END_TAG_START) return false;
        if (!(element instanceof XmlTagChild)) return true;
        bodyElements.add((XmlTagChild)element);
      }
      else if (treeElement != null && treeElement.getElementType() == XmlTokenType.XML_TAG_END) insideBody = true;
      return true;
    }
  }, tag);

  XmlTagChild[] tagChildren = ContainerUtil.toArray(bodyElements, new XmlTagChild[bodyElements.size()]);
  return new XmlTagValueImpl(tagChildren, tag);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:XmlTagValueImpl.java

示例8: getReferenceElements

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PsiJavaCodeReferenceElement[] getReferenceElements() {
  if (myCachedRefs == null) {
    if (myRefs.isEmpty()) {
      myCachedRefs = PsiJavaCodeReferenceElement.EMPTY_ARRAY;
    }
    else {
      myCachedRefs = ContainerUtil.toArray(myRefs, new PsiJavaCodeReferenceElement[myRefs.size()]);
    }
  }
  return myCachedRefs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LightReferenceListBuilder.java

示例9: findOccurrences

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
protected PsiElement[] findOccurrences(@NotNull GrExpression expression, @NotNull PsiElement scope) {
  final PsiElement[] occurrences = super.findOccurrences(expression, scope);
  if (shouldBeStatic(expression, scope)) return occurrences;

  List<PsiElement> filtered = new ArrayList<PsiElement>();
  for (PsiElement occurrence : occurrences) {
    if (!shouldBeStatic(occurrence, scope)) {
      filtered.add(occurrence);
    }
  }
  return ContainerUtil.toArray(filtered, new PsiElement[filtered.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GrIntroduceFieldHandler.java

示例10: getChildren

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  List<AnAction> result = new ArrayList<AnAction>();
  ContainerUtil.addAll(result, myActions);
  result.add(Separator.getInstance());
  result.add(ActionManager.getInstance().getAction(IdeActions.GROUP_DIFF_EDITOR_GUTTER_POPUP));
  return ContainerUtil.toArray(result, new AnAction[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SetEditorSettingsAction.java

示例11: getTextElements

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
@NotNull
public XmlText[] getTextElements() {
  XmlText[] textElements = myTextElements;
  if(textElements != null) return textElements;
  final List<XmlText> textElementsList = new ArrayList<XmlText>();
  for (final XmlTagChild element : myElements) {
    if (element instanceof XmlText) textElementsList.add((XmlText)element);
  }
  return myTextElements = textElementsList.isEmpty() ? XmlText.EMPTY_ARRAY : ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlTagValueImpl.java

示例12: getModules

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public Module[] getModules(@NotNull final ProjectData projectData) {
  final List<Module> modules = ContainerUtil.filter(getModules(), new Condition<Module>() {
    @Override
    public boolean value(Module module) {
      return isExternalSystemAwareModule(projectData.getOwner(), module) &&
             StringUtil.equals(projectData.getLinkedExternalProjectPath(), getExternalRootProjectPath(module));
    }
  });
  return ContainerUtil.toArray(modules, new Module[modules.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:IdeModelsProviderImpl.java

示例13: compute

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Override
public CachedValueProvider.Result<XmlTag[]> compute(XmlTagImpl tag) {
  final List<XmlTag> result = new ArrayList<XmlTag>();

  tag.fillSubTags(result);

  final int s = result.size();
  XmlTag[] tags = s > 0 ? ContainerUtil.toArray(result, new XmlTag[s]) : EMPTY;
  return CachedValueProvider.Result
    .create(tags, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, tag.getContainingFile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:XmlTagImpl.java

示例14: getChildren

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  List<AnAction> branchHeadActions = new ArrayList<AnAction>();
  for (Hash hash : myHeads) {
    branchHeadActions
      .add(new HgCommonBranchActions(myRepository.getProject(), Collections.singletonList(myRepository), hash.toShortString()));
  }
  return ContainerUtil.toArray(branchHeadActions, new AnAction[branchHeadActions.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HgBranchPopupActions.java

示例15: getPsiElementsIn

import com.intellij.util.containers.ContainerUtil; //导入方法依赖的package包/类
@Nullable
private static PsiElement[] getPsiElementsIn(final Editor editor, final PsiFile psiFile) {
  try {
    final PsiReference reference = TargetElementUtil.findReference(editor, editor.getCaretModel().getOffset());
    if (reference == null) {
      return null;
    }
    final Collection<PsiElement> candidates = TargetElementUtil.getInstance().getTargetCandidates(reference);
    return ContainerUtil.toArray(candidates, new PsiElement[candidates.size()]);
  }
  catch (IndexNotReadyException e) {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AntRenameHandler.java


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