/*
 * Copyright (c) 2000-2004 by JetBrains s.r.o. All Rights Reserved.
 * Use is subject to license terms.
 */
package org.jetbrains.idea.devkit.module;

import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleComponent;
import com.intellij.openapi.module.ModuleConfigurationEditor;
import com.intellij.openapi.roots.ModifiableRootModel;
import com.intellij.openapi.roots.ui.configuration.DefaultModuleConfigurationEditorFactory;
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationEditorProvider;
import com.intellij.openapi.roots.ui.configuration.ModuleConfigurationState;
import com.intellij.j2ee.make.ModuleBuildProperties;
import org.jetbrains.idea.devkit.build.PluginModuleBuildConfEditor;
import org.jetbrains.idea.devkit.build.PluginModuleBuildProperties;

public class PluginModuleEditorsProvider implements ModuleComponent, ModuleConfigurationEditorProvider{
  public String getComponentName() {
    return "DevKit.PluginModuleEditorsProvider";
  }


  public ModuleConfigurationEditor[] createEditors(ModuleConfigurationState state) {
    final DefaultModuleConfigurationEditorFactory editorFactory = DefaultModuleConfigurationEditorFactory.getInstance();
    final ModifiableRootModel rootModel = state.getRootModel();
    final Module module = rootModel.getModule();
    return new ModuleConfigurationEditor[] {
      editorFactory.createModuleContentRootsEditor(state),
      editorFactory.createLibrariesEditor(state),
      editorFactory.createDependenciesEditor(state),
      editorFactory.createOrderEntriesEditor(state),
      editorFactory.createJavadocEditor(state),
      new PluginModuleBuildConfEditor(state)
    };
  }

  public void projectOpened() {}
  public void projectClosed() {}
  public void moduleAdded() {}
  public void initComponent() {}
  public void disposeComponent() {}
}
@@ -151,51 +151,8 @@
 e;%0A%0A
-import com.intellij.openapi.module.Module;%0A
 impo
@@ -265,63 +265,8 @@
 or;%0A
-import com.intellij.openapi.roots.ModifiableRootModel;%0A
 impo
@@ -540,39 +540,54 @@
 lij.
-j2ee.make.ModuleBuildProperties
+openapi.roots.ui.configuration.ModulesProvider
 ;%0Aim
@@ -656,74 +656,58 @@
 or;%0A
+%0A
 import 
-org.jetbrains.idea.devkit.build.PluginModuleBuildProperties
+java.util.ArrayList;%0Aimport java.util.List
 ;%0A%0Ap
@@ -1115,43 +1115,32 @@
     
-final ModifiableRootModel rootModel
+ModulesProvider provider
  = s
@@ -1151,25 +1151,31 @@
 .get
-RootModel
+ModulesProvider
 ();%0A    
 fina
@@ -1174,68 +1174,64 @@
     
-final Module module = rootModel.getModule();%0A    return new 
+List%3CModuleConfigurationEditor%3E editors = new ArrayList%3C
 Modu
@@ -1255,19 +1255,29 @@
 itor
-%5B%5D %7B
+%3E();
 %0A    
-  
+editors.add(
 edit
@@ -1319,32 +1319,43 @@
 ditor(state)
-,%0A  
+);%0A
     
+editors.add(
 editorFactor
@@ -1380,32 +1380,89 @@
 ditor(state)
-,
+);%0A    if (provider.getModules().length %3E 1) %7B
 %0A      
+editors.add(
 editorFactor
@@ -1490,32 +1490,49 @@
 ditor(state)
-,
+);
 %0A    
-  
+%7D%0A    editors.add(
 editorFactor
@@ -1564,24 +1564,35 @@
 r(state)
-,
+);
 %0A    
-  
+editors.add(
 editorFa
@@ -1627,16 +1627,27 @@
 ate)
-,%0A 
+);%0A
     
- 
+editors.add(
 new 
@@ -1680,22 +1680,92 @@
 r(state)
+);
 %0A    
-%7D
+return editors.toArray(new ModuleConfigurationEditor%5Beditors.size()%5D)
 ;%0A  %7D%0A%0A 

correct Paths for plugin module