Index: /applications/editors/josm/plugins/pdfimport/README
===================================================================
--- /applications/editors/josm/plugins/pdfimport/README	(revision 34434)
+++ /applications/editors/josm/plugins/pdfimport/README	(revision 34435)
@@ -10,12 +10,12 @@
 Layout
 ======
-+--- src                                source of your plugin
-  |- images                             images your plugin needs
-  |- resources                          resources your plugin needs
++- src                                source of the plugin
++- images                             images the plugin needs
++- resources                          resources the plugin needs
++- libs								  libraries the plugin needs (pdfbox ...)
 
   README                                this file
 
-  GPL-v2.0.txt                          GPL version 2 license text
-  GPL-v3.0.txt                          GPL version 3 license text
+  license                               GPL version 3 license text
   build.xml                             deployment build file
 
@@ -67,4 +67,13 @@
  by automatic processes. 
 
+Hints for eclipse
+=================
+. Building:
+  . add pdfimport/src to your buildpath
+  . add to buildpath|libraries: josm-custom.jar, fontbox-...jar, jempbox...jar, pdfbox...jar
+  . build with ant, if any resources have changed (at least after svn update); eclipse cant handle build of resources, etc
+. Run / Debug
+  . main class: org.openstreetmap.josm.gui.MainApplication (found in josm-custom.jar)
+
 See also
 ========
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java	(revision 34434)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/LoadPdfDialog.java	(revision 34435)
@@ -281,5 +281,5 @@
 
 	private PathOptimizer pdfData;
-	private OsmDataLayer dataLayer;
+//	private OsmDataLayer dataLayer;
 
 	private final JButton loadFileButton = new JButton(tr("Load preview ..."));
@@ -713,6 +713,7 @@
 		 */
 		removeLayer();
-		dataLayer = _layer;
-		MainApplication.getLayerManager().addLayer(dataLayer);
+		Preview.set(_layer, placement);
+//		dataLayer = _layer;
+//		MainApplication.getLayerManager().addLayer(dataLayer);
 		MainApplication.getMap().mapView.zoomTo(placement.getWorldBounds(pdfData));
 	}
@@ -722,9 +723,10 @@
 		 * remove preview layer
 		 */
-		if (dataLayer != null) {
-			MainApplication.getLayerManager().removeLayer(dataLayer);
-			dataLayer.data.clear(); // saves memory
-			dataLayer = null;
-		}
+//		if (dataLayer != null) {
+//			MainApplication.getLayerManager().removeLayer(dataLayer);
+//			dataLayer.data.clear(); // saves memory
+//			dataLayer = null;
+//		}
+		Preview.clear();
 		// No layer ==> no actions
 		actionPanel.showButton.setEnabled(false);
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/Preview.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/Preview.java	(revision 34435)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/Preview.java	(revision 34435)
@@ -0,0 +1,42 @@
+/**
+ * License: GPL. For details, see LICENSE file.
+ */
+package pdfimport;
+
+import java.io.File;
+
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+
+import com.drew.lang.annotations.NotNull;
+
+/**
+ * @author Nzara
+ *
+ */
+public class Preview {
+	public static OsmDataLayer dataLayer;
+	public static FilePlacement placement;
+	
+	public static void set (@NotNull OsmDataLayer dataLayer, @NotNull FilePlacement placement) {
+		clear();
+		Preview.dataLayer = dataLayer;
+		Preview.placement = placement;
+		MainApplication.getLayerManager().addLayer(dataLayer);  
+	}
+	
+	public static void clear() {
+		if (Preview.dataLayer != null) {
+			MainApplication.getLayerManager().removeLayer(Preview.dataLayer);
+			Preview.dataLayer.data.clear(); // saves memory
+		}
+		Preview.dataLayer = null;
+		Preview.placement = null;
+	}
+	
+	public void save() {
+//		TODO: implement
+	}
+
+
+}
Index: /applications/editors/josm/plugins/pdfimport/src/pdfimport/ProjectionInfo.java
===================================================================
--- /applications/editors/josm/plugins/pdfimport/src/pdfimport/ProjectionInfo.java	(revision 34434)
+++ /applications/editors/josm/plugins/pdfimport/src/pdfimport/ProjectionInfo.java	(revision 34435)
@@ -26,6 +26,12 @@
     }
 
-    public static Projection getProjectionByCode(String code) {
-		return new SingleProjectionChoice(code.toString(), code.toString(), code).getProjection() ;
+	public static Projection getProjectionByCode(String code) {
+		try {
+			ProjectionChoice pc = new SingleProjectionChoice(code.toString(), code.toString(), code);
+			Projection p = pc.getProjection();
+			return p;
+		} catch (Exception e) {
+			throw new IllegalArgumentException();
+		}
 
 //        Projection p = allCodes.get(code);
