本文整理汇总了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()]);
}
示例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));
}
示例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()]);
}
示例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()]);
}
}
示例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;
}
示例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()]);
}
示例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);
}
示例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;
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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());
}
示例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()]);
}
示例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;
}
}