project model: store TestModuleProperties configurations separately for modules impor... appcode/172.2171
authornik <Nikolay.Chashnikov@jetbrains.com>
Thu, 11 May 2017 11:59:57 +0000 (14:59 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Thu, 11 May 2017 12:00:37 +0000 (15:00 +0300)
platform/projectModel-impl/src/com/intellij/openapi/roots/impl/TestModulePropertiesImpl.java

index ccce409c83c2bb1885c0475f9a3c24a5c43da73f..ae068ebf764fb4e735dc9bb905981a876790a29c 100644 (file)
@@ -20,6 +20,9 @@ import com.intellij.openapi.components.State;
 import com.intellij.openapi.module.Module;
 import com.intellij.openapi.module.ModulePointer;
 import com.intellij.openapi.module.ModulePointerManager;
+import com.intellij.openapi.roots.ExternalProjectSystemRegistry;
+import com.intellij.openapi.roots.ProjectModelElement;
+import com.intellij.openapi.roots.ProjectModelExternalSource;
 import com.intellij.openapi.roots.TestModuleProperties;
 import com.intellij.util.xmlb.annotations.Attribute;
 import org.jetbrains.annotations.NotNull;
@@ -29,11 +32,14 @@ import org.jetbrains.annotations.Nullable;
  * @author nik
  */
 @State(name = "TestModuleProperties")
-public class TestModulePropertiesImpl extends TestModuleProperties implements PersistentStateComponent<TestModulePropertiesImpl.TestModulePropertiesState> {
+public class TestModulePropertiesImpl extends TestModuleProperties implements PersistentStateComponent<TestModulePropertiesImpl.TestModulePropertiesState>,
+                                                                              ProjectModelElement {
   private final ModulePointerManager myModulePointerManager;
   private ModulePointer myProductionModulePointer;
+  private Module myModule;
 
-  public TestModulePropertiesImpl(@NotNull ModulePointerManager modulePointerManager) {
+  public TestModulePropertiesImpl(@NotNull Module module, @NotNull ModulePointerManager modulePointerManager) {
+    myModule = module;
     myModulePointerManager = modulePointerManager;
   }
 
@@ -67,6 +73,12 @@ public class TestModulePropertiesImpl extends TestModuleProperties implements Pe
     setProductionModuleName(state.moduleName);
   }
 
+  @Nullable
+  @Override
+  public ProjectModelExternalSource getExternalSource() {
+    return ExternalProjectSystemRegistry.getInstance().getExternalSource(myModule);
+  }
+
   public static class TestModulePropertiesState {
     @Attribute("production-module")
     public String moduleName;