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


Java ArrayUtil.toObjectArray方法代码示例

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


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

示例1: getPrefixCompletions

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
static Object[] getPrefixCompletions(XmlAttribute attribute) {
  final ModeReference.MyModeMatcher matcher = new ModeReference.MyModeMatcher(attribute, QNameUtil.ANY);
  final PsiElement[] modes = ResolveUtil.collect(matcher);
  final Collection<String> prefixes = XsltNamespaceContext.getPrefixes(attribute);
  final Set<NamespaceLookup> lookups = new HashSet<NamespaceLookup>(prefixes.size());

  for (PsiElement mode : modes) {
    final QName qName = ((ImplicitModeElement)mode).getQName();
    if (qName == null) continue;
    final String prefix = qName.getPrefix();
    if (!prefixes.contains(prefix)) continue;

    lookups.add(new NamespaceLookup(prefix));
  }

  return ArrayUtil.toObjectArray(lookups);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModeReference.java

示例2: getVariants

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
public Object[] getVariants() {
  final ASTNode categoryNode = getCategoryNode();
  if (categoryNode != null && categoryNode.getText().startsWith("In") && !categoryNode.getText().startsWith("Intelli")) {
    return UNICODE_BLOCKS;
  }
  else {
    boolean startsWithIs = categoryNode != null && categoryNode.getText().startsWith("Is");
    Collection<LookupElement> result = ContainerUtil.newArrayList();
    for (String[] properties : RegExpLanguageHosts.getInstance().getAllKnownProperties(getElement())) {
      String name = ArrayUtil.getFirstElement(properties);
      if (name != null) {
        String typeText = properties.length > 1 ? properties[1] : ("Character.is" + name.substring("java".length()) + "()");
        result.add(PrioritizedLookupElement.withPriority(LookupElementBuilder.create(name)
                                                           .withPresentableText(startsWithIs ? "Is" + name : name)
                                                           .withIcon(PlatformIcons.PROPERTY_ICON)
                                                           .withTypeText(typeText), getPriority(name)));
      }
    }
    return ArrayUtil.toObjectArray(result);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RegExpPropertyImpl.java

示例3: getOldPackages

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private Iterable<LocalPkgInfo> getOldPackages(Collection<LocalPkgInfo> installed) {
  if (myRemotePackages != null) {
    LocalPkgInfo[] packagesArray = ArrayUtil.toObjectArray(installed, LocalPkgInfo.class);
    SdkPackages packages = new SdkPackages(packagesArray, myRemotePackages);
    List<LocalPkgInfo> result = Lists.newArrayList();
    for (UpdatablePkgInfo update : packages.getUpdatedPkgs()) {
      if (update.hasRemote(false)) {
        result.add(update.getLocalInfo());
      }
    }
    return result;
  }
  else {
    return installed; // We should try reinstalling all...
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ComponentInstaller.java

示例4: deriveValue

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public TemplateEntry[] deriveValue(ScopedStateStore state,
                                                       ScopedStateStore.Key changedKey,
                                                       @Nullable TemplateEntry[] currentValue) {
  Boolean isLauncher = state.get(AddAndroidActivityPath.KEY_IS_LAUNCHER);
  if (!Boolean.TRUE.equals(isLauncher)) {
    return myTemplates;
  }
  List<TemplateEntry> list = Lists.newArrayListWithExpectedSize(myTemplates.length);
  for (TemplateEntry entry : Arrays.asList(myTemplates)) {
    if (entry.getMetadata().getParameter(TemplateMetadata.ATTR_IS_LAUNCHER) != null) {
      list.add(entry);
    }
  }
  return ArrayUtil.toObjectArray(list, TemplateEntry.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:TemplateListProvider.java

示例5: get

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Object[] get(final PsiElement context, CompletionContext completionContext) {
  final List<String> results = new LinkedList<String>();

  final PsiElementProcessor processor = new PsiElementProcessor() {
    @Override
    public boolean execute(@NotNull final PsiElement element) {
      if (element instanceof XmlEntityDecl) {
        final XmlEntityDecl xmlEntityDecl = (XmlEntityDecl)element;
        if (xmlEntityDecl.isInternalReference()) {
          results.add(xmlEntityDecl.getName());
        }
      }
      return true;
    }
  };

  XmlUtil.processXmlElements((XmlFile)context.getContainingFile().getOriginalFile(), processor, true);
  return ArrayUtil.toObjectArray(results);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:DtdCompletionData.java

示例6: getTemplateList

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
/**
 * Search the given folder for a list of templates and populate the display list.
 */
private static TemplateEntry[] getTemplateList(@Nullable String formFactor, @NotNull String category,
                                               @Nullable Set<String> excluded) {
  TemplateManager manager = TemplateManager.getInstance();
  List<File> templates = manager.getTemplatesInCategory(category);
  List<TemplateEntry> metadataList = new ArrayList<TemplateEntry>(templates.size());
  for (File template : templates) {
    TemplateMetadata metadata = manager.getTemplate(template);
    if (metadata == null || !metadata.isSupported()) {
      continue;
    }
    // Don't include this template if it's been excluded
    if (excluded != null && excluded.contains(metadata.getTitle())) {
      continue;
    }
    // If a form factor has been specified, ensure that requirement is met.
    if (formFactor != null && !formFactor.equalsIgnoreCase(metadata.getFormFactor())) {
      continue;
    }
    metadataList.add(new TemplateEntry(template, metadata));
  }
  return ArrayUtil.toObjectArray(metadataList, TemplateEntry.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:TemplateListProvider.java

示例7: getVariants

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
public Object[] getVariants() {
  final PsiFile containingFile = myAttribute.getContainingFile();
  if (containingFile instanceof XmlFile && XsltSupport.isXsltFile(containingFile)) {
    final List<Object> l = new ArrayList<Object>();
    if (!myImplicitModeElement.hasPrefix()) {
      final Object[] prefixes = getPrefixCompletions(myAttribute);
      ContainerUtil.addAll(l, prefixes);
    }

    if (myImplicitModeElement.getQName() != null) {
      final PsiElement[] modes = ResolveUtil.collect(getMatcher().variantMatcher());
      ContainerUtil.addAll(l, modes);
    }
    return ArrayUtil.toObjectArray(l);
  }
  return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ModeReference.java

示例8: replace

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public boolean replace(@NotNull K key, @NotNull Collection<V> expectedValue, @NotNull Collection<V> newValue) {
  ConcurrentMap<K, Object> map = (ConcurrentMap<K, Object>)myMap;
  Object[] newArray = ArrayUtil.toObjectArray(newValue);
  Object newValueToPut = newArray.length == 0 ? null : newArray.length == 1 ? newArray[0] : newArray;

  Object oldValue = map.get(key);
  List<V> oldCollection = rawValueToCollection(oldValue);
  if (!oldCollection.equals(expectedValue)) return false;

  if (oldValue == null) {
    return newValueToPut == null || map.putIfAbsent(key, newValueToPut) == null;
  }
  if (newValueToPut == null) {
    return map.remove(key, oldValue);
  }
  return map.replace(key, oldValue, newValueToPut);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ConcurrentMostlySingularMultiMap.java

示例9: getChildElements

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Object[] getChildElements(Object element) {
  if (element == RootDescriptor.ROOT) {
    return ArrayUtil.toStringArray(myCertificates.keySet());
  }
  else if (element instanceof String) {
    return ArrayUtil.toObjectArray(myCertificates.get((String)element));
  }
  return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CertificateTreeBuilder.java

示例10: buildChildren

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
protected Object[] buildChildren(@NotNull HierarchyNodeDescriptor descriptor) {
  final List<PyHierarchyNodeDescriptor> descriptors = new ArrayList<PyHierarchyNodeDescriptor>();
  if (descriptor instanceof PyHierarchyNodeDescriptor) {
    final PyHierarchyNodeDescriptor pyDescriptor = (PyHierarchyNodeDescriptor)descriptor;
    final PsiElement element = pyDescriptor.getPsiElement();
    final boolean isCallable = element instanceof PyFunction || element instanceof PyClass || element instanceof PyFile;
    HierarchyNodeDescriptor nodeDescriptor = getBaseDescriptor();
    if (!(element instanceof PyElement) || !isCallable || nodeDescriptor == null) {
      return ArrayUtil.EMPTY_OBJECT_ARRAY;
    }

    final List<PsiElement> children = getChildren((PyElement)element);

    final HashMap<PsiElement, PyHierarchyNodeDescriptor> callerToDescriptorMap = new HashMap<PsiElement, PyHierarchyNodeDescriptor>();
    PsiElement baseClass = element instanceof PyFunction ? ((PyFunction)element).getContainingClass() : null;

    for (PsiElement caller : children) {
      if (isInScope(baseClass, caller, myScopeType)) {
        PyHierarchyNodeDescriptor callerDescriptor = callerToDescriptorMap.get(caller);
        if (callerDescriptor == null) {
          callerDescriptor = new PyHierarchyNodeDescriptor(descriptor, caller, false);
          callerToDescriptorMap.put(caller, callerDescriptor);
          descriptors.add(callerDescriptor);
        }
      }
    }

  }
  return ArrayUtil.toObjectArray(descriptors);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:PyCallHierarchyTreeStructureBase.java

示例11: buildChildren

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
protected Object[] buildChildren(@NotNull HierarchyNodeDescriptor descriptor) {
  final List<PyHierarchyNodeDescriptor> res = new ArrayList<PyHierarchyNodeDescriptor>();
  final PsiElement element = ((PyHierarchyNodeDescriptor)descriptor).getPsiElement();
  if (element instanceof PyClass) {
    final PyClass cls = (PyClass)element;
    Query<PyClass> subClasses = PyClassInheritorsSearch.search(cls, false);
    for (PyClass subClass : subClasses) {
      res.add(new PyHierarchyNodeDescriptor(descriptor, subClass, false));
    }

  }

  return ArrayUtil.toObjectArray(res);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:PySubTypesHierarchyTreeStructure.java

示例12: buildConfigurables

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
protected Configurable[] buildConfigurables() {
  Collections.sort(myList, COMPARATOR);
  Configurable[] result = ArrayUtil.toObjectArray(myList, Configurable.class);
  myList.clear();
  myList = null;
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:SortedConfigurableGroup.java

示例13: getFilesByName

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public static PsiFileSystemItem[] getFilesByName(final Project project,
                                       final String name,
                                       @NotNull final GlobalSearchScope scope,
                                       boolean includeDirs) {
  SmartList<PsiFileSystemItem> result = new SmartList<PsiFileSystemItem>();
  processFilesByName(name, includeDirs, new CommonProcessors.CollectProcessor<PsiFileSystemItem>(result), scope, project, null);

  if (includeDirs) {
    return ArrayUtil.toObjectArray(result, PsiFileSystemItem.class);
  }
  //noinspection SuspiciousToArrayCall
  return result.toArray(new PsiFile[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:FilenameIndex.java

示例14: testLocalNSDeclarations

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public void testLocalNSDeclarations() throws Throwable {
  final XmlTag tag = XmlElementFactory.getInstance(getProject()).createTagFromText("<foo xmlns='aaa' xmlns:a='bbbb'/>");
  final Object[] nsPrefixes = ArrayUtil.toObjectArray(tag.getLocalNamespaceDeclarations().keySet());
  Arrays.sort(nsPrefixes);
  assertEquals(2, nsPrefixes.length);
  assertEquals("a",nsPrefixes[1]);
  assertEquals("",nsPrefixes[0]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:XmlTagTest.java

示例15: toArray

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Object[] toArray() {
  return ArrayUtil.toObjectArray(myElements);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:CommanderPanel.java


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