本文整理汇总了Java中com.intellij.ide.util.projectWizard.importSources.ProjectStructureDetector类的典型用法代码示例。如果您正苦于以下问题:Java ProjectStructureDetector类的具体用法?Java ProjectStructureDetector怎么用?Java ProjectStructureDetector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectStructureDetector类属于com.intellij.ide.util.projectWizard.importSources包,在下文中一共展示了ProjectStructureDetector类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
}
示例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();
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
}
示例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;
}
示例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;
}