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

import com.intellij.j2ee.make.ModuleBuildProperties;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleComponent;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.projectRoots.ProjectJdk;
import com.intellij.openapi.diagnostic.Logger;
import org.jetbrains.idea.devkit.projectRoots.IdeaJdk;
import org.jetbrains.idea.devkit.projectRoots.Sandbox;

public class PluginModuleBuildProperties extends ModuleBuildProperties implements ModuleComponent {
  private Module myModule;
  private boolean myJarPlugin = false;

  public PluginModuleBuildProperties(Module module) {
    myModule = module;
  }

  public String getArchiveExtension() {
    return "jar";
  }

  public String getJarPath() {
    return PluginBuildUtil.getPluginExPath(myModule) != null ? PluginBuildUtil.getPluginExPath(myModule) + "/lib/" + myModule.getName() + ".jar" : null;
  }

  public String getExplodedPath() {
    return PluginBuildUtil.getPluginExPath(myModule);
  }

  public boolean isJarPlugin() {
    return myJarPlugin;
  }

  public void setJarPlugin(boolean jarPlugin) {
    myJarPlugin = jarPlugin;
  }

  public Module getModule() {
    return myModule;
  }

  public boolean isJarEnabled() {
    return myJarPlugin;
  }

  public boolean isExplodedEnabled() {
    return !myJarPlugin;
  }

  public boolean isBuildOnFrameDeactivation() {
    //TODO
    return false;
  }

  public boolean isSyncExplodedDir() {
    return true;
  }

  public void projectOpened() {}

  public void projectClosed() {}

  public void moduleAdded() {}

  public String getComponentName() {
    return "DevKit.ModuleBuildProperties";
  }

  public void initComponent() {}

  public void disposeComponent() {}
}
@@ -443,24 +443,247 @@
 tic.Logger;%0A
+import com.intellij.openapi.util.JDOMExternalizable;%0Aimport com.intellij.openapi.util.InvalidDataException;%0Aimport com.intellij.openapi.util.WriteExternalException;%0Aimport com.intellij.openapi.util.DefaultJDOMExternalizer;%0A
 import org.j
@@ -779,16 +779,41 @@
 Sandbox;
+%0Aimport org.jdom.Element;
 %0A%0Apublic
@@ -903,16 +903,36 @@
 omponent
+, JDOMExternalizable
  %7B%0A  pri
@@ -956,22 +956,21 @@
 ule;%0A  p
-rivate
+ublic
  boolean
@@ -2150,10 +2150,286 @@
 ent() %7B%7D
+%0A%0A  public void readExternal(Element element) throws InvalidDataException %7B%0A    DefaultJDOMExternalizer.readExternal(this, element);%0A  %7D%0A%0A  public void writeExternal(Element element) throws WriteExternalException %7B%0A    DefaultJDOMExternalizer.writeExternal(this, element);%0A  %7D
 %0A%7D

add externalization