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


Java ContainerUtilRt类代码示例

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


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

示例1: testAddSourceRoot

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
public void testAddSourceRoot() {
  final JpsModule module = myProject.addModule("m", JpsJavaModuleType.INSTANCE);
  JavaSourceRootProperties properties = JpsJavaExtensionService.getInstance().createSourceRootProperties("com.xxx");
  final JpsModuleSourceRoot sourceRoot = module.addSourceRoot("file://url", JavaSourceRootType.SOURCE, properties);

  assertSameElements(myDispatcher.retrieveAdded(JpsModule.class), module);
  assertSameElements(myDispatcher.retrieveAdded(JpsModuleSourceRoot.class), sourceRoot);

  final JpsModuleSourceRoot root = assertOneElement(module.getSourceRoots());
  assertEquals("file://url", root.getUrl());
  assertSameElements(ContainerUtilRt.newArrayList(module.getSourceRoots(JavaSourceRootType.SOURCE)), root);
  assertEmpty(ContainerUtil.newArrayList(module.getSourceRoots(JavaSourceRootType.TEST_SOURCE)));
  JpsTypedModuleSourceRoot<JavaSourceRootProperties> typedRoot = root.asTyped(JavaSourceRootType.SOURCE);
  assertNotNull(typedRoot);
  assertEquals("com.xxx", typedRoot.getProperties().getPackagePrefix());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JpsModuleTest.java

示例2: fun

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@NotNull
@Override
public Set<String> fun(ProximityLocation location) {
  final HashSet<String> result = new HashSet<String>();
  PsiClass contextClass = PsiTreeUtil.getContextOfType(location.getPosition(), PsiClass.class, false);
  Processor<PsiClass> processor = new Processor<PsiClass>() {
    @Override
    public boolean process(PsiClass psiClass) {
      ContainerUtilRt.addIfNotNull(result, psiClass.getQualifiedName());
      return true;
    }
  };
  while (contextClass != null) {
    InheritanceUtil.processSupers(contextClass, true, processor);
    contextClass = contextClass.getContainingClass();
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:JavaInheritanceWeigher.java

示例3: testModulesSelector

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
public void testModulesSelector() throws ConfigurationException {
  if (PlatformTestUtil.COVERAGE_ENABLED_BUILD) return;

  Module module1 = getModule1();
  Module module2 = getModule2();
  JUnitConfigurable editor = new JUnitConfigurable(myProject);
  try {
    JUnitConfiguration configuration = createConfiguration(findTestA(module2));
    editor.getComponent(); // To get all the watchers installed.
    Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
    JComboBox comboBox = editor.getModulesComponent();
    configurable.reset();
    assertFalse(configurable.isModified());
    assertEquals(module2.getName(), ((Module)comboBox.getSelectedItem()).getName());
    assertEquals(ModuleManager.getInstance(myProject).getModules().length + 1, comboBox.getModel().getSize()); //no module
    comboBox.setSelectedItem(module1);
    assertTrue(configurable.isModified());
    configurable.apply();
    assertFalse(configurable.isModified());
    assertEquals(Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules()));
  }
  finally {
    Disposer.dispose(editor);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ConfigurationsTest.java

示例4: ProjectDataManager

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
public ProjectDataManager() {
  myServices = new NotNullLazyValue<Map<Key<?>, List<ProjectDataService<?, ?>>>>() {
    @NotNull
    @Override
    protected Map<Key<?>, List<ProjectDataService<?, ?>>> compute() {
      Map<Key<?>, List<ProjectDataService<?, ?>>> result = ContainerUtilRt.newHashMap();
      for (ProjectDataService<?, ?> service : ProjectDataService.EP_NAME.getExtensions()) {
        List<ProjectDataService<?, ?>> services = result.get(service.getTargetDataKey());
        if (services == null) {
          result.put(service.getTargetDataKey(), services = ContainerUtilRt.newArrayList());
        }
        services.add(service);
      }

      for (List<ProjectDataService<?, ?>> services : result.values()) {
        ExternalSystemApiUtil.orderAwareSort(services);
      }
      return result;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ProjectDataManager.java

示例5: filterExistingModules

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@NotNull
private static Collection<DataNode<ModuleData>> filterExistingModules(@NotNull Collection<DataNode<ModuleData>> modules,
                                                                      @NotNull IdeModifiableModelsProvider modelsProvider)
{
  Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
  for (DataNode<ModuleData> node : modules) {
    ModuleData moduleData = node.getData();
    Module module = modelsProvider.findIdeModule(moduleData);
    if (module == null) {
      result.add(node);
    }
    else {
      setModuleOptions(module, node);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ModuleDataService.java

示例6: canExecuteTask

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@Override
public boolean canExecuteTask(RunConfiguration configuration, ExternalSystemBeforeRunTask beforeRunTask) {
  final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();

  final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
  for (String taskName : executionSettings.getTaskNames()) {
    tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
  }
  if (tasks.isEmpty()) return true;

  final Pair<ProgramRunner, ExecutionEnvironment> pair =
    ExternalSystemUtil.createRunner(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, mySystemId);

  if (pair == null) return false;

  final ProgramRunner runner = pair.first;
  final ExecutionEnvironment environment = pair.second;

  return runner.canRun(DefaultRunExecutor.EXECUTOR_ID, environment.getRunProfile());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemBeforeRunTaskProvider.java

示例7: onProjectRename

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
private static <V> void onProjectRename(@NotNull Map<IntegrationKey, V> data,
                                        @NotNull String oldName,
                                        @NotNull String newName)
{
  Set<IntegrationKey> keys = ContainerUtilRt.newHashSet(data.keySet());
  for (IntegrationKey key : keys) {
    if (!key.getIdeProjectName().equals(oldName)) {
      continue;
    }
    IntegrationKey newKey = new IntegrationKey(newName,
                                               key.getIdeProjectLocationHash(),
                                               key.getExternalSystemId(),
                                               key.getExternalProjectConfigPath());
    V value = data.get(key);
    data.put(newKey, value);
    data.remove(key);
    if (value instanceof Consumer) {
      //noinspection unchecked
      ((Consumer)value).consume(newKey);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExternalSystemFacadeManager.java

示例8: isTaskActive

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
public boolean isTaskActive(@NotNull ExternalSystemTaskId id) {
  Map<IntegrationKey, Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings>> copy
    = ContainerUtilRt.newHashMap(myRemoteFacades);
  for (Map.Entry<IntegrationKey, Pair<RemoteExternalSystemFacade, ExternalSystemExecutionSettings>> entry : copy.entrySet()) {
    try {
      if (entry.getValue().first.isTaskInProgress(id)) {
        return true;
      }
    }
    catch (RemoteException e) {
      myLock.lock();
      try {
        myRemoteFacades.remove(entry.getKey());
        myFacadeWrappers.remove(entry.getKey());
      }
      finally {
        myLock.unlock();
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ExternalSystemFacadeManager.java

示例9: doExecute

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected void doExecute() throws Exception {
  final ExternalSystemFacadeManager manager = ServiceManager.getService(ExternalSystemFacadeManager.class);
  ExternalSystemExecutionSettings settings = ExternalSystemApiUtil.getExecutionSettings(getIdeProject(),
                                                                                        getExternalProjectPath(),
                                                                                        getExternalSystemId());
  RemoteExternalSystemFacade facade = manager.getFacade(getIdeProject(), getExternalProjectPath(), getExternalSystemId());
  RemoteExternalSystemTaskManager taskManager = facade.getTaskManager();
  List<String> taskNames = ContainerUtilRt.map2List(myTasksToExecute, MAPPER);

  final List<String> vmOptions = parseCmdParameters(myVmOptions);
  final List<String> scriptParametersList = parseCmdParameters(myScriptParameters);

  taskManager.executeTasks(getId(), taskNames, getExternalProjectPath(), settings, vmOptions, scriptParametersList, myDebuggerSetup);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ExternalSystemExecuteTaskTask.java

示例10: scheduleCollapseStateAppliance

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
/**
 * Schedules 'collapse/expand' state restoring for the given path. We can't do that immediately from the tree model listener
 * as there is a possible case that other listeners have not been notified about the model state change, hence, attempt to define
 * 'collapse/expand' state may bring us to the inconsistent state.
 *
 * @param path  target path
 */
private void scheduleCollapseStateAppliance(@NotNull TreePath path) {
  myPathsToProcessCollapseState.add(path);
  myCollapseStateAlarm.cancelAllRequests();
  myCollapseStateAlarm.addRequest(new Runnable() {
    @Override
    public void run() {
      // We assume that the paths collection is modified only from the EDT, so, ConcurrentModificationException doesn't have
      // a chance.
      // Another thing is that we sort the paths in order to process the longest first. That is related to the JTree specifics
      // that it automatically expands parent paths on child path expansion.
      List<TreePath> paths = ContainerUtilRt.newArrayList(myPathsToProcessCollapseState);
      myPathsToProcessCollapseState.clear();
      Collections.sort(paths, PATH_COMPARATOR);
      for (TreePath treePath : paths) {
        applyCollapseState(treePath);
      }
      final TreePath rootPath = new TreePath(getModel().getRoot());
      if (isCollapsed(rootPath)) {
        expandPath(rootPath);
      }
    }
  }, COLLAPSE_STATE_PROCESSING_DELAY_MILLIS);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ExternalSystemTasksTree.java

示例11: assertMapsEqual

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
public static void assertMapsEqual(@NotNull Map<?, ?> expected, @NotNull Map<?, ?> actual) {
  Map<?, ?> local = ContainerUtilRt.newHashMap(expected);
  for (Map.Entry<?, ?> entry : actual.entrySet()) {
    Object expectedValue = local.remove(entry.getKey());
    if (expectedValue == null) {
      Assert.fail(String.format("Expected to find '%s' -> '%s' mapping but it doesn't exist", entry.getKey(), entry.getValue()));
    }
    if (!expectedValue.equals(entry.getValue())) {
      Assert.fail(
        String.format("Expected to find '%s' value for the key '%s' but got '%s'", expectedValue, entry.getKey(), entry.getValue())
      );
    }
  }
  if (!local.isEmpty()) {
    Assert.fail("No mappings found for the following keys: " + local.keySet());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ExternalSystemTestUtil.java

示例12: atomCondition

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@Test
public void atomCondition() {
  ArrangementAtomMatchCondition condition = new ArrangementAtomMatchCondition(FIELD);
  
  StdArrangementEntryMatcher matcher = new StdArrangementEntryMatcher(condition);
  assertEquals(condition, matcher.getCondition());

  final TypeAwareArrangementEntry fieldEntry = myMockery.mock(TypeAwareArrangementEntry.class, "field");
  final TypeAwareArrangementEntry classEntry = myMockery.mock(TypeAwareArrangementEntry.class, "class");
  final ModifierAwareArrangementEntry publicEntry = myMockery.mock(ModifierAwareArrangementEntry.class, "public");
  myMockery.checking(new Expectations() {{
    allowing(fieldEntry).getTypes(); will(returnValue(ContainerUtilRt.newHashSet(FIELD)));
    allowing(classEntry).getTypes(); will(returnValue(ContainerUtilRt.newHashSet(CLASS)));
    allowing(publicEntry).getModifiers(); will(returnValue(ContainerUtilRt.newHashSet(PUBLIC)));
  }});
  
  assertTrue(matcher.isMatched(fieldEntry));
  assertFalse(matcher.isMatched(classEntry));
  assertFalse(matcher.isMatched(publicEntry));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:StandardArrangementEntryMatcherTest.java

示例13: buildMatchers

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@Nullable
@Override
public Collection<ArrangementEntryMatcher> buildMatchers() {
  List<ArrangementEntryMatcher> result = ContainerUtilRt.newArrayList(myMatchers);
  Collection<ArrangementAtomMatchCondition> entryTokens = context.get(StdArrangementTokenType.ENTRY_TYPE);
  if (entryTokens!= null) {
    result.add(new ByTypeArrangementEntryMatcher(entryTokens));
  }
  Collection<ArrangementAtomMatchCondition> modifierTokens = context.get(StdArrangementTokenType.MODIFIER);
  if (modifierTokens != null) {
    result.add(new ByModifierArrangementEntryMatcher(modifierTokens));
  }
  if (myNamePattern != null) {
    result.add(new ByNameArrangementEntryMatcher(myNamePattern));
  }
  if (myNamespacePattern != null) {
    result.add(new ByNamespaceArrangementEntryMatcher(myNamespacePattern));
  }
  if (myText != null) {
    result.add(new ByTextArrangementEntryMatcher(myText));
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:StdArrangementEntryMatcher.java

示例14: findRoots

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@NotNull
public static Collection<VcsDirectoryMapping> findRoots(@NotNull VirtualFile rootDir, @NotNull Project project)
  throws IllegalArgumentException {
  if (!rootDir.isDirectory()) {
    throw new IllegalArgumentException(
      "Can't find VCS at the target file system path. Reason: expected to find a directory there but it's not. The path: "
      + rootDir.getParent()
    );
  }
  Collection<VcsRoot> roots = ServiceManager.getService(project, VcsRootDetector.class).detect(rootDir);
  Collection<VcsDirectoryMapping> result = ContainerUtilRt.newArrayList();
  for (VcsRoot vcsRoot : roots) {
    VirtualFile vFile = vcsRoot.getPath();
    AbstractVcs rootVcs = vcsRoot.getVcs();
    if (rootVcs != null && vFile != null) {
      result.add(new VcsDirectoryMapping(vFile.getPath(), rootVcs.getName()));
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:VcsUtil.java

示例15: buildCondition

import com.intellij.util.containers.ContainerUtilRt; //导入依赖的package包/类
@Nullable
private Pair<ArrangementMatchCondition, ArrangementSettingsToken> buildCondition() {
  List<ArrangementMatchCondition> conditions = ContainerUtilRt.newArrayList();
  ArrangementSettingsToken orderType = null;
  for (ArrangementUiComponent component : myComponents.values()) {
    if (!component.isEnabled() || !component.isSelected()) {
      continue;
    }
    ArrangementSettingsToken token = component.getToken();
    if (token != null && StdArrangementTokenType.ORDER.is(token)) {
      orderType = token;
    }
    else {
      conditions.add(component.getMatchCondition());
    }
  }
  if (!conditions.isEmpty()) {
    if (orderType == null) {
      orderType = StdArrangementTokens.Order.KEEP;
    }
    return Pair.create(ArrangementUtil.combine(conditions.toArray(new ArrangementMatchCondition[conditions.size()])), orderType);
  }
  else {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ArrangementMatchingRuleEditor.java


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