• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ProjectStructureDetector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: importFromSources

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的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.ProjectStructureDetector; //导入依赖的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: addRoot

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的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


示例4: findRoots

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的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


示例5: doTest

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的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


示例6: addSteps

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public void addSteps(WizardContext context, ModulesProvider modulesProvider, StepSequence sequence, String specific) {
  final ProjectFromSourcesBuilderImpl projectBuilder = new ProjectFromSourcesBuilderImpl(context, modulesProvider);
  myProjectBuilder = projectBuilder;

  final Icon icon = context.getStepIcon();
  if (context.isCreatingNewProject()) {
    addStep(sequence, new ProjectNameStep(context, this), specific);
  }
  addStep(sequence, new RootsDetectionStep(projectBuilder, context, sequence, icon, "reference.dialogs.new.project.fromCode.source"), specific);

  Set<String> detectorTypes = new HashSet<String>();
  for (ProjectStructureDetector detector : ProjectStructureDetector.EP_NAME.getExtensions()) {
    detectorTypes.add(detector.getDetectorId());
    for (ModuleWizardStep step : detector.createWizardSteps(projectBuilder, projectBuilder.getProjectDescriptor(detector), icon)) {
      sequence.addSpecificStep(detector.getDetectorId(), step);
    }
  }

  if (FrameworkDetectionStep.isEnabled()) {
    FrameworkDetectionStep frameworkDetectionStep = new FrameworkDetectionStep(icon, projectBuilder) {
      public List<ModuleDescriptor> getModuleDescriptors() {
        final List<ModuleDescriptor> moduleDescriptors = new ArrayList<ModuleDescriptor>();
        for (ProjectDescriptor descriptor : projectBuilder.getSelectedDescriptors()) {
          moduleDescriptors.addAll(descriptor.getModules());
        }
        return moduleDescriptors;
      }
    };
    projectBuilder.addConfigurationUpdater(frameworkDetectionStep);
    sequence.addCommonFinishingStep(frameworkDetectionStep, detectorTypes);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:CreateFromSourcesMode.java


示例7: updateSelectedTypes

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
private void updateSelectedTypes() {
  Set<String> selectedTypes = new LinkedHashSet<String>();

  selectedTypes.add("Existing Sources");

  for (DetectedRootData rootData : myDetectedRootsChooser.getMarkedElements()) {
    for (ProjectStructureDetector detector : rootData.getSelectedDetectors()) {
      selectedTypes.add(detector.getDetectorId());
    }
  }

  mySequence.setTypes(selectedTypes);
  myContext.requestWizardButtonsUpdate();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:RootsDetectionStep.java


示例8: RootDetectionProcessor

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public RootDetectionProcessor(File baseDir, final ProjectStructureDetector[] detectors) {
  myBaseDir = getCanonicalDir(baseDir);
  myDetectors = detectors;
  //noinspection unchecked
  myDetectedRoots = new List[myDetectors.length];
  myTypeManager = FileTypeManager.getInstance();
  myProgressIndicator = ProgressManager.getInstance().getProgressIndicator();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RootDetectionProcessor.java


示例9: createRootsMap

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public static MultiMap<ProjectStructureDetector, DetectedProjectRoot> createRootsMap(List<DetectedRootData> list) {
  MultiMap<ProjectStructureDetector, DetectedProjectRoot> roots = new MultiMap<ProjectStructureDetector, DetectedProjectRoot>();
  for (final DetectedRootData rootData : list) {
    for (ProjectStructureDetector detector : rootData.getSelectedDetectors()) {
      roots.putValue(detector, rootData.getSelectedRoot());
    }
  }
  return roots;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:RootDetectionProcessor.java


示例10: detectRoots

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
private List<DetectedRootData> detectRoots() {
  Map<ProjectStructureDetector, List<DetectedProjectRoot>> roots = runDetectors();
  if (myProgressIndicator != null) {
    myProgressIndicator.setText2("Processing " + roots.values().size() + " project roots...");
  }

  Map<File, DetectedRootData> rootData = new LinkedHashMap<File, DetectedRootData>();
  for (ProjectStructureDetector detector : roots.keySet()) {
    for (DetectedProjectRoot detectedRoot : roots.get(detector)) {
      if (isUnderIncompatibleRoot(detectedRoot, rootData)) {
        continue;
      }

      final DetectedRootData data = rootData.get(detectedRoot.getDirectory());
      if (data == null) {
        rootData.put(detectedRoot.getDirectory(), new DetectedRootData(detector, detectedRoot));
      }
      else {
        detectedRoot = data.addRoot(detector, detectedRoot);
      }
      removeIncompatibleRoots(detectedRoot, rootData);
    }
  }

  List<DetectedRootData> dataCollection = mergeContentRoots(rootData);
  if (myProgressIndicator != null) {
    myProgressIndicator.setText2("");
  }
  return dataCollection;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:RootDetectionProcessor.java


示例11: ModulesDetectionStep

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public ModulesDetectionStep(ProjectStructureDetector detector,
                            ProjectFromSourcesBuilder builder,
                            ProjectDescriptor projectDescriptor, final ModuleInsight insight,
                            Icon icon,
                            @NonNls String helpId) {
  super("Stop module analysis?");
  myDetector = detector;
  myBuilder = builder;
  myProjectDescriptor = projectDescriptor;
  myInsight = insight;
  myIcon = icon;
  myHelpId = helpId;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ModulesDetectionStep.java


示例12: calculate

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
protected List<DetectedRootData> calculate() {
  final String baseProjectPath = getBaseProjectPath();
  if (baseProjectPath == null) {
    return Collections.emptyList();
  }

  final File baseProjectFile = new File(baseProjectPath);
  Map<ProjectStructureDetector, List<DetectedProjectRoot>> roots = new RootDetectionProcessor(baseProjectFile,
                                                                                              ProjectStructureDetector.EP_NAME.getExtensions()).findRoots();
  final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
  if (progressIndicator != null) {
    progressIndicator.setText2("Processing " + roots.values().size() + " project roots...");
  }

  Map<File, DetectedRootData> rootData = new LinkedHashMap<File, DetectedRootData>();
  for (ProjectStructureDetector detector : roots.keySet()) {
    for (DetectedProjectRoot detectedRoot : roots.get(detector)) {
      if (isUnderIncompatibleRoot(detectedRoot, rootData)) {
        continue;
      }

      final DetectedRootData data = rootData.get(detectedRoot.getDirectory());
      if (data == null) {
        rootData.put(detectedRoot.getDirectory(), new DetectedRootData(detector, detectedRoot));
      }
      else {
        detectedRoot = data.addRoot(detector, detectedRoot);
      }
      removeIncompatibleRoots(detectedRoot, rootData);
    }
  }

  if (progressIndicator != null) {
    progressIndicator.setText2("");
  }
  return new ArrayList<DetectedRootData>(rootData.values());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:RootsDetectionStep.java


示例13: ProjectFromSourcesBuilderImpl

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public ProjectFromSourcesBuilderImpl(WizardContext context, ModulesProvider modulesProvider) {
  myContext = context;
  myModulesProvider = modulesProvider;
  for (ProjectStructureDetector detector : ProjectStructureDetector.EP_NAME.getExtensions()) {
    myProjectDescriptors.put(detector, new ProjectDescriptor());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:ProjectFromSourcesBuilderImpl.java


示例14: hasRootsFromOtherDetectors

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public boolean hasRootsFromOtherDetectors(ProjectStructureDetector thisDetector) {
  for (ProjectStructureDetector projectStructureDetector : Extensions.getExtensions(ProjectStructureDetector.EP_NAME)) {
    if (projectStructureDetector != thisDetector && !getProjectRoots(projectStructureDetector).isEmpty()) {
      return true;
    }
  }
  return false;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:ProjectFromSourcesBuilderImpl.java


示例15: processRecursively

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
private List<Pair<File, Integer>> processRecursively(File dir, BitSet enabledDetectors) {
  List<Pair<File, Integer>> parentsToSkip = new SmartList<Pair<File, Integer>>();

  if (myTypeManager.isFileIgnored(dir.getName())) {
    return parentsToSkip;
  }
  if (myProgressIndicator != null) {
    if (myProgressIndicator.isCanceled()) {
      return parentsToSkip;
    }
    myProgressIndicator.setText2(dir.getPath());
  }

  File[] children = dir.listFiles();

  if (children == null) {
    children = ArrayUtil.EMPTY_FILE_ARRAY;
  }

  BitSet enabledForChildren = enabledDetectors;
  for (int i = 0, detectorsLength = myDetectors.length; i < detectorsLength; i++) {
    if (!enabledDetectors.get(i)) continue;

    final ProjectStructureDetector.DirectoryProcessingResult result = myDetectors[i].detectRoots(dir, children, myBaseDir, myDetectedRoots[i]);

    if (!result.isProcessChildren()) {
      if (enabledForChildren == enabledDetectors) {
        enabledForChildren = new BitSet();
        enabledForChildren.or(enabledDetectors);
      }
      enabledForChildren.set(i, false);
    }

    final File parentToSkip = result.getParentToSkip();
    if (parentToSkip != null && !parentToSkip.equals(dir)) {
      parentsToSkip.add(Pair.create(parentToSkip, i));
    }
  }

  if (!enabledForChildren.isEmpty()) {
    for (File child : children) {
      if (child.isDirectory()) {
        final List<Pair<File, Integer>> toSkip = processRecursively(child, enabledForChildren);
        if (!toSkip.isEmpty()) {
          if (enabledForChildren == enabledDetectors) {
            enabledForChildren = new BitSet();
            enabledForChildren.or(enabledDetectors);
          }
          for (Pair<File, Integer> pair : toSkip) {
            enabledForChildren.set(pair.getSecond(), false);
            if (!pair.getFirst().equals(dir)) {
              parentsToSkip.add(pair);
            }
          }
          if (enabledForChildren.isEmpty()) {
            break;
          }
        }
      }
    }
  }
  return parentsToSkip;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:64,代码来源:RootDetectionProcessor.java


示例16: DetectedRootData

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public DetectedRootData(ProjectStructureDetector detector, DetectedProjectRoot root) {
  myDirectory = root.getDirectory();
  mySelectedRoot = root;
  myRoots.putValue(root, detector);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:DetectedRootData.java


示例17: getSelectedDetectors

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
@NotNull
public Collection<ProjectStructureDetector> getSelectedDetectors() {
  return myRoots.get(mySelectedRoot);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DetectedRootData.java


示例18: removeRoot

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public Collection<ProjectStructureDetector> removeRoot(DetectedProjectRoot root) {
  return myRoots.remove(root);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:DetectedRootData.java


示例19: createMap

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
@Override
protected Map<DetectedProjectRoot, Collection<ProjectStructureDetector>> createMap() {
  return new LinkedHashMap<DetectedProjectRoot, Collection<ProjectStructureDetector>>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:DetectedRootData.java


示例20: setProjectRoots

import com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector; //导入依赖的package包/类
public void setProjectRoots(MultiMap<ProjectStructureDetector, DetectedProjectRoot> roots) {
  myRoots = roots;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:ProjectFromSourcesBuilderImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CubeDebug类代码示例发布时间:2022-05-23
下一篇:
Java SimpleVector类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap