Index: applications/editors/josm/plugins/smed/plugs/oseam/build.xml
===================================================================
--- applications/editors/josm/plugins/smed/plugs/oseam/build.xml	(revision 23392)
+++ applications/editors/josm/plugins/smed/plugs/oseam/build.xml	(revision 23393)
@@ -46,8 +46,9 @@
 	<property name="plugin.build.dir"       value="build"/>
 	<property name="plugin.src.dir"         value="src"/>
+	<property name="smed.build.dir"         value="../../../smed/build"/>
+	<property name="smed.src.dir"           value="../../../smed/src"/>
 	<!-- this is the directory where the plugin jar is copied to -->
 	<property name="plugin.dist.dir"        value="../../../../dist"/>
 	<property name="ant.build.javac.target" value="1.5"/>
-	<property name="plugin.dist.dir"        value="../../../../dist"/>
 	<property name="plugin.jar"             value="${plugin.dist.dir}/00_${DSTAMP}_${TSTAMP}_${ant.project.name}.jar"/>
 
@@ -63,8 +64,78 @@
 	<!--
     **********************************************************
+    ** init_smed - initializes the build of smed
+    **********************************************************
+    -->
+	<target name="init_smed">
+		<mkdir dir="${smed.build.dir}"/>
+	</target>
+
+	<!--
+    **********************************************************
+    ** compile_smed - compiles the source tree of smed
+    **********************************************************
+    -->
+	<target name="compile_smed" depends="init_smed">
+		<echo message="compiling sources for smed.jar ... "/>
+		<javac srcdir="${smed.src.dir}" classpath="${josm}" debug="true" destdir="${smed.build.dir}">
+			<compilerarg value="-Xlint:deprecation"/>
+			<compilerarg value="-Xlint:unchecked"/>
+		</javac>
+	</target>
+	
+	<!--
+    **********************************************************
+    ** dist_smed - creates smed.jar
+    **********************************************************
+    -->
+	<target name="dist_smed" depends="compile_smed">
+		<echo message="creating smed.jar ... "/>
+
+		<copy todir="${smed.build.dir}/images">
+			<fileset dir="${smed.src.dir}/images"/>
+		</copy>
+		
+		<copy todir="${smed.build.dir}/images">
+			<fileset dir="../../../smed/images"/>
+		</copy>
+
+		<copy todir="${smed.build.dir}/smed/msg">
+			<fileset dir="${smed.src.dir}/smed/msg"/>
+		</copy>
+
+		<copy todir="${smed.build.dir}">
+			<fileset dir="../../../smed">
+                <include name="*.txt" />
+			</fileset>
+		</copy>
+
+		<jar destfile="${smed}" basedir="${smed.build.dir}">
+			<!--
+        ************************************************
+        ** configure these properties. Most of them will be copied to the plugins
+        ** manifest file. Property values will also show up in the list available
+        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
+        **
+        ************************************************
+    -->
+			<manifest>
+				<attribute name="Author" value="Werner"/>
+				<attribute name="Plugin-Class" value="smed.Smed"/>
+				<attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
+				<attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap"/>
+				<attribute name="Plugin-Icon" value="images/Smed.png"/>
+				<attribute name="Plugin-Link" value="http://openseamap.org/"/>
+				<attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
+				<attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
+			</manifest>
+		</jar>
+	</target>
+
+	<!--
+    **********************************************************
     ** compile - complies the source tree
     **********************************************************
     -->
-	<target name="compile" depends="init">
+	<target name="compile" depends="init,dist_smed">
 		<echo message="compiling sources for  ${plugin.jar} ... "/>
 		<javac srcdir="src" classpath="${josm}:${smed}" debug="true" destdir="${plugin.build.dir}">
@@ -73,4 +144,5 @@
 		</javac>
 	</target>
+
 
 	<!--
Index: applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/OSeaM.java
===================================================================
--- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/OSeaM.java	(revision 23392)
+++ applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/OSeaM.java	(revision 23393)
@@ -10,11 +10,11 @@
 public class OSeaM implements SmedPluggable {
 
-	private OSeaMAction os = null;
+	private OSeaMAction osm = null;
 	
 	@Override
 	public JComponent getComponent() {
-		os = new OSeaMAction();
-		os.init();
-		return os.getPM01SeaMap();
+		osm = new OSeaMAction();
+		osm.init();
+		return osm.getPM01SeaMap();
 	}
 
@@ -39,6 +39,6 @@
 	@Override
 	public boolean stop() {
-		// TODO Auto-generated method stub
-		return false;
+		osm.closePanel();
+		return true;
 	}
 
Index: applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java
===================================================================
--- applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java	(revision 23392)
+++ applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/dialogs/OSeaMAction.java	(revision 23393)
@@ -55,5 +55,4 @@
 																				// SmpDialogAction
 	private Buoy buoy = null; // Variable f�r Objekte des Typs "Tonne" //
-	private boolean isOpen = false; // zeigt den Status des Dialogs an
 	private Node onode = null; // gemerkter Knoten
 	private Buoy obuoy = null; // gemerkte Tonne // @jve:decl-index=0:
@@ -187,12 +186,4 @@
 	}
 
-	public boolean isOpen() {
-		return isOpen;
-	}
-
-	public void setOpen(boolean isOpen) {
-		this.isOpen = isOpen;
-	}
-
 	public String getOs() {
 		return Os;
@@ -211,14 +202,8 @@
 	}
 
-	public void CloseDialog() {
+	public void closePanel() {
 		onode = null;
 		DataSet.removeSelectionListener(SmpListener);
 		Selection = null;
-
-		/*
-		if (isOpen)
-			dM01SeaMap.dispose();
-		*/
-		isOpen = false;
 	}
 
@@ -226,5 +211,4 @@
 		onode = null;
 		obuoy = null;
-		setOpen(true);
 
 		/*
Index: applications/editors/josm/plugins/smed/src/smed/Smed.java
===================================================================
--- applications/editors/josm/plugins/smed/src/smed/Smed.java	(revision 23392)
+++ applications/editors/josm/plugins/smed/src/smed/Smed.java	(revision 23393)
@@ -32,6 +32,6 @@
 
     private JMenuItem item;
-    private SmedTabAction SmedTab;
-	private List<SmedPluggable> plugins = null;
+    private SmedTabAction smedTab;
+	// private List<SmedPluggable> plugins = null;
 
     public Smed(PluginInformation info) {
@@ -135,7 +135,8 @@
         }
         
-        SmedTab = new SmedTabAction();
-        item = Main.main.menu.toolsMenu.add(SmedTab);
-
+        smedTab = new SmedTabAction();
+        item = Main.main.menu.toolsMenu.add(smedTab);
+        smedTab.setOsmItem(item);
+        
         item.setEnabled(false);
 
@@ -148,12 +149,14 @@
         } else {
             item.setEnabled(false);
-            // SmpDialog.CloseDialog();
+            smedTab.closeDialog();
         }
     }
 
+    /*
     public void setPlugins(List<SmedPluggable> plugins)  {
     	this.plugins = plugins;
     	
     }
+    */
 
 }
Index: applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabAction.java
===================================================================
--- applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabAction.java	(revision 23392)
+++ applications/editors/josm/plugins/smed/src/smed/tabs/SmedTabAction.java	(revision 23393)
@@ -10,4 +10,5 @@
 
 import javax.swing.JFrame;
+import javax.swing.JMenuItem;
 import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
@@ -28,5 +29,8 @@
 	private SmedTabbedPane smedTabs = new SmedTabbedPane();
 	private SmedMenuBar smedMenu = new SmedMenuBar();
-
+	private JFrame frame = null;
+	private boolean isOpen = false;
+	private JMenuItem osmItem;
+	
     public SmedTabAction() {
         super( "Seekarten Editor", "Smed","Seekarten Editor", Shortcut.registerShortcut(
@@ -44,4 +48,9 @@
             }
         });
+        
+        isOpen = true;
+		if (osmItem == null) return;
+
+		osmItem.setEnabled(false);
     }
 
@@ -49,5 +58,5 @@
     protected void createAndShowTabs() {
         //Create and set up the window.
-        JFrame frame = new JFrame("TabbedPaneDemo");
+        frame = new JFrame("TabbedPaneDemo");
         frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
         frame.setResizable(false);
@@ -65,3 +74,23 @@
 
 
+	public void closeDialog() {
+		List<SmedPluggable> plugins = SmedTabbedPane.getPlugins();
+		
+		if(plugins != null) {
+			for(SmedPluggable p : plugins) p.stop();
+		}
+		
+		if(isOpen) {
+			frame.setVisible(false);
+			frame.dispose();
+		}
+		
+		isOpen = false;
+	}
+
+
+	public void setOsmItem(JMenuItem item) {
+		osmItem = item;		
+	}
+
 }
Index: applications/editors/josm/plugins/smed_about/build.xml
===================================================================
--- applications/editors/josm/plugins/smed_about/build.xml	(revision 23392)
+++ applications/editors/josm/plugins/smed_about/build.xml	(revision 23393)
@@ -48,5 +48,4 @@
 	<property name="smed.build.dir"         value="../smed/build"/>
 	<property name="smed.src.dir"           value="../smed/src"/>
-	<property name="smed.plugins"           value="../smed/plugins"/>
 	<!-- this is the directory where the plugin jar is copied to -->
 	<property name="ant.build.javac.target" value="1.5"/>
Index: applications/editors/josm/plugins/smed_ex/build.xml
===================================================================
--- applications/editors/josm/plugins/smed_ex/build.xml	(revision 23392)
+++ applications/editors/josm/plugins/smed_ex/build.xml	(revision 23393)
@@ -48,5 +48,4 @@
 	<property name="smed.build.dir"         value="../smed/build"/>
 	<property name="smed.src.dir"           value="../smed/src"/>
-	<property name="smed.plugins"           value="../smed/plugins"/>
 	<!-- this is the directory where the plugin jar is copied to -->
 	<property name="ant.build.javac.target" value="1.5"/>
