use of org.jetbrains.plugins.ruby.motion.facet.RubyMotionFacetType in project intellij-plugins by JetBrains.
the class RubyMotionFacetConfigurator method configure.
public static void configure(VirtualFile baseDir, Module module) {
final RubyMotionFacet existingFacet = RubyMotionFacet.getInstance(module);
if (existingFacet != null) {
return;
}
FacetManager facetManager = FacetManager.getInstance(module);
final ModifiableFacetModel model = facetManager.createModifiableModel();
RubyMotionFacetType facetType = RubyMotionFacetType.getInstance();
RubyMotionFacetConfiguration configuration = ProjectFacetManager.getInstance(module.getProject()).createDefaultConfiguration(facetType);
//configuration.setProjectRootPath(baseDir.getPath());
VirtualFile testFolder = baseDir.findChild("spec");
final ModifiableRootModel rootModel = ModuleRootManager.getInstance(module).getModifiableModel();
if (testFolder != null) {
//configuration.setTestPath(testFolder.getPath());
addTestSources(testFolder, rootModel);
}
VirtualFile libFolder = baseDir.findChild("app");
if (libFolder != null) {
//configuration.setLibPath(libFolder.getPath());
}
RubyMotionFacet.updateMotionLibrary(rootModel);
IdeaInternalUtil.runInsideWriteAction(new ActionRunner.InterruptibleRunnable() {
public void run() throws Exception {
rootModel.commit();
}
});
RubyMotionFacet facet = facetManager.createFacet(facetType, facetType.getDefaultFacetName(), configuration, null);
model.addFacet(facet);
new WriteAction() {
protected void run(@NotNull final Result result) throws Throwable {
model.commit();
}
}.execute();
RubyMotionUtilExt.createMotionRunConfiguration(module);
}
Aggregations