Permalink
Browse files

improved kml wizard (fixed missing icons), fixed NPE in WorkflowWizar…

…dAdapter
  • Loading branch information...
fgdrf committed May 9, 2012
1 parent f6ff2ca commit e04c9fd8e8391922d4eddc68eb992ff7469aa9f5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
/*
- * JGrass - Free Open Source Java GIS http://www.jgrass.org
* (C) HydroloGIS - www.hydrologis.com
+ * JGrass - Free Open Source Java GIS http://www.jgrass.org
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Library General Public License as published by the Free
@@ -18,14 +18,17 @@
*/
package eu.udig.catalog.kml.core;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
+import net.refractions.udig.core.AbstractUdigUIPlugin;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
* @author Frank Gasdorf
*/
-public class KmlToolPlugin extends AbstractUIPlugin {
+public class KmlToolPlugin extends AbstractUdigUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "eu.udig.tools.kml"; //$NON-NLS-1$
@@ -66,4 +69,9 @@ public static KmlToolPlugin getDefault() {
return plugin;
}
+ @Override
+ public IPath getIconPath() {
+ return new Path(DEFAULT_ICON_PATH);
+ }
+
}
@@ -0,0 +1,26 @@
+package eu.udig.catalog.kml.internal.ui;
+
+/**
+ * Image constants for the kml bundle
+ *
+ * @author Frank Gasdorf
+ */
+
+public interface ImageConstants {
+
+ /**
+ * Wizard banners
+ */
+ public final static String PATH_WIZBAN = "wizban/"; //$NON-NLS-1$
+
+ /**
+ * import wizard banner icon
+ */
+ public final static String IMPORTKML_WIZ = PATH_WIZBAN + "importkml_wiz.gif"; //$NON-NLS-1$
+
+ /**
+ * export wizard banner icon
+ */
+ public final static String EXPORTKML_WIZ = PATH_WIZBAN + "exportkml_wiz.gif"; //$NON-NLS-1$
+
+}
@@ -32,14 +32,14 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IExportWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.geotools.data.simple.SimpleFeatureSource;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import eu.udig.catalog.kml.core.KmlToolPlugin;
import eu.udig.catalog.kml.core.KmlUtils;
import eu.udig.catalog.kml.internal.Messages;
+import eu.udig.catalog.kml.internal.ui.ImageConstants;
/**
* @author Andrea Antonello (www.hydrologis.com)
@@ -57,8 +57,7 @@ public KmlExportWizard() {
public void init( IWorkbench workbench, IStructuredSelection selection ) {
setWindowTitle(Messages.getString("KmlExportWizard.windowTitle")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(KmlToolPlugin.PLUGIN_ID,
- "icons/export_wiz.png")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(KmlToolPlugin.getDefault().getImageDescriptor(ImageConstants.EXPORTKML_WIZ));
setNeedsProgressMonitor(true);
mainPage = new KmlExportWizardPage();
@@ -36,7 +36,6 @@
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.geotools.data.FeatureStore;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.opengis.feature.simple.SimpleFeature;
@@ -45,6 +44,7 @@
import eu.udig.catalog.kml.core.KmlToolPlugin;
import eu.udig.catalog.kml.core.KmlUtils;
import eu.udig.catalog.kml.internal.Messages;
+import eu.udig.catalog.kml.internal.ui.ImageConstants;
/**
* @author Andrea Antonello - www.hydrologis.com
* @author Frank Gasdorf
@@ -63,8 +63,7 @@ public KmlImportWizard() {
public void init( IWorkbench workbench, IStructuredSelection selection ) {
setWindowTitle(Messages.getString("KmlImportWizard.windowTitle")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(KmlToolPlugin.PLUGIN_ID,
- "icons/icon_kml48.png")); //$NON-NLS-1$
+ setDefaultPageImageDescriptor(KmlToolPlugin.getDefault().getImageDescriptor(ImageConstants.IMPORTKML_WIZ));
setNeedsProgressMonitor(true);
mainPage = new KmlImportWizardPage(Messages.getString("KmlImportWizard.KmlFilImportPageName"), params); //$NON-NLS-1$
}
@@ -112,7 +112,9 @@ public void init( IWorkbench workbench, IStructuredSelection selection ) {
public void handleEvent( Event event ) {
// this is called when the dialog is closed either by cancel or finish
- getContainer().getShell().close();
+ if (getContainer() != null && getContainer().getShell() != null) {
+ getContainer().getShell().close();
+ }
}
}
@@ -28,6 +28,11 @@
* @author fgdrf
*/
public abstract class AbstractUdigUIPlugin extends AbstractUIPlugin {
+
+ /**
+ * the default Icon path to access images
+ */
+ public static final String DEFAULT_ICON_PATH = "icons/";
/**
* The constructor.

0 comments on commit e04c9fd

Please sign in to comment.