當前位置: 首頁>>代碼示例>>Java>>正文


Java ContainerUtil.getOrCreate方法代碼示例

本文整理匯總了Java中com.intellij.util.containers.ContainerUtil.getOrCreate方法的典型用法代碼示例。如果您正苦於以下問題:Java ContainerUtil.getOrCreate方法的具體用法?Java ContainerUtil.getOrCreate怎麽用?Java ContainerUtil.getOrCreate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.util.containers.ContainerUtil的用法示例。


在下文中一共展示了ContainerUtil.getOrCreate方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: increment

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public synchronized void increment(@NotNull String groupName,
                                   @NotNull NotificationSource source,
                                   @NotNull NotificationCategory category,
                                   @NotNull ProjectSystemId projectSystemId) {

  final TObjectIntHashMap<NotificationCategory> counter =
    ContainerUtil.getOrCreate(
      ContainerUtil.getOrCreate(
        ContainerUtil.getOrCreate(
          map,
          projectSystemId,
          ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap()),
        groupName,
        ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap()
      ),
      source,
      new MyTObjectIntHashMap<NotificationCategory>()
    );
  if (!counter.increment(category)) counter.put(category, 1);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:21,代碼來源:MessageCounter.java

示例2: remove

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public synchronized void remove(@Nullable final String groupName,
                                @NotNull final NotificationSource notificationSource,
                                @NotNull final ProjectSystemId projectSystemId) {
  final Map<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>> groupMap =
    ContainerUtil.getOrCreate(
      map,
      projectSystemId,
      ContainerUtil.<String, Map<NotificationSource, TObjectIntHashMap<NotificationCategory>>>newHashMap());
  if (groupName != null) {
    final TObjectIntHashMap<NotificationCategory> counter = ContainerUtil.getOrCreate(
      ContainerUtil.getOrCreate(
        groupMap,
        groupName,
        ContainerUtil.<NotificationSource, TObjectIntHashMap<NotificationCategory>>newHashMap()
      ),
      notificationSource,
      new MyTObjectIntHashMap<NotificationCategory>()
    );
    counter.clear();
  }
  else {
    for (Map<NotificationSource, TObjectIntHashMap<NotificationCategory>> sourceMap : groupMap.values()) {
      sourceMap.remove(notificationSource);
    }
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:27,代碼來源:MessageCounter.java

示例3: getState

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public Map<String, Set<String>> getState() {
  final Map<String, Set<String>> result = ContainerUtil.newHashMap();
  Consumer<PostfixTemplateCheckedTreeNode> consumer = new Consumer<PostfixTemplateCheckedTreeNode>() {
    @Override
    public void consume(PostfixTemplateCheckedTreeNode template) {
      if (!template.isChecked()) {
        Set<String> templatesForLanguage =
          ContainerUtil.getOrCreate(result, template.getLang(), PostfixTemplatesSettings.SET_FACTORY);
        templatesForLanguage.add(template.getTemplate().getKey());
      }
    }
  };
  visit(consumer);

  return result;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:PostfixTemplatesCheckboxTree.java

示例4: checkList

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
public SvnMergeInfoCache.MergeCheckResult checkList(@NotNull final SvnChangeList list, final String branchPath) {
  synchronized (myCalculatedLock) {
    SvnMergeInfoCache.MergeCheckResult result;
    final long revision = calculateCopyRevision(branchPath);
    if (revision != -1 && revision >= list.getNumber()) {
      result = SvnMergeInfoCache.MergeCheckResult.COMMON;
    }
    else {
      result = ContainerUtil.getOrCreate(myAlreadyCalculatedMap, list.getNumber(), new Factory<SvnMergeInfoCache.MergeCheckResult>() {
        @Override
        public SvnMergeInfoCache.MergeCheckResult create() {
          return checkAlive(list, branchPath);
        }
      });
    }
    return result;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:BranchInfo.java

示例5: createFileProvider

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
private static ISVNStatusFileProvider createFileProvider(@NotNull Map<String, SvnScopeZipper.MyDirNonRecursive> nonRecursiveMap) {
  final Map<String, Map<String, File>> result = ContainerUtil.newHashMap();

  for (SvnScopeZipper.MyDirNonRecursive item : nonRecursiveMap.values()) {
    File file = item.getDir().getIOFile();

    Map<String, File> fileMap = ContainerUtil.getOrCreate(result, file.getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);
    for (FilePath path : item.getChildrenList()) {
      fileMap.put(path.getName(), path.getIOFile());
    }

    // also add currently processed file to the map of its parent, as there are cases when SVNKit calls ISVNStatusFileProvider with file
    // parent (and not file that was passed to doStatus()), gets null result and does not provide any status
    // see http://issues.tmatesoft.com/issue/SVNKIT-567 for details
    if (file.getParentFile() != null) {
      Map<String, File> parentMap = ContainerUtil.getOrCreate(result, file.getParentFile().getAbsolutePath(), NAME_TO_FILE_MAP_FACTORY);

      parentMap.put(file.getName(), file);
    }
  }

  return new ISVNStatusFileProvider() {
    @Override
    public Map<String, File> getChildrenFiles(File parent) {
      return result.get(parent.getAbsolutePath());
    }
  };
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:30,代碼來源:SvnChangeProvider.java

示例6: getChildren

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
@NotNull
@Override
public Collection<? extends AbstractTreeNode> getChildren() {
  final ServerConnection<?> connection = getConnection();
  if (connection == null) {
    return Collections.emptyList();
  }

  Map<DeploymentGroup, GroupNode> group2node = new HashMap<DeploymentGroup, GroupNode>();
  final List<AbstractTreeNode> children = new ArrayList<AbstractTreeNode>();
  for (Deployment deployment : connection.getDeployments()) {
    final String groupName = deployment.getGroup();
    if (groupName == null) {
      children.add(new DeploymentNodeImpl(connection, this, deployment));
    }
    else {
      Map<String, DeploymentGroup> groups
        = ContainerUtil.getOrCreate(myServer2DeploymentGroups, getServer(), new Factory<Map<String, DeploymentGroup>>() {
        @Override
        public Map<String, DeploymentGroup> create() {
          return new HashMap<String, DeploymentGroup>();
        }
      });

      final DeploymentGroup group
        = ContainerUtil.getOrCreate(groups, groupName, new Factory<DeploymentGroup>() {
        @Override
        public DeploymentGroup create() {
          return new DeploymentGroup(groupName);
        }
      });

      ContainerUtil.getOrCreate(group2node, group, new Factory<GroupNode>() {
        @Override
        public GroupNode create() {
          GroupNode result = new GroupNode(connection, RemoteServerNode.this, group);
          children.add(result);
          return result;
        }
      });
    }
  }
  return children;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:45,代碼來源:ServersTreeStructure.java

示例7: disableTemplate

import com.intellij.util.containers.ContainerUtil; //導入方法依賴的package包/類
public void disableTemplate(PostfixTemplate template, String langForProvider) {
  Set<String> state = ContainerUtil.getOrCreate(myLangToDisabledTemplates, langForProvider, SET_FACTORY);
  state.add(template.getKey());
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:PostfixTemplatesSettings.java


注:本文中的com.intellij.util.containers.ContainerUtil.getOrCreate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。