本文整理汇总了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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
示例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());
}
};
}
示例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;
}
示例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());
}