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


Java ArrayUtil.mergeArrays方法代码示例

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

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

示例1: multiResolve

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] multiResolve(final boolean incompleteCode) {
    final Project project = myElement.getProject();
    final String modelName = PATTERN.matcher(myElement.getText()).replaceAll("");

    final String javaModelName = modelName + JAVA_MODEL_SUFFIX;
    final String jaloModelName = modelName;

    final PsiClass[] javaModelClasses = PsiShortNamesCache.getInstance(project).getClassesByName(
        javaModelName, GlobalSearchScope.allScope(project)
    );

    final PsiClass[] jaloModelClasses = PsiShortNamesCache.getInstance(project).getClassesByName(
        jaloModelName, GlobalSearchScope.projectScope(project)
    );

    final PsiClass[] psiClasses = ArrayUtil.mergeArrays(javaModelClasses, jaloModelClasses);
    return PsiElementResolveResult.createResults(psiClasses);
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:HybrisModelItemReference.java


示例2: doGetKeywords

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private String[] doGetKeywords(PsiElement context) {
  final PsiElement next = PsiTreeUtil.skipSiblingsForward(context, PsiWhiteSpace.class);
  if (next != null && EscapeUtil.unescapeText(next).equals("=")) {
      return new String[]{ "start" };
    }

  if (DEFAULT_PATTERN.accepts(context)) {
    return new String[]{ "namespace" };
  } else if (DECL_PATTERN.accepts(context)) {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  } else if (context.getParent() instanceof RncDefine && context.getParent().getFirstChild() == context) {
    if (DEFINE_PATTERN.accepts(context)) {
      return ArrayUtil.EMPTY_STRING_ARRAY;
    }
    if (TOP_LEVEL.accepts(context)) {
      if (!afterPattern(context)) {
        return ArrayUtil.mergeArrays(DECL_KEYWORDS, ArrayUtil.mergeArrays(GRAMMAR_CONTENT_KEYWORDS, PATTERN_KEYWORDS));
      }
    }
    return GRAMMAR_CONTENT_KEYWORDS;
  }
  return PATTERN_KEYWORDS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:RncCompletionData.java


示例3: generateAnnotations

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void generateAnnotations(@NonNls @NotNull StringBuilder buffer,
                                        @NotNull PsiModifierListOwner owner,
                                        boolean generateLink,
                                        boolean splitAnnotations,
                                        boolean useShortNames) {
  final PsiModifierList ownerModifierList = owner.getModifierList();
  if (ownerModifierList == null) return;
  generateAnnotations(buffer, owner, ownerModifierList.getAnnotations(), false, generateLink, splitAnnotations, useShortNames);
  PsiAnnotation[] externalAnnotations = ExternalAnnotationsManager.getInstance(owner.getProject()).findExternalAnnotations(owner);
  if (externalAnnotations == null) {
    externalAnnotations = new PsiAnnotation[]{};
  }
  PsiAnnotation[] inferredAnnotations = InferredAnnotationsManager.getInstance(owner.getProject()).findInferredAnnotations(owner);
  externalAnnotations = ArrayUtil.mergeArrays(externalAnnotations, inferredAnnotations, PsiAnnotation.ARRAY_FACTORY);
  generateAnnotations(buffer, owner, externalAnnotations, true, generateLink, splitAnnotations, useShortNames);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaDocInfoGenerator.java


示例4: multiResolve

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
public ResolveResult[] multiResolve(@NotNull Project project) {
  List<ResolveResult> typeDefs =
      SchemaIndexUtil.findTypeDefs(project, prefixes, suffix, searchScope).stream()
      .filter(Objects::nonNull)
      .map(PsiElementResolveResult::new)
      .collect(Collectors.toList());

  // see comment in `resolve` above re. namespace declaration reference

  Qn prefix = input;
  int prefixLength = prefix.size();
  List<SchemaNamespaceDecl> namespaceDecls = resolveNamespaces(project, prefix);

  ResolveResult[] namespaces = namespaceDecls.stream()
      .map(ns -> new PsiElementResolveResult(getTargetSegment(ns, prefixLength)))
      .toArray(ResolveResult[]::new);

  return ArrayUtil.mergeArrays(typeDefs.toArray(new ResolveResult[typeDefs.size()]), namespaces);
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:21,代码来源:SchemaQnReferenceResolver.java


示例5: doAdd

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void doAdd(CompletionParameters parameters, final CompletionResultSet result) {
  PsiElement position = parameters.getPosition();
  PsiReference[] references = ArrayUtil.mergeArrays(position.getReferences(), position.getParent().getReferences());
  PropertyReference propertyReference = ContainerUtil.findInstance(references, PropertyReference.class);
  if (propertyReference != null && !hasMoreImportantReference(references, propertyReference)) {
    final int startOffset = parameters.getOffset();
    PsiElement element = propertyReference.getElement();
    final int offsetInElement = startOffset - element.getTextRange().getStartOffset();
    TextRange range = propertyReference.getRangeInElement();
    if (offsetInElement >= range.getStartOffset()) {
      final String prefix = element.getText().substring(range.getStartOffset(), offsetInElement);

      LookupElement[] variants = getVariants(propertyReference);
      result.withPrefixMatcher(prefix).addAllElements(Arrays.asList(variants));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PropertiesCompletionContributor.java


示例6: getAttributesDescriptors

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable XmlTag context) {
  XmlAttributeDescriptor[] attributeDescriptors = HtmlNSDescriptorImpl.getCommonAttributeDescriptors(context);
  XmlAttributeDescriptor[] customAttributes = new XmlAttributeDescriptor[1];
  customAttributes[0] = new AnyXmlAttributeDescriptor("cat-store");
  return ArrayUtil.mergeArrays(attributeDescriptors, customAttributes);
}
 
开发者ID:catberry,项目名称:catberry-idea-plugin,代码行数:8,代码来源:CatberryComponentTagDescriptor.java


示例7: runTool

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
protected GlobalInspectionContextImpl runTool(final String testDir,
                                              final String jdkName,
                                              boolean runDeadCodeFirst,
                                              @NotNull InspectionToolWrapper toolWrapper,
                                              @NotNull InspectionToolWrapper... additional) {
  final VirtualFile[] sourceDir = new VirtualFile[1];
  ApplicationManager.getApplication().runWriteAction(new Runnable() {
    @Override
    public void run() {
      try {
        setupRootModel(testDir, sourceDir, jdkName);
      }
      catch (Exception e) {
        LOG.error(e);
      }
    }
  });
  AnalysisScope scope = createAnalysisScope(sourceDir[0].getParent());

  InspectionManagerEx inspectionManager = (InspectionManagerEx)InspectionManager.getInstance(getProject());
  InspectionToolWrapper[] toolWrappers = runDeadCodeFirst ? new InspectionToolWrapper []{getUnusedDeclarationWrapper(), toolWrapper} : new InspectionToolWrapper []{toolWrapper};
  toolWrappers = ArrayUtil.mergeArrays(toolWrappers, additional);
  final GlobalInspectionContextForTests globalContext =
    CodeInsightTestFixtureImpl.createGlobalContextForTool(scope, getProject(), inspectionManager, toolWrappers);

  InspectionTestUtil.runTool(toolWrapper, scope, globalContext);
  return globalContext;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:InspectionTestCase.java


示例8: suggestUniqueParameterName

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
static String suggestUniqueParameterName(JavaCodeStyleManager codeStyleManager,
                                         PsiExpression expression,
                                         PsiType exprType,
                                         Set<String> existingNames) {
  SuggestedNameInfo nameInfo = codeStyleManager.suggestVariableName(VariableKind.PARAMETER, null, expression, exprType);
  @NonNls String[] names = nameInfo.names;
  if (expression instanceof PsiReferenceExpression) {
    final PsiElement resolve = ((PsiReferenceExpression)expression).resolve();
    if (resolve instanceof PsiVariable) {
      final VariableKind variableKind = codeStyleManager.getVariableKind((PsiVariable)resolve);
      final String propertyName = codeStyleManager.variableNameToPropertyName(((PsiVariable)resolve).getName(), variableKind);
      final String parameterName = codeStyleManager.propertyNameToVariableName(propertyName, VariableKind.PARAMETER);
      names = ArrayUtil.mergeArrays(new String[]{parameterName}, names);
    }
  }
  if (names.length == 0) names = new String[]{"param"};
  int suffix = 0;
  while (true) {
    for (String name : names) {
      String suggested = name + (suffix == 0 ? "" : String.valueOf(suffix));
      if (existingNames.add(suggested)) {
        return suggested;
      }
    }
    suffix++;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ChangeMethodSignatureFromUsageFix.java


示例9: getThrowsTags

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static PsiDocTag[] getThrowsTags(PsiDocComment comment) {
  if (comment == null) {
    return PsiDocTag.EMPTY_ARRAY;
  }

  PsiDocTag[] tags1 = comment.findTagsByName(THROWS_KEYWORD);
  PsiDocTag[] tags2 = comment.findTagsByName("exception");

  return ArrayUtil.mergeArrays(tags1, tags2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaDocInfoGenerator.java


示例10: getVariants

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@NotNull
public Object[] getVariants() {
  PsiElement context = getCompletionContext();
  if (context instanceof PsiPackage) {
    return processPackage((PsiPackage)context);
  }
  if (context instanceof PsiClass) {
    final PsiClass aClass = (PsiClass)context;

    if (myInStaticImport) {
      return ArrayUtil.mergeArrays(aClass.getInnerClasses(), aClass.getFields(), ArrayUtil.OBJECT_ARRAY_FACTORY);
    }
    else if (isDefinitelyStatic()) {
      final PsiClass[] psiClasses = aClass.getInnerClasses();
      final List<PsiClass> staticClasses = new ArrayList<PsiClass>(psiClasses.length);

      for (PsiClass c : psiClasses) {
        if (c.hasModifierProperty(PsiModifier.STATIC)) {
          staticClasses.add(c);
        }
      }
      return staticClasses.isEmpty() ? PsiClass.EMPTY_ARRAY : staticClasses.toArray(new PsiClass[staticClasses.size()]);
    }
  }
  return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:JavaClassReference.java


示例11: getSuperClassNames

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public String[] getSuperClassNames() {
  final GrTypeDefinitionStub stub = getStub();
  if (stub != null) {
    return stub.getSuperClassNames();
  }
  return ArrayUtil.mergeArrays(getExtendsNames(), getImplementsNames());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GrTypeDefinitionImpl.java


示例12: appendUnresolvedExprName

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
public static String[] appendUnresolvedExprName(String[] names, final PsiExpression expr) {
  if (expr instanceof PsiReferenceExpression && ((PsiReferenceExpression)expr).resolve() == null) {
    final String name = expr.getText();
    if (PsiNameHelper.getInstance(expr.getProject()).isIdentifier(name, LanguageLevel.HIGHEST)) {
      names = ArrayUtil.mergeArrays(new String[]{name}, names);
    }
  }
  return names;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:AbstractJavaInplaceIntroducer.java


示例13: getRootElementsDescriptors

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@NotNull
public XmlElementDescriptor[] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
  final XmlElementDescriptor[] descriptors = super.getRootElementsDescriptors(doc);
  /**
   * HTML 5 descriptor list contains not only HTML elements, but also SVG and MathML. To prevent conflicts
   * we need to prioritize HTML ones {@link org.intellij.html.RelaxedHtmlFromRngElementDescriptor#compareTo(Object)}
   */
  Arrays.sort(descriptors);
  return ArrayUtil.mergeArrays(descriptors, HtmlUtil.getCustomTagDescriptors(doc));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RelaxedHtmlFromRngNSDescriptor.java


示例14: getFields

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@NotNull
public GrField[] getFields() {
  GrField[] bodyFields = super.getFields();
  GrEnumConstant[] enumConstants = getEnumConstants();
  if (bodyFields.length == 0) return enumConstants;
  if (enumConstants.length == 0) return bodyFields;
  return ArrayUtil.mergeArrays(bodyFields, enumConstants);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GrEnumTypeDefinitionImpl.java


示例15: fillResultsMap

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
private static void fillResultsMap(Map<PsiFile, PsiClass[]> result, PsiFile containingFile, PsiClass[] topLevelClasses) {
  PsiClass[] classes = result.get(containingFile);
  if (topLevelClasses != null) {
    if (classes != null) {
      topLevelClasses = ArrayUtil.mergeArrays(classes, topLevelClasses, PsiClass.ARRAY_FACTORY);
    }
    result.put(containingFile, topLevelClasses);
  } else {
    result.put(containingFile, classes);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CopyClassesHandler.java


示例16: getAllLibraries

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
@NotNull
public Library[] getAllLibraries() {
  Library[] libraries = getLibraries(LibraryLevel.GLOBAL);
  Library[] projectLibraries = getLibraries(LibraryLevel.PROJECT);
  if (projectLibraries.length > 0) {
    libraries = ArrayUtil.mergeArrays(libraries, projectLibraries);
  }
  Library[] moduleLibraries = getLibraries(LibraryLevel.MODULE);
  if (moduleLibraries.length > 0) {
    libraries = ArrayUtil.mergeArrays(libraries, moduleLibraries);
  }
  return libraries;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:LibrariesContainerFactory.java


示例17: actionPerformed

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  PatternDescriptor[] patterns = new PatternDescriptor[0];
  PatternProvider[] extensions = Extensions.getExtensions(PatternProvider.EXTENSION_POINT_NAME);
  for (PatternProvider extension : extensions) {
    if (extension.isAvailable(e.getDataContext())) {
      patterns = ArrayUtil.mergeArrays(patterns, extension.getDescriptors());
    }
  }
  GenerateByPatternDialog dialog = new GenerateByPatternDialog(e.getProject(), patterns);
  if (dialog.showAndGet()) {
    dialog.getSelectedDescriptor().actionPerformed(e.getDataContext());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:GenerateByPatternAction.java


示例18: getChildren

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
  AnAction[] actions = ((ActionGroup)ActionManager.getInstance().getAction(IdeActions.GROUP_WEIGHING_NEW)).getChildren(e);
  if (e == null || ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) {
    AnAction[] newProjectActions = ((ActionGroup)ActionManager.getInstance().getAction("NewProjectOrModuleGroup")).getChildren(e);
    return ArrayUtil.mergeArrays(newProjectActions, actions);
  }
  else {
    return actions;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:NewActionGroup.java


示例19: getAllInfos

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
/**
 * @return <code>WindowInfo</code>s of all (registered and unregistered) tool windows.
 */
WindowInfoImpl[] getAllInfos() {
  final WindowInfoImpl[] registeredInfos = getInfos();
  final WindowInfoImpl[] unregisteredInfos = getUnregisteredInfos();
  myAllInfos = ArrayUtil.mergeArrays(registeredInfos, unregisteredInfos);
  return myAllInfos;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:DesktopLayout.java


示例20: getVariants

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@Override
public Object[] getVariants() {
  String labelString = LabelUtils.trimToDummyIdentifier(myElement.getText());
  return ArrayUtil.mergeArrays(getRuleLookups(labelString), getFileLookups(labelString));
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:6,代码来源:ProjectViewLabelReference.java


示例21: getAllElementTypes

import com.intellij.util.ArrayUtil; //导入方法依赖的package包/类
@NotNull
@Override
public PackagingElementType[] getAllElementTypes() {
  final PackagingElementType[] types = Extensions.getExtensions(PackagingElementType.EP_NAME);
  return ArrayUtil.mergeArrays(STANDARD_TYPES, types);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:PackagingElementFactoryImpl.java



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