本文整理汇总了Java中com.intellij.util.Chunk.getNodes方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.getNodes方法的具体用法?Java Chunk.getNodes怎么用?Java Chunk.getNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.Chunk
的用法示例。
在下文中一共展示了Chunk.getNodes方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: sort
import com.intellij.util.Chunk; //导入方法依赖的package包/类
@Override
public void sort(Chunk<Module> moduleChunk, @NotNull Compiler[] compilers, Class<? extends Compiler> aClass)
{
if(aClass == TranslatingCompiler.class)
{
boolean needSwap = false;
for(Module module : moduleChunk.getNodes())
{
if(ModuleUtilCore.getExtension(module, IkvmModuleExtension.class) != null)
{
needSwap = true;
break;
}
}
if(needSwap)
{
int javaIndex = indexOfViaInstanceOf(compilers, JavaCompiler.class);
int dotNetIndex = indexOfViaInstanceOf(compilers, DotNetCompiler.class);
if(javaIndex > dotNetIndex)
{
ArrayUtil.swap(compilers, javaIndex, dotNetIndex);
}
}
}
}
示例2: recalculateChunkToFilesMap
import com.intellij.util.Chunk; //导入方法依赖的package包/类
private static void recalculateChunkToFilesMap(CompileContextEx context,
List<Chunk<Module>> allChunks,
VirtualFile[] snapshot,
Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {
final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
for (Chunk<Module> moduleChunk : allChunks) {
List<VirtualFile> files = Collections.emptyList();
for (Module module : moduleChunk.getNodes()) {
final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
if (moduleFiles != null) {
files = ContainerUtil.concat(files, moduleFiles);
}
}
chunkMap.put(moduleChunk, files);
}
}
示例3: removeDummyNodes
import com.intellij.util.Chunk; //导入方法依赖的package包/类
private List<Chunk<ModuleSourceSet>> removeDummyNodes(List<Chunk<ModuleSourceSet>> chunks) {
List<Chunk<ModuleSourceSet>> result = new ArrayList<Chunk<ModuleSourceSet>>(chunks.size());
for (Chunk<ModuleSourceSet> chunk : chunks) {
Set<ModuleSourceSet> nodes = new LinkedHashSet<ModuleSourceSet>();
for (ModuleSourceSet sourceSet : chunk.getNodes()) {
if (!isDummy(sourceSet)) {
nodes.add(sourceSet);
}
}
result.add(new Chunk<ModuleSourceSet>(nodes));
}
return result;
}
示例4: getCommonType
import com.intellij.util.Chunk; //导入方法依赖的package包/类
@Nullable
private static ModuleSourceSet.Type getCommonType(@NotNull Chunk<ModuleSourceSet> cycle) {
ModuleSourceSet.Type type = null;
for (ModuleSourceSet set : cycle.getNodes()) {
if (type == null) {
type = set.getType();
}
else if (type != set.getType()) {
return null;
}
}
return type;
}
示例5: getPreferredModuleEncoding
import com.intellij.util.Chunk; //导入方法依赖的package包/类
@Nullable
public static Charset getPreferredModuleEncoding(Chunk<Module> chunk) {
CompilerEncodingService service = null;
for (Module module : chunk.getNodes()) {
if (service == null) {
service = getInstance(module.getProject());
}
final Charset charset = service.getPreferredModuleEncoding(module);
if (charset != null) {
return charset;
}
}
return null;
}
示例6: MyTableModel
import com.intellij.util.Chunk; //导入方法依赖的package包/类
private MyTableModel(List<Chunk<Module>> chunks) {
for (final Chunk<Module> chunk : chunks) {
final ListWithSelection<String> item = new ListWithSelection<String>();
for (final Module module : chunk.getNodes()) {
item.add(module.getName());
}
item.selectFirst();
myItems.add(new Pair<String, ListWithSelection>(createCycleName(chunk), item));
}
}
示例7: createCycleName
import com.intellij.util.Chunk; //导入方法依赖的package包/类
private static String createCycleName(Chunk<Module> chunk) {
final StringBuilder buf = new StringBuilder();
for (Module module : chunk.getNodes()) {
if (buf.length() > 0) {
buf.append(", ");
}
buf.append(module.getName());
}
buf.insert(0, "[");
buf.append("]");
return buf.toString();
}
示例8: check
import com.intellij.util.Chunk; //导入方法依赖的package包/类
@Override
public void check(ProjectStructureProblemsHolder problemsHolder) {
final Graph<Chunk<ModuleRootModel>> graph = ModuleCompilerUtil.toChunkGraph(myContext.getModulesConfigurator().createGraphGenerator());
final Collection<Chunk<ModuleRootModel>> chunks = graph.getNodes();
List<String> cycles = new ArrayList<String>();
for (Chunk<ModuleRootModel> chunk : chunks) {
final Set<ModuleRootModel> modules = chunk.getNodes();
List<String> names = new ArrayList<String>();
for (ModuleRootModel model : modules) {
names.add(model.getModule().getName());
}
if (modules.size() > 1) {
cycles.add(StringUtil.join(names, ", "));
}
}
if (!cycles.isEmpty()) {
final Project project = myContext.getProject();
final PlaceInProjectStructureBase place = new PlaceInProjectStructureBase(project, ProjectStructureConfigurable.getInstance(project).createModulesPlace(), this);
final String message;
final String description;
if (cycles.size() > 1) {
message = "Circular dependencies";
@NonNls final String br = "<br> ";
StringBuilder cyclesString = new StringBuilder();
for (int i = 0; i < cycles.size(); i++) {
cyclesString.append(br).append(i + 1).append(". ").append(cycles.get(i));
}
description = ProjectBundle.message("module.circular.dependency.warning.description", cyclesString);
}
else {
message = ProjectBundle.message("module.circular.dependency.warning.short", cycles.get(0));
description = null;
}
problemsHolder.registerProblem(new ProjectStructureProblemDescription(message, description, place,
ProjectStructureProblemType.warning("module-circular-dependency"),
Collections.<ConfigurationErrorQuickFix>emptyList()));
}
}
示例9: addTranslatingCompiler
import com.intellij.util.Chunk; //导入方法依赖的package包/类
public void addTranslatingCompiler(@NotNull final TranslatingCompiler compiler, final Set<FileType> inputTypes, final Set<FileType> outputTypes) {
myTranslators.add(compiler);
myCompilerToInputTypes.put(compiler, inputTypes);
myCompilerToOutputTypes.put(compiler, outputTypes);
final List<Chunk<Compiler>> chunks = ModuleCompilerUtil.getSortedChunks(createCompilerGraph((List<Compiler>)(List)myTranslators));
myTranslators.clear();
for (Chunk<Compiler> chunk : chunks) {
for (Compiler chunkCompiler : chunk.getNodes()) {
myTranslators.add((TranslatingCompiler)chunkCompiler);
}
}
}
示例10: recalculateChunkToFilesMap
import com.intellij.util.Chunk; //导入方法依赖的package包/类
private static void recalculateChunkToFilesMap(CompileContextEx context, List<Chunk<Module>> allChunks, VirtualFile[] snapshot, Map<Chunk<Module>, Collection<VirtualFile>> chunkMap) {
final Map<Module, List<VirtualFile>> moduleToFilesMap = CompilerUtil.buildModuleToFilesMap(context, snapshot);
for (Chunk<Module> moduleChunk : allChunks) {
List<VirtualFile> files = Collections.emptyList();
for (Module module : moduleChunk.getNodes()) {
final List<VirtualFile> moduleFiles = moduleToFilesMap.get(module);
if (moduleFiles != null) {
files = ContainerUtil.concat(files, moduleFiles);
}
}
chunkMap.put(moduleChunk, files);
}
}
示例11: ModuleChunk
import com.intellij.util.Chunk; //导入方法依赖的package包/类
public ModuleChunk(CompileContextEx context, Chunk<Module> chunk, Map<Module, List<VirtualFile>> moduleToFilesMap) {
super(chunk.getNodes());
myContext = context;
for (final Module module : chunk.getNodes()) {
final List<VirtualFile> files = moduleToFilesMap.get(module);
// Important!!! Collections in the myModuleToFilesMap must be modifiable copies of the corresponding collections
// from the moduleToFilesMap. This is needed to support SourceTransforming compilers
myModuleToFilesMap.put(module, files == null ? Collections.<VirtualFile>emptyList() : new ArrayList<VirtualFile>(files));
}
}
示例12: validateConfiguration
import com.intellij.util.Chunk; //导入方法依赖的package包/类
@Override
public boolean validateConfiguration(CompileScope scope)
{
final List<Chunk<Module>> chunks = ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(scope.getAffectedModules()));
for(final Chunk<Module> chunk : chunks)
{
final Set<Module> chunkModules = chunk.getNodes();
if(chunkModules.size() <= 1)
{
continue; // no need to check one-module chunks
}
for(Module chunkModule : chunkModules)
{
if(myCompilerConfiguration.getAnnotationProcessingConfiguration(chunkModule).isEnabled())
{
showCyclesNotSupportedForAnnotationProcessors(chunkModules.toArray(new Module[chunkModules.size()]));
return false;
}
}
}
final JavacCompiler compiler = getBackEndCompiler();
final boolean previousValue = compiler.setAnnotationProcessorMode(true);
try
{
return compiler.checkCompiler(scope);
}
finally
{
compiler.setAnnotationProcessorMode(previousValue);
}
}