本文整理汇总了Java中com.intellij.util.containers.ContainerUtilRt.newArrayList方法的典型用法代码示例。如果您正苦于以下问题:Java ContainerUtilRt.newArrayList方法的具体用法?Java ContainerUtilRt.newArrayList怎么用?Java ContainerUtilRt.newArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ContainerUtilRt
的用法示例。
在下文中一共展示了ContainerUtilRt.newArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: multiResolveFromAlias
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
private static GroovyResolveResult[] multiResolveFromAlias(@NotNull GrAnnotation alias, @NotNull String name, @NotNull PsiAnnotation annotationCollector) {
List<GroovyResolveResult> result = ContainerUtilRt.newArrayList();
List<GrAnnotation> annotations = ContainerUtilRt.newArrayList();
GrAnnotationCollector.collectAnnotations(annotations, alias, annotationCollector);
for (GrAnnotation annotation : annotations) {
final PsiElement clazz = annotation.getClassReference().resolve();
if (clazz instanceof PsiClass && ((PsiClass)clazz).isAnnotationType()) {
if (GroovyCommonClassNames.GROOVY_TRANSFORM_ANNOTATION_COLLECTOR.equals(((PsiClass)clazz).getQualifiedName())) continue;
for (PsiMethod method : ((PsiClass)clazz).findMethodsByName(name, false)) {
result.add(new GroovyResolveResultImpl(method, true));
}
}
}
return result.toArray(new GroovyResolveResult[result.size()]);
}
示例2: 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;
}
示例3: 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;
}
示例4: multiResolveFromAlias
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
private static GroovyResolveResult[] multiResolveFromAlias(@NotNull GrAnnotation alias, @NotNull String name, @NotNull GrAnnotation annotationCollector) {
List<GroovyResolveResult> result = ContainerUtilRt.newArrayList();
List<GrAnnotation> annotations = ContainerUtilRt.newArrayList();
GrAnnotationCollector.collectAnnotations(annotations, alias, annotationCollector);
for (GrAnnotation annotation : annotations) {
final PsiElement clazz = annotation.getClassReference().resolve();
if (clazz instanceof PsiClass && ((PsiClass)clazz).isAnnotationType()) {
if (GroovyCommonClassNames.GROOVY_TRANSFORM_ANNOTATION_COLLECTOR.equals(((PsiClass)clazz).getQualifiedName())) continue;
for (PsiMethod method : ((PsiClass)clazz).findMethodsByName(name, false)) {
result.add(new GroovyResolveResultImpl(method, true));
}
}
}
return result.toArray(new GroovyResolveResult[result.size()]);
}
示例5: mixNames
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
/**
* Tries to ensure that given libraries have distinct names, i.e. traverses all of them and tries to generate
* unique name for those with equal names.
*
* @param libraries libraries to process
*/
@SuppressWarnings("MethodMayBeStatic")
public void mixNames(@NotNull Collection<DataNode<LibraryData>> libraries) {
if (libraries.isEmpty()) {
return;
}
Map<String, Wrapped> names = ContainerUtilRt.newHashMap();
List<Wrapped> data = ContainerUtilRt.newArrayList();
for (DataNode<LibraryData> library : libraries) {
Wrapped wrapped = new Wrapped(library.getData());
data.add(wrapped);
}
boolean mixed = false;
while (!mixed) {
mixed = doMixNames(data, names);
}
}
示例6: filterExistingModules
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@NotNull
private Collection<DataNode<ModuleData>> filterExistingModules(@NotNull Collection<DataNode<ModuleData>> modules,
@NotNull Project project)
{
Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
for (DataNode<ModuleData> node : modules) {
ModuleData moduleData = node.getData();
Module module = myProjectStructureHelper.findIdeModule(moduleData, project);
if (module == null) {
result.add(node);
}
else {
module.setOption(ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, moduleData.getOwner().toString());
module.setOption(ExternalSystemConstants.LINKED_PROJECT_PATH_KEY, moduleData.getLinkedExternalProjectPath());
}
}
return result;
}
示例7: testEnsureSize
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@Test
public void testEnsureSize() throws Exception {
List<ExternalTaskExecutionInfo> tasks = ContainerUtilRt.newArrayList();
// test task list widening
myModel.setTasks(tasks);
myModel.ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER);
Assert.assertEquals("task list widening failed", ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize());
// test task list reduction
for (int i = 0; i < ExternalSystemConstants.RECENT_TASKS_NUMBER + 1; i++) {
tasks.add(new ExternalTaskExecutionInfo(new ExternalSystemTaskExecutionSettings(), "task" + i));
}
myModel.setTasks(tasks);
Assert.assertEquals(ExternalSystemConstants.RECENT_TASKS_NUMBER + 1, myModel.getSize());
myModel.ensureSize(ExternalSystemConstants.RECENT_TASKS_NUMBER);
Assert.assertEquals("task list reduction failed", ExternalSystemConstants.RECENT_TASKS_NUMBER, myModel.getSize());
}
示例8: importData
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public <T> void importData(@Nonnull Key<T> key, @Nonnull Collection<DataNode<T>> nodes, @Nonnull Project project, boolean synchronous) {
ensureTheDataIsReadyToUse(nodes);
List<ProjectDataService<?, ?>> services = myServices.getValue().get(key);
if (services == null) {
LOG.warn(String.format(
"Can't import data nodes '%s'. Reason: no service is registered for key %s. Available services for %s",
nodes, key, myServices.getValue().keySet()
));
}
else {
for (ProjectDataService<?, ?> service : services) {
((ProjectDataService<T, ?>)service).importData(nodes, project, synchronous);
}
}
Collection<DataNode<?>> children = ContainerUtilRt.newArrayList();
for (DataNode<T> node : nodes) {
children.addAll(node.getChildren());
}
importData(children, project, synchronous);
}
示例9: filterExistingModules
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@Nonnull
@RequiredDispatchThread
private Collection<DataNode<ModuleData>> filterExistingModules(@Nonnull Collection<DataNode<ModuleData>> modules, @Nonnull Project project) {
Collection<DataNode<ModuleData>> result = ContainerUtilRt.newArrayList();
for (DataNode<ModuleData> node : modules) {
ModuleData moduleData = node.getData();
Module module = ProjectStructureHelper.findIdeModule(moduleData, project);
if (module == null) {
result.add(node);
}
else {
setModuleOptions(module, null, node);
}
}
return result;
}
示例10: 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;
}
}
示例11: processOrphanModules
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
private void processOrphanModules() {
if (myProject.isDisposed()) return;
if (ExternalSystemDebugEnvironment.DEBUG_ORPHAN_MODULES_PROCESSING) {
LOG.info(String.format("Checking for orphan modules. External paths returned by external system: '%s'", myExternalModulePaths));
}
List<Module> orphanIdeModules = ContainerUtilRt.newArrayList();
String externalSystemIdAsString = myExternalSystemId.toString();
for (Module module : ModuleManager.getInstance(myProject).getModules()) {
String s = ExternalSystemApiUtil.getExtensionSystemOption(module, ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY);
String p = ExternalSystemApiUtil.getExtensionSystemOption(module, ExternalSystemConstants.LINKED_PROJECT_PATH_KEY);
if (ExternalSystemDebugEnvironment.DEBUG_ORPHAN_MODULES_PROCESSING) {
LOG.info(String.format("IDE module: EXTERNAL_SYSTEM_ID_KEY - '%s', LINKED_PROJECT_PATH_KEY - '%s'.", s, p));
}
if (externalSystemIdAsString.equals(s) && !myExternalModulePaths.contains(p)) {
orphanIdeModules.add(module);
if (ExternalSystemDebugEnvironment.DEBUG_ORPHAN_MODULES_PROCESSING) {
LOG.info(String.format("External paths doesn't contain IDE module LINKED_PROJECT_PATH_KEY anymore => add to orphan IDE modules."));
}
}
}
if (!orphanIdeModules.isEmpty()) {
ruleOrphanModules(orphanIdeModules, myProject, myExternalSystemId);
}
}
示例12: getSupportedMatchingTokens
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@Nullable
@Override
public List<CompositeArrangementSettingsToken> getSupportedMatchingTokens() {
return ContainerUtilRt.newArrayList(
new CompositeArrangementSettingsToken(TYPE, SUPPORTED_TYPES),
new CompositeArrangementSettingsToken(StdArrangementTokens.Regexp.NAME),
new CompositeArrangementSettingsToken(StdArrangementTokens.Regexp.XML_NAMESPACE),
new CompositeArrangementSettingsToken(ORDER, KEEP, BY_NAME)
);
}
示例13: getSupportedMatchingTokens
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@Nullable
@Override
public List<CompositeArrangementSettingsToken> getSupportedMatchingTokens() {
return ContainerUtilRt.newArrayList(
new CompositeArrangementSettingsToken(TYPE, SUPPORTED_TYPES),
new CompositeArrangementSettingsToken(MODIFIER, SUPPORTED_MODIFIERS),
new CompositeArrangementSettingsToken(StdArrangementTokens.Regexp.NAME),
new CompositeArrangementSettingsToken(ORDER, KEEP, BY_NAME)
);
}
示例14: letTheMagicBegin
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static void letTheMagicBegin(@NotNull Project project) {
List<MyEntry> autoImportAware = ContainerUtilRt.newArrayList();
Collection<ExternalSystemManager<?, ?, ?, ?, ?>> managers = ExternalSystemApiUtil.getAllManagers();
for (ExternalSystemManager<?, ?, ?, ?, ?> manager : managers) {
AbstractExternalSystemSettings<?, ?, ?> systemSettings = manager.getSettingsProvider().fun(project);
ExternalSystemAutoImportAware defaultImportAware = createDefault(systemSettings);
final ExternalSystemAutoImportAware aware;
if (manager instanceof ExternalSystemAutoImportAware) {
aware = combine(defaultImportAware, (ExternalSystemAutoImportAware)manager);
}
else {
aware = defaultImportAware;
}
autoImportAware.add(new MyEntry(manager.getSystemId(), systemSettings, aware));
}
MyEntry[] entries = autoImportAware.toArray(new MyEntry[autoImportAware.size()]);
ExternalSystemAutoImporter autoImporter = new ExternalSystemAutoImporter(
project,
ServiceManager.getService(ProjectDataManager.class),
entries
);
final MessageBus messageBus = project.getMessageBus();
messageBus.connect(project).subscribe(VirtualFileManager.VFS_CHANGES, autoImporter);
EditorFactory.getInstance().getEventMulticaster().addDocumentListener(autoImporter, project);
}
示例15: patchLinkedProjects
import com.intellij.util.containers.ContainerUtilRt; //导入方法依赖的package包/类
@Nullable
private static Map<String, String> patchLinkedProjects(@NotNull Project project) {
GradleSettings settings = GradleSettings.getInstance(project);
Collection<GradleProjectSettings> correctedSettings = ContainerUtilRt.newArrayList();
Map<String/* old path */, String/* new path */> adjustedPaths = ContainerUtilRt.newHashMap();
for (GradleProjectSettings projectSettings : settings.getLinkedProjectsSettings()) {
String oldPath = projectSettings.getExternalProjectPath();
if (oldPath != null && new File(oldPath).isFile() && FileUtilRt.extensionEquals(oldPath, GradleConstants.EXTENSION)) {
try {
String newPath = new File(oldPath).getParentFile().getCanonicalPath();
projectSettings.setExternalProjectPath(newPath);
adjustedPaths.put(oldPath, newPath);
}
catch (IOException e) {
LOG.warn(String.format(
"Unexpected exception occurred on attempt to re-point linked gradle project path from build.gradle to its parent dir. Path: %s",
oldPath
), e);
}
}
correctedSettings.add(projectSettings);
}
if (adjustedPaths.isEmpty()) {
return null;
}
settings.setLinkedProjectsSettings(correctedSettings);
return adjustedPaths;
}