当前位置: 首页>>代码示例>>Java>>正文


Java DetectedProjectRoot类代码示例

本文整理汇总了Java中com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot的典型用法代码示例。如果您正苦于以下问题:Java DetectedProjectRoot类的具体用法?Java DetectedProjectRoot怎么用?Java DetectedProjectRoot使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DetectedProjectRoot类属于com.intellij.ide.util.projectWizard.importSources包,在下文中一共展示了DetectedProjectRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的com.intellij.ide.util.projectWizard.importSources.DetectedProjectRoot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。