create from sources: setup default (web) module if nothing special is detected (IDEA-91446, ZD-27093)

This commit is contained in:
nik
2014-04-17 12:21:19 +04:00
parent cb43848ba1
commit 3171d15f1f
2 changed files with 50 additions and 0 deletions
@@ -0,0 +1,48 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.util.projectWizard.importSources;
import com.intellij.ide.util.importProject.ProjectDescriptor;
import com.intellij.openapi.module.WebModuleType;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Collection;
import java.util.List;
/**
* @author nik
*/
public class DefaultProjectStructureDetector extends ProjectStructureDetector {
@NotNull
@Override
public DirectoryProcessingResult detectRoots(@NotNull File dir,
@NotNull File[] children,
@NotNull File base,
@NotNull List<DetectedProjectRoot> result) {
result.add(new DetectedContentRoot(dir, "Content", WebModuleType.getInstance()));
return DirectoryProcessingResult.SKIP_CHILDREN;
}
@Override
public void setupProjectStructure(@NotNull Collection<DetectedProjectRoot> roots,
@NotNull ProjectDescriptor projectDescriptor,
@NotNull ProjectFromSourcesBuilder builder) {
if (!builder.hasRootsFromOtherDetectors(this)) {
builder.setupModulesByContentRoots(projectDescriptor, roots);
}
}
}
@@ -309,6 +309,8 @@
<projectImportProvider implementation="com.intellij.ide.util.projectWizard.ModuleImportProvider"/>
<projectImportProvider implementation="com.intellij.ide.util.projectWizard.ImportFromSourcesProvider"/>
<projectStructureDetector implementation="com.intellij.ide.util.projectWizard.importSources.DefaultProjectStructureDetector" order="last"/>
<projectTemplatesFactory implementation="com.intellij.platform.templates.ArchivedTemplatesFactory"/>
<!--
<projectTemplatesFactory implementation="com.intellij.platform.templates.RemoteTemplatesFactory"/>