use of com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoProjectStructureDetector method detectRoots.
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir, @NotNull File[] children, @NotNull File base, @NotNull List<DetectedProjectRoot> result) {
Pattern pattern = Pattern.compile(".*\\.go");
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if (!filesByMask.isEmpty()) {
result.add(new DetectedProjectRoot(dir) {
@NotNull
@Override
public String getRootTypeName() {
return GoConstants.GO;
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
use of com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot in project intellij-elixir by KronicDeth.
the class ElixirProjectStructureDetector method detectRoots.
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir, @NotNull File[] children, @NotNull File base, @NotNull List<DetectedProjectRoot> result) {
Pattern pattern = Pattern.compile(".*\\.ex[s]*");
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if (!filesByMask.isEmpty()) {
result.add(new DetectedProjectRoot(dir) {
@NotNull
@Override
public String getRootTypeName() {
return "Elixir";
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
use of com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot in project intellij-community by JetBrains.
the class GroovySdkForProjectFromSourcesStep method updateDataModel.
@Override
public void updateDataModel() {
super.updateDataModel();
List<ModuleDescriptor> modules = new ArrayList<>();
for (DetectedProjectRoot root : myBuilder.getProjectRoots(myDetector)) {
final ModuleDescriptor descriptor = new ModuleDescriptor(root.getDirectory(), StdModuleTypes.JAVA, Collections.<DetectedSourceRoot>emptyList());
descriptor.addConfigurationUpdater(createModuleConfigurationUpdater());
modules.add(descriptor);
}
myProjectDescriptor.setModules(modules);
}
use of com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot in project intellij-community by JetBrains.
the class DetectedRootsChooser method setElements.
public void setElements(List<? extends DetectedRootData> roots) {
Set<String> rootTypes = new HashSet<>();
for (DetectedRootData root : roots) {
for (DetectedProjectRoot projectRoot : root.getAllRoots()) {
rootTypes.add(projectRoot.getRootTypeName());
}
}
myModel.setColumnInfos(new ColumnInfo[] { myIncludedColumn, ROOT_COLUMN, ROOT_TYPE_COLUMN });
int max = 0;
for (String rootType : rootTypes) {
max = Math.max(max, myTable.getFontMetrics(myTable.getFont()).stringWidth(rootType));
}
final TableColumn column = myTable.getColumnModel().getColumn(2);
//add space for combobox button
int width = max + 20;
column.setPreferredWidth(width);
column.setMaxWidth(width);
myTable.updateColumnSizes();
List<DetectedRootData> sortedRoots = new ArrayList<>(roots);
Collections.sort(sortedRoots, Comparator.comparing(DetectedRootData::getDirectory));
myModel.setItems(sortedRoots);
}
use of com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot in project intellij-community by JetBrains.
the class ModuleInsight method buildModuleDependencies.
private void buildModuleDependencies(final Map<File, ModuleDescriptor> contentRootToModules) {
final Set<File> moduleContentRoots = contentRootToModules.keySet();
for (File contentRoot : moduleContentRoots) {
final ModuleDescriptor checkedModule = contentRootToModules.get(contentRoot);
myProgress.setText2("Building library dependencies for module " + checkedModule.getName());
buildJarDependencies(checkedModule);
myProgress.setText2("Building module dependencies for module " + checkedModule.getName());
for (File aContentRoot : moduleContentRoots) {
final ModuleDescriptor aModule = contentRootToModules.get(aContentRoot);
if (checkedModule.equals(aModule)) {
// avoid self-dependencies
continue;
}
final Collection<? extends DetectedProjectRoot> aModuleRoots = aModule.getSourceRoots();
checkModules: for (DetectedProjectRoot srcRoot : checkedModule.getSourceRoots()) {
final Set<String> referencedBySourceRoot = mySourceRootToReferencedPackagesMap.get(srcRoot.getDirectory());
for (DetectedProjectRoot aSourceRoot : aModuleRoots) {
if (ContainerUtil.intersects(referencedBySourceRoot, mySourceRootToPackagesMap.get(aSourceRoot.getDirectory()))) {
checkedModule.addDependencyOn(aModule);
break checkModules;
}
}
}
}
}
}
Aggregations