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


Java ArrayUtil类代码示例

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


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

示例1: invokeAutoPopup

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
@Override
public boolean invokeAutoPopup(@NotNull PsiElement position, char typeChar) {
    MethodReference reference = PsiTreeUtil.getParentOfType(position, MethodReference.class);
    if (reference != null && ArrayUtil.contains(reference.getName(), ViewsUtil.renderMethods)) {
        if (typeChar == '\'' || typeChar == '"') {
            if (position instanceof LeafPsiElement && position.getText().equals("$view")) {
                return true;
            }
            if (position.getNextSibling() instanceof ParameterList) {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:nvlad,项目名称:yii2support,代码行数:17,代码来源:CompletionContributor.java

示例2: addOrReplaceScopes

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
private static void addOrReplaceScopes(@NotNull Project project, @NotNull List<NamedScope> newScopes) {
    final Set<String> newScopeNames = newScopes
        .stream()
        .map(NamedScope::getName)
        .collect(Collectors.toSet());

    final NamedScopeManager namedScopeManager = NamedScopeManager.getInstance(project);
    final NamedScope[] existingScopes = namedScopeManager.getEditableScopes();

    final NamedScope[] filteredScopes = Arrays
        .stream(existingScopes)
        .filter(it -> !newScopeNames.contains(it.getName()))
        .toArray(NamedScope[]::new);

    namedScopeManager.setScopes(ArrayUtil.mergeArrays(
        filteredScopes,
        newScopes.toArray(new NamedScope[newScopes.size()])
    ));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:20,代码来源:DefaultSearchScopeConfigurator.java

示例3: validateCommon

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
protected boolean validateCommon() throws ConfigurationException {
    final Set<HybrisModuleDescriptor> moduleDuplicates = this.calculateSelectedModuleDuplicates();
    final Collection<String> moduleDuplicateNames = newHashSet(moduleDuplicates.size());

    for (HybrisModuleDescriptor moduleDuplicate : moduleDuplicates) {
        moduleDuplicateNames.add(this.getModuleNameAndPath(moduleDuplicate));
    }

    if (!moduleDuplicates.isEmpty()) {
        throw new ConfigurationException(
            HybrisI18NBundleUtils.message(
                "hybris.project.import.duplicate.projects.found",
                StringUtil.join(ArrayUtil.toStringArray(moduleDuplicateNames), "\n")
            ),
            HybrisI18NBundleUtils.message("hybris.project.error")
        );
    }

    return true;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:21,代码来源:AbstractSelectModulesToImportStep.java

示例4: 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

示例5: putOptionWithHelpId

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
private synchronized void putOptionWithHelpId(@NotNull String option,
                                              @NotNull final String id,
                                              @Nullable final String groupName,
                                              @Nullable String hit,
                                              @Nullable final String path) {
  if (isStopWord(option)) return;
  String stopWord = PorterStemmerUtil.stem(option);
  if (stopWord == null) return;
  if (isStopWord(stopWord)) return;

  long[] configs = myStorage.get(option);
  long packed = pack(id, hit, path, groupName);
  if (configs == null) {
    configs = new long[] {packed};
  }
  else {
    configs = ArrayUtil.indexOf(configs, packed) == -1 ? ArrayUtil.append(configs, packed) : configs;
  }
  myStorage.put(ByteArrayCharSequence.convertToBytesIfAsciiString(option), configs);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:SearchableOptionsRegistrarImpl.java

示例6: getNonEmptyExistingDirs

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
@NotNull
private static String[] getNonEmptyExistingDirs(@NotNull String[] dirs) {
  final List<String> result = new ArrayList<String>();
  for (String dirPath : dirs) {
    final File dir = new File(dirPath);

    if (dir.isDirectory()) {
      final File[] children = dir.listFiles();

      if (children != null && children.length > 0) {
        result.add(dirPath);
      }
    }
  }
  return ArrayUtil.toStringArray(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidApt.java

示例7: updateModuleGroupPath

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
public static <T> T updateModuleGroupPath(final ModuleGroup group,
                                          T parentNode,
                                          final Function<ModuleGroup, T> needToCreateNode,
                                          final Consumer<ParentChildRelation<T>> insertNode,
                                          final Function<ModuleGroup, T> createNewNode) {
  final ArrayList<String> path = new ArrayList<String>();
  final String[] groupPath = group.getGroupPath();
  for (String pathElement : groupPath) {
    path.add(pathElement);
    final ModuleGroup moduleGroup = new ModuleGroup(ArrayUtil.toStringArray(path));
    T moduleGroupNode = needToCreateNode.fun(moduleGroup);
    if (moduleGroupNode == null) {
      moduleGroupNode = createNewNode.fun(moduleGroup);
      insertNode.consume(new ParentChildRelation<T>(parentNode, moduleGroupNode));
    }
    parentNode = moduleGroupNode;
  }
  return parentNode;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ModuleGroupUtil.java

示例8: copySignature

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
/**
 * Creates builder copying signature and doc from another one.
 *
 * @param source                  what to copy
 * @param decoratorsToCopyIfExist list of decorator names to be copied to new function.
 * @return builder configured by this function
 */
@NotNull
public static PyFunctionBuilder copySignature(@NotNull final PyFunction source, @NotNull final String... decoratorsToCopyIfExist) {
  final String name = source.getName();
  final PyFunctionBuilder functionBuilder = new PyFunctionBuilder((name != null) ? name : "", source);
  for (final PyParameter parameter : source.getParameterList().getParameters()) {
    final String parameterName = parameter.getName();
    if (parameterName != null) {
      functionBuilder.parameter(parameterName);
    }
  }
  final PyDecoratorList decoratorList = source.getDecoratorList();
  if (decoratorList != null) {
    for (final PyDecorator decorator : decoratorList.getDecorators()) {
      final String decoratorName = decorator.getName();
      if (decoratorName != null) {
        if (ArrayUtil.contains(decoratorName, decoratorsToCopyIfExist)) {
          functionBuilder.decorate(decoratorName);
        }
      }
    }
  }
  functionBuilder.myDocStringGenerator = PyDocstringGenerator.forDocStringOwner(source);
  return functionBuilder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:PyFunctionBuilder.java

示例9: registerAllowedRoots

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
public void registerAllowedRoots(List<String> roots, @NotNull Disposable disposable) {
  final List<String> newRoots = new ArrayList<String>(roots);
  newRoots.removeAll(myAllowedRoots);

  final String[] newRootsArray = ArrayUtil.toStringArray(newRoots);
  VfsRootAccess.allowRootAccess(newRootsArray);
  myAllowedRoots.addAll(newRoots);

  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      VfsRootAccess.disallowRootAccess(newRootsArray);
      myAllowedRoots.removeAll(newRoots);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalSystemTestCase.java

示例10: getCompletionVariants

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
public Object[] getCompletionVariants(String completionPrefix, PsiElement location, ProcessingContext context) {
  final List<LookupElement> result = new ArrayList<LookupElement>();
  final PsiElement resolved = myImportedModule.resolve();
  if (resolved instanceof PyFile) {
    final PyModuleType moduleType = new PyModuleType((PyFile)resolved, myImportedModule);
    result.addAll(moduleType.getCompletionVariantsAsLookupElements(location, context, false, false));
  }
  else if (resolved instanceof PsiDirectory) {
    final PsiDirectory dir = (PsiDirectory)resolved;
    if (PyUtil.isPackage(dir, location)) {
      if (ResolveImportUtil.getPointInImport(location) != PointInImport.NONE) {
        result.addAll(PyModuleType.getSubModuleVariants(dir, location, null));
      }
      else {
        result.addAll(PyModuleType.collectImportedSubmodulesAsLookupElements(dir, location, context.get(CTX_NAMES)));
      }
    }
  }
  return ArrayUtil.toObjectArray(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyImportedModuleType.java

示例11: findSuperElements

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
@NotNull
private PsiElement[] findSuperElements(@NotNull PsiFile file, int offset) {
  PsiElement element = getElement(file, offset);
  if (element == null) return PsiElement.EMPTY_ARRAY;

  final PsiElement psiElement = PsiTreeUtil.getParentOfType(element, PsiFunctionalExpression.class, PsiMember.class);
  if (psiElement instanceof PsiFunctionalExpression) {
    final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(psiElement);
    if (interfaceMethod != null) {
      return ArrayUtil.prepend(interfaceMethod, interfaceMethod.findSuperMethods(false));
    }
  }

  final PsiNameIdentifierOwner parent = PsiTreeUtil.getNonStrictParentOfType(element, PsiMethod.class, PsiClass.class);
  if (parent == null) {
    return PsiElement.EMPTY_ARRAY;
  }

  return FindSuperElementsHelper.findSuperElements(parent);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JavaGotoSuperHandler.java

示例12: refreshTable

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
private void refreshTable() {
  IDevice[] devices = myDetectedDevicesRef.get();
  myDisplayedDevices = devices;

  final IDevice[] selectedDevices = getSelectedDevices();
  final TIntArrayList selectedRows = new TIntArrayList();
  for (int i = 0; i < devices.length; i++) {
    if (ArrayUtil.indexOf(selectedDevices, devices[i]) >= 0) {
      selectedRows.add(i);
    }
  }

  myProcessSelectionFlag = false;
  myDeviceTable.setModel(new MyDeviceTableModel(devices));
  if (selectedRows.size() == 0 && devices.length > 0) {
    myDeviceTable.getSelectionModel().setSelectionInterval(0, 0);
  }
  for (int selectedRow : selectedRows.toNativeArray()) {
    if (selectedRow < devices.length) {
      myDeviceTable.getSelectionModel().addSelectionInterval(selectedRow, selectedRow);
    }
  }
  fireSelectedDevicesChanged();
  myProcessSelectionFlag = true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeviceChooser.java

示例13: remove

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
public boolean remove(@NotNull K key, @NotNull V value) {
  Object current = myMap.get(key);
  if (current == null) {
    return false;
  }
  if (current instanceof Object[]) {
    Object[] curArr = (Object[])current;
    Object[] newArr = ArrayUtil.remove(curArr, value, ArrayUtil.OBJECT_ARRAY_FACTORY);
    myMap.put(key, newArr);
    return newArr.length == curArr.length-1;
  }

  if (value.equals(current)) {
    myMap.remove(key);
    return true;
  }

  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MostlySingularMultiMap.java

示例14: getSelectedCells

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
public int[] getSelectedCells(@Nullable final Point dragOrigin) {
  ArrayList<Integer> selection = new ArrayList<Integer>();
  RadContainer container = getSelectedGridContainer();
  if (container == null) {
    return ArrayUtil.EMPTY_INT_ARRAY;
  }
  int size = getCellCount();
  for(int i=0; i<size; i++) {
    if (mySelectionModel.isSelectedIndex(i)) {
      selection.add(i);
    }
  }
  if (selection.size() == 0 && dragOrigin != null) {
    int cell = getCellAt(dragOrigin);
    if (cell >= 0) {
      return new int[] { cell };
    }
  }
  int[] result = new int[selection.size()];
  for(int i=0; i<selection.size(); i++) {
    result [i] = selection.get(i).intValue();
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GridCaptionPanel.java

示例15: parseAndCheckProguardCfgPaths

import com.intellij.util.ArrayUtil; //导入依赖的package包/类
@NotNull
private static String[] parseAndCheckProguardCfgPaths(@NotNull String pathsStr) {
  if (pathsStr.length() == 0) {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  }
  final String[] paths = pathsStr.split(File.pathSeparator);

  if (paths.length == 0) {
    return ArrayUtil.EMPTY_STRING_ARRAY;
  }
  for (String path : paths) {
    if (LocalFileSystem.getInstance().refreshAndFindFileByPath(path) == null) {
      return ArrayUtil.EMPTY_STRING_ARRAY;
    }
  }
  return paths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ApkStep.java


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