本文整理汇总了Java中com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot类的典型用法代码示例。如果您正苦于以下问题:Java DetectedProjectRoot类的具体用法?Java DetectedProjectRoot怎么用?Java DetectedProjectRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DetectedProjectRoot类属于com.intellij.ide.util.projectWizard.importSources包,在下文中一共展示了DetectedProjectRoot类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: importFromSources
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
protected void importFromSources(File dir) {
myRootDir = dir;
try {
myProject = doCreateProject(getIprFile());
myBuilder.setBaseProjectPath(dir.getAbsolutePath());
List<DetectedRootData> list = RootDetectionProcessor.detectRoots(dir);
MultiMap<ProjectStructureDetector,DetectedProjectRoot> map = RootDetectionProcessor.createRootsMap(list);
myBuilder.setupProjectStructure(map);
for (ProjectStructureDetector detector : map.keySet()) {
List<ModuleWizardStep> steps = detector.createWizardSteps(myBuilder, myBuilder.getProjectDescriptor(detector), EmptyIcon.ICON_16);
for (ModuleWizardStep step : steps) {
if (step instanceof AbstractStepWithProgress<?>) {
performStep((AbstractStepWithProgress<?>)step);
}
}
}
myBuilder.commit(myProject, null, ModulesProvider.EMPTY_MODULES_PROVIDER);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ImportFromSourcesTestCase.java
示例2: runDetectors
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public Map<ProjectStructureDetector, List<DetectedProjectRoot>> runDetectors() {
if (!myBaseDir.isDirectory()) {
return Collections.emptyMap();
}
BitSet enabledDetectors = new BitSet(myDetectors.length);
enabledDetectors.set(0, myDetectors.length);
for (int i = 0; i < myDetectors.length; i++) {
myDetectedRoots[i] = new ArrayList<DetectedProjectRoot>();
}
processRecursively(myBaseDir, enabledDetectors);
final Map<ProjectStructureDetector, List<DetectedProjectRoot>> result = new LinkedHashMap<ProjectStructureDetector, List<DetectedProjectRoot>>();
for (int i = 0; i < myDetectors.length; i++) {
if (!myDetectedRoots[i].isEmpty()) {
result.put(myDetectors[i], myDetectedRoots[i]);
}
}
return result;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RootDetectionProcessor.java
示例3: removeIncompatibleRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private static void removeIncompatibleRoots(DetectedProjectRoot root, Map<File, DetectedRootData> rootData) {
DetectedRootData[] allRoots = rootData.values().toArray(new DetectedRootData[rootData.values().size()]);
for (DetectedRootData child : allRoots) {
final File childDirectory = child.getDirectory();
if (FileUtil.isAncestor(root.getDirectory(), childDirectory, true)) {
for (DetectedProjectRoot projectRoot : child.getAllRoots()) {
if (!root.canContainRoot(projectRoot)) {
child.removeRoot(projectRoot);
}
}
if (child.isEmpty()) {
rootData.remove(childDirectory);
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RootDetectionProcessor.java
示例4: setElements
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public void setElements(List<? extends DetectedRootData> roots) {
Set<String> rootTypes = new HashSet<String>();
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);
int width = max + 20;//add space for combobox button
column.setPreferredWidth(width);
column.setMaxWidth(width);
myTable.updateColumnSizes();
List<DetectedRootData> sortedRoots = new ArrayList<DetectedRootData>(roots);
Collections.sort(sortedRoots, new Comparator<DetectedRootData>() {
@Override
public int compare(DetectedRootData o1, DetectedRootData o2) {
return o1.getDirectory().compareTo(o2.getDirectory());
}
});
myModel.setItems(sortedRoots);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:DetectedRootsChooser.java
示例5: addRoot
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public DetectedProjectRoot addRoot(ProjectStructureDetector detector, DetectedProjectRoot root) {
for (Map.Entry<DetectedProjectRoot, Collection<ProjectStructureDetector>> entry : myRoots.entrySet()) {
final DetectedProjectRoot oldRoot = entry.getKey();
final DetectedProjectRoot combined = oldRoot.combineWith(root);
if (combined != null) {
myRoots.remove(oldRoot);
final Set<ProjectStructureDetector> values = new HashSet<ProjectStructureDetector>(entry.getValue());
values.add(detector);
myRoots.put(combined, values);
if (mySelectedRoot == oldRoot) {
mySelectedRoot = combined;
}
return combined;
}
}
myRoots.putValue(root, detector);
return root;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DetectedRootData.java
示例6: detectRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
LOG.info("Detecting roots under " + dir);
for (File child : children) {
final String name = child.getName();
if (FileUtilRt.extensionEquals(name, "py")) {
LOG.info("Found Python file " + child.getPath());
result.add(new DetectedContentRoot(dir, "Python", PythonModuleTypeBase.getInstance(), WebModuleType.getInstance()));
return DirectoryProcessingResult.SKIP_CHILDREN;
}
if ("node_modules".equals(name)) {
return DirectoryProcessingResult.SKIP_CHILDREN;
}
}
return DirectoryProcessingResult.PROCESS_CHILDREN;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PyProjectStructureDetector.java
示例7: detectRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
detectApplicationRoot(dir, result);
for (DetectedProjectRoot projectRoot : result) {
if ((projectRoot instanceof CloudGitProjectRoot) && FileUtil.isAncestor(projectRoot.getDirectory(), dir, true)) {
return detectJavaRoots(((CloudGitProjectRoot)projectRoot).getJavaSourceRootTypeName(), dir, children, base, result);
}
}
return DirectoryProcessingResult.PROCESS_CHILDREN;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CloudGitProjectStructureDetector.java
示例8: detectApplicationRoot
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private static void detectApplicationRoot(@NotNull File dir, @NotNull List<DetectedProjectRoot> result) {
VirtualFile repositoryRoot = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir);
if (repositoryRoot == null) {
return;
}
if (GitUtil.findGitDir(repositoryRoot) == null) {
return;
}
Project project = ProjectManager.getInstance().getDefaultProject();
GitRepository repository
= GitRepositoryImpl.getLightInstance(repositoryRoot, project, ServiceManager.getService(project, GitPlatformFacade.class), project);
repository.update();
for (CloudGitDeploymentDetector deploymentDetector : CloudGitDeploymentDetector.EP_NAME.getExtensions()) {
String applicationName = deploymentDetector.getFirstApplicationName(repository);
if (applicationName != null) {
result.add(new CloudGitProjectRoot(deploymentDetector, dir, repositoryRoot, applicationName));
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CloudGitProjectStructureDetector.java
示例9: iterate
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public void iterate() {
Collection<DetectedProjectRoot> roots = myBuilder.getProjectRoots(myStructureDetector);
CloudGitDeploymentDetector point = getDeploymentDetector();
String projectRootTypeName = CloudGitProjectRoot.getProjectRootTypeName(point);
String javaSourceRootTypeName = CloudGitProjectRoot.getJavaSourceRootTypeName(point);
for (DetectedProjectRoot root : roots) {
if ((root instanceof CloudGitProjectRoot) && root.getRootTypeName().equals(projectRootTypeName)) {
processProjectRoot((CloudGitProjectRoot)root);
}
else if ((root instanceof DetectedSourceRoot) && root.getRootTypeName().equals(javaSourceRootTypeName)) {
processJavaSourceRoot((DetectedSourceRoot)root);
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CloudGitChooseAccountStepImpl.java
示例10: detectRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
Pattern pattern = Pattern.compile(".*\\." + SquirrelFileType.EXTENSION);
List<File> filesByMask = FileUtil.findFilesByMask(pattern, base);
if (!filesByMask.isEmpty()) {
result.add(new DetectedProjectRoot(dir) {
@NotNull
@Override
public String getRootTypeName() {
return SquirrelModuleType.MODULE_TYPE_ID;
}
});
}
return DirectoryProcessingResult.SKIP_CHILDREN;
}
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:20,代码来源:SquirrelProjectStructureDetector.java
示例11: detectRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* We determine that a directory is the root of a Spoofax project when it
* has a file `editor/*.main.esv`.
*/
@Override
public DirectoryProcessingResult detectRoots(
final File dir,
final File[] children,
final File base,
final List<DetectedProjectRoot> result) {
this.logger.info("Detecting Spoofax project in subdirectory {} of base {}", dir, base);
if(this.configService.available(this.resourceService.resolve(dir))) {
this.logger.info("Detected Spoofax project in {}", base);
// result.add(new DetectedContentRoot(base, "Spoofax", this.moduleType, JavaModuleType.getModuleType()));
result.add(new MetaborgProjectRoot(base));
return DirectoryProcessingResult.SKIP_CHILDREN;
}
return DirectoryProcessingResult.PROCESS_CHILDREN;
}
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:25,代码来源:MetaborgProjectDetector.java
示例12: setRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public final void setRoots(final List<File> contentRoots, final List<? extends DetectedProjectRoot> sourceRoots, final Set<String> ignoredNames) {
myModules = null;
myLibraries = null;
myEntryPointRoots.clear();
myEntryPointRoots.addAll(contentRoots);
mySourceRoots.clear();
mySourceRoots.addAll(sourceRoots);
myIgnoredNames.clear();
myIgnoredNames.addAll(ignoredNames);
myJarToPackagesMap.clear();
myInterner.clear();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:ModuleInsight.java
示例13: appendContentRoot
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private static File appendContentRoot(final ModuleDescriptor module, final File contentRoot) {
final Set<File> moduleRoots = module.getContentRoots();
for (File moduleRoot : moduleRoots) {
if (FileUtil.isAncestor(moduleRoot, contentRoot, false)) {
return moduleRoot; // no need to include a separate root
}
if (FileUtil.isAncestor(contentRoot, moduleRoot, true)) {
final Collection<DetectedProjectRoot> currentSources = module.getSourceRoots(moduleRoot);
module.removeContentRoot(moduleRoot);
module.addContentRoot(contentRoot);
for (DetectedProjectRoot source : currentSources) {
module.addSourceRoot(contentRoot, source);
}
return contentRoot; // no need to include a separate root
}
}
module.addContentRoot(contentRoot);
return contentRoot;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ModuleInsight.java
示例14: removeIncompatibleRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private static void removeIncompatibleRoots(DetectedProjectRoot root, Map<File, DetectedRootData> rootData) {
DetectedRootData[] allRoots = rootData.values().toArray(new DetectedRootData[rootData.values().size()]);
for (DetectedRootData child : allRoots) {
final File childDirectory = child.getDirectory();
if (FileUtil.isAncestor(root.getDirectory(), childDirectory, true)) {
for (DetectedProjectRoot projectRoot : child.getAllRoots()) {
if (!root.canContainRoot(projectRoot)) {
child.removeRoot(projectRoot);
}
}
if (child.getAllRoots().length == 0) {
rootData.remove(childDirectory);
}
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:RootsDetectionStep.java
示例15: findRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
public Map<ProjectStructureDetector, List<DetectedProjectRoot>> findRoots() {
if (!myBaseDir.isDirectory()) {
return Collections.emptyMap();
}
BitSet enabledDetectors = new BitSet(myDetectors.length);
enabledDetectors.set(0, myDetectors.length);
for (int i = 0; i < myDetectors.length; i++) {
myDetectedRoots[i] = new ArrayList<DetectedProjectRoot>();
}
processRecursively(myBaseDir, enabledDetectors);
final Map<ProjectStructureDetector, List<DetectedProjectRoot>> result = new LinkedHashMap<ProjectStructureDetector, List<DetectedProjectRoot>>();
for (int i = 0; i < myDetectors.length; i++) {
if (!myDetectedRoots[i].isEmpty()) {
result.put(myDetectors[i], myDetectedRoots[i]);
}
}
return result;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:RootDetectionProcessor.java
示例16: detectRoots
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
for (File child : children) {
if (child.isFile() && child.getName().endsWith(HaxeFileType.DEFAULT_EXTENSION)) {
Pair<File, String> root =
CommonSourceRootDetectionUtil.IO_FILE.suggestRootForFileWithPackageStatement(child, base, PACKAGE_NAME_FETCHER, false);
if (root != null) {
result.add(new HaxeModuleSourceRoot(root.getFirst()));
return DirectoryProcessingResult.skipChildrenAndParentsUpTo(root.getFirst());
}
else {
return DirectoryProcessingResult.SKIP_CHILDREN;
}
}
}
return DirectoryProcessingResult.PROCESS_CHILDREN;
}
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:22,代码来源:HaxeProjectStructureDetector.java
示例17: doTest
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private void doTest(String... expected) {
final String dirPath = FileUtil.toSystemDependentName(HaxeTestUtils.BASE_TEST_DATA_PATH + "/rootDetection/") + getTestName(true);
final File dir = new File(dirPath);
assertTrue(dir.isDirectory());
final HaxeProjectStructureDetector haxeProjectStructureDetector = new HaxeProjectStructureDetector();
final ProjectStructureDetector[] detector = new ProjectStructureDetector[]{haxeProjectStructureDetector};
final RootDetectionProcessor detectionProcessor = new RootDetectionProcessor(
dir,detector
);
// TODO:
final List<DetectedProjectRoot> detected;//= detectionProcessor.findRoots().get(haxeProjectStructureDetector);
Map<ProjectStructureDetector, List<DetectedProjectRoot>> detectorListMap = detectionProcessor.runDetectors();
detected = detectorListMap.get(haxeProjectStructureDetector);
assertNotNull(detected);
final Set<String> actual = new THashSet<String>();
for (DetectedProjectRoot projectRoot : detected) {
final String relativePath = FileUtil.getRelativePath(dir, projectRoot.getDirectory());
assertNotNull(relativePath);
actual.add(FileUtil.toSystemIndependentName(relativePath));
}
assertSameElements(actual, expected);
}
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:23,代码来源:HaxeSourceRootDetectionTest.java
示例18: toString
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
/**
* For debug purposes only
*/
public String toString() {
@NonNls final StringBuilder builder = new StringBuilder();
builder.append("[Module: ").append(getContentRoots()).append(" | ");
for (DetectedProjectRoot sourceRoot : getSourceRoots()) {
builder.append(sourceRoot.getDirectory().getName()).append(",");
}
builder.append("]");
return builder.toString();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ModuleDescriptor.java
示例19: buildModuleDependencies
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
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)) {
continue; // avoid self-dependencies
}
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;
}
}
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ModuleInsight.java
示例20: buildJarDependencies
import com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot; //导入依赖的package包/类
private void buildJarDependencies(final ModuleDescriptor module) {
for (File jarFile : myJarToPackagesMap.keySet()) {
final Set<String> jarPackages = myJarToPackagesMap.get(jarFile);
for (DetectedProjectRoot srcRoot : module.getSourceRoots()) {
if (ContainerUtil.intersects(mySourceRootToReferencedPackagesMap.get(srcRoot.getDirectory()), jarPackages)) {
module.addLibraryFile(jarFile);
break;
}
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ModuleInsight.java
注:本文中的com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论