Bug 2207 fix, wizard banners
authorEugene Ostroukhov <eugeneo@symbian.org>
Thu, 11 Mar 2010 16:45:18 -0800
changeset 260 38f012067872
parent 259 2c5d9bdb5cce
child 261 a691cdb6c78a
Bug 2207 fix, wizard banners
org.symbian.tools.wrttools/plugin.xml
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/WRTImages.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WgzImportWizard.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java
org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectsImportWizard.java
--- a/org.symbian.tools.wrttools/plugin.xml	Thu Mar 11 16:16:44 2010 -0800
+++ b/org.symbian.tools.wrttools/plugin.xml	Thu Mar 11 16:45:18 2010 -0800
@@ -191,19 +191,32 @@
 	</extension>
 	 
 	<extension point="org.eclipse.ui.newWizards">
-		<category id="org.symbian.tools.wrttools.core.category" banner="WRT_Wizard_banner.png" name="Web Runtime(WRT)">
+		<category id="org.symbian.tools.wrttools.core.category" name="Web Runtime(WRT)">
 		</category>
 		<wizard category="org.symbian.tools.wrttools.core.category"
 			class="org.symbian.tools.wrttools.wizards.WrtWidgetWizard"
 			finalPerspective="org.symbian.tools.wrttools.mainPerspective"
 			hasPages="true" icon="icons/WRT_main_16.png"
-			id="org.symbian.tools.wrttools.core.wrtwidgetwizard" name="Web Runtime Application"
+			id="org.symbian.tools.wrttools.core.wrtwidgetwizard" name="Web Runtime Application Project"
 			project="true">
 			<description>
 				Creates a new Symbian WRT application project using one of the provided
 				templates
          </description>
 		</wizard>
+  <wizard
+        category="org.symbian.tools.wrttools.import"
+        class="org.symbian.tools.wrttools.wizards.WgzImportWizard"
+        finalPerspective="org.symbian.tools.wrttools.mainPerspective"
+        hasPages="true"
+        icon="icons/import_16x16px.png"
+        id="org.symbian.tools.wrttools.importwgz"
+        name="WRT Project from WGZ Archive"
+        project="true">
+     <description>
+        Create WRT project from deployable WGZ application archive
+     </description>
+  </wizard>
 	</extension>
 	
 <!-- WRT Project Templates -->
@@ -275,23 +288,11 @@
 		<wizard category="org.symbian.tools.wrttools.import"
 			class="org.symbian.tools.wrttools.wizards.projectimport.WrtProjectsImportWizard"
 			icon="icons/import_aptana_project.gif" id="org.symbian.tools.wrttools.import.projectImport"
-			banner="icons/import_wizard_banner.png"
-			name="WRT Project">
+			name="Existing WRT Projects into Workspace">
      <description>
         Import WRT project created in Aptana, Adobe Dreamweaver or WRT IDE
      </description>
 		</wizard>
-       <wizard
-          category="org.symbian.tools.wrttools.import"
-          class="org.symbian.tools.wrttools.wizards.WgzImportWizard"
-          icon="icons/import_16x16px.png"
-          id="org.symbian.tools.wrttools.importwgz"
-          banner="icons/import_w_banner.png"
-          name="Sources from WGZ File">
-          <description>
-             Create WRT project from deployable WGZ application archive
-          </description>
-       </wizard>
     </extension>
 	
 <!-- Problem Markers -->
@@ -323,11 +324,21 @@
 		<perspectiveExtension targetID="org.eclipse.wst.jsdt.ui.JavaPerspective">
 			<newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard">
 			</newWizardShortcut>
+			<newWizardShortcut id="org.symbian.tools.wrttools.importwgz">
+			</newWizardShortcut>
 		</perspectiveExtension>
 		<perspectiveExtension targetID="org.eclipse.debug.ui.DebugPerspective">
 			<newWizardShortcut id="org.symbian.tools.wrttools.core.wrtwidgetwizard">
 			</newWizardShortcut>
+			<newWizardShortcut id="org.symbian.tools.wrttools.importwgz">
+			</newWizardShortcut>
 		</perspectiveExtension>
+  <perspectiveExtension
+        targetID="org.symbian.tools.wrttools.mainPerspective">
+     <newWizardShortcut
+           id="org.symbian.tools.wrttools.importwgz">
+     </newWizardShortcut>
+  </perspectiveExtension>
 	</extension>
 	
 <!-- Navigator Extensions -->
@@ -555,7 +566,8 @@
           </enablement>
        </commonWizard>
        <commonWizard
-             type="import"
+             menuGroupId="group.new"
+             type="new"
              wizardId="org.symbian.tools.wrttools.importwgz">
           <enablement>
              <or>
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Thu Mar 11 16:16:44 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/Activator.java	Thu Mar 11 16:45:18 2010 -0800
@@ -22,13 +22,13 @@
 
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageRegistry;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 import org.osgi.framework.BundleContext;
-import com.intel.bluetooth.BlueCoveImpl;
+import org.symbian.tools.wrttools.core.WRTImages;
+import org.symbian.tools.wrttools.sdt.utils.Logging;
 
-import org.symbian.tools.wrttools.core.deploy.PreferenceConstants;
-import org.symbian.tools.wrttools.sdt.utils.Logging;
+import com.intel.bluetooth.BlueCoveImpl;
 
 /**
  * The activator class controls the plug-in life cycle
@@ -73,17 +73,11 @@
 		plugin = null;
 		super.stop(context);
 	}
-/*	
-	public void startBluetoothOperation() {
-		IPreferenceStore prefStore = getPreferenceStore();
-		if (prefStore.getBoolean(PreferenceConstants.DEBUG_ENABLED))
-			enableBlueCoveDiagnostics(true);
-	}
-	
-	public void stopBluetoothOperation() {
-		enableBlueCoveDiagnostics(false);
-	}
-*/
+
+    @Override
+    protected void initializeImageRegistry(ImageRegistry reg) {
+        WRTImages.init(reg);
+    }
 	
 	/** Toggle BlueCove logging
 	 */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/core/WRTImages.java	Thu Mar 11 16:45:18 2010 -0800
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2010 Symbian Foundation and/or its subsidiary(-ies).
+ * All rights reserved.
+ * This component and the accompanying materials are made available
+ * under the terms of the License "Eclipse Public License v1.0"
+ * which accompanies this distribution, and is available
+ * at the URL "http://www.eclipse.org/legal/epl-v10.html".
+ *
+ * Initial Contributors:
+ * Symbian Foundation - initial contribution.
+ * Contributors:
+ * Description:
+ * Overview:
+ * Details:
+ * Platforms/Drives/Compatibility:
+ * Assumptions/Requirement/Pre-requisites:
+ * Failures and causes:
+ */
+package org.symbian.tools.wrttools.core;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.symbian.tools.wrttools.Activator;
+
+public class WRTImages {
+    private static final String IMAGE_IMPORT_WIZARD_BANNER = "import_wizard_banner.png";
+    private static final String IMAGE_IMPORT_WGZ_BANNER = "import_w_banner.png";
+    private static final String IMAGE_NEW_WIZARD_BANNER = "WRT_wizard_banner.png";
+
+    public static void init(ImageRegistry reg) {
+        add(reg, IMAGE_IMPORT_WIZARD_BANNER);
+        add(reg, IMAGE_IMPORT_WGZ_BANNER);
+        add(reg, IMAGE_NEW_WIZARD_BANNER);
+    }
+
+    private static void add(ImageRegistry reg, String key) {
+        reg.put(key, Activator.imageDescriptorFromPlugin(Activator.PLUGIN_ID, "/icons/" + key));
+    }
+
+    public static ImageDescriptor importWizardBanner() {
+        return Activator.getDefault().getImageRegistry().getDescriptor(IMAGE_IMPORT_WIZARD_BANNER);
+    }
+
+    public static ImageDescriptor importWgzWizardBanner() {
+        return Activator.getDefault().getImageRegistry().getDescriptor(IMAGE_IMPORT_WGZ_BANNER);
+    }
+
+    public static ImageDescriptor newWizardBanner() {
+        return Activator.getDefault().getImageRegistry().getDescriptor(IMAGE_NEW_WIZARD_BANNER);
+    }
+
+}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WgzImportWizard.java	Thu Mar 11 16:16:44 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WgzImportWizard.java	Thu Mar 11 16:45:18 2010 -0800
@@ -12,6 +12,8 @@
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
@@ -20,18 +22,23 @@
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
 import org.symbian.tools.wrttools.Activator;
+import org.symbian.tools.wrttools.core.WRTImages;
 import org.symbian.tools.wrttools.core.WrtIdeCorePreferences;
 import org.symbian.tools.wrttools.util.ProjectUtils;
 
-public class WgzImportWizard extends Wizard implements IImportWizard {
+public class WgzImportWizard extends Wizard implements IImportWizard, INewWizard, IExecutableExtension {
 	private IFile file;
 	private WgzImportWizardPage page;
+    private IConfigurationElement config;
 
 	public WgzImportWizard() {
 		setWindowTitle("Import WRT Application Archive");
+        setDefaultPageImageDescriptor(WRTImages.importWgzWizardBanner());
 		setNeedsProgressMonitor(true);
 	}
 
@@ -89,6 +96,7 @@
 				}
 			});
 			if (holder[0] != null) {
+                BasicNewProjectResourceWizard.updatePerspective(config);
                 Activator.getDefault().getPreferenceStore().setValue(WrtIdeCorePreferences.WGZ_IMPORT_PATH,
                         new File(archiveName).getParentFile().getAbsolutePath());
 				ProjectUtils.focusOn(holder[0]);
@@ -119,4 +127,9 @@
 		}
 	}
 
+    public void setInitializationData(IConfigurationElement config, String propertyName, Object data)
+            throws CoreException {
+        this.config = config;
+    }
+
 }
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java	Thu Mar 11 16:16:44 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/WrtWidgetWizard.java	Thu Mar 11 16:45:18 2010 -0800
@@ -59,6 +59,7 @@
 import org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer;
 import org.symbian.tools.wrttools.Activator;
 import org.symbian.tools.wrttools.core.ProjectTemplate;
+import org.symbian.tools.wrttools.core.WRTImages;
 import org.symbian.tools.wrttools.core.libraries.IWrtIdeContainer;
 import org.symbian.tools.wrttools.util.NonClosingStream;
 import org.symbian.tools.wrttools.util.ProjectUtils;
@@ -67,12 +68,13 @@
 	private WizardNewProjectCreationPage resourcePage;
 	private WizardContext context;
 	private DataBindingContext bindingContext;
-	private Map<ProjectTemplate, WRTProjectDetailsWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectDetailsWizardPage>();
+	private final Map<ProjectTemplate, WRTProjectDetailsWizardPage> templateDetails = new HashMap<ProjectTemplate, WRTProjectDetailsWizardPage>();
 	private WRTProjectTemplateWizardPage templatesPage;
 	private WRTProjectFilesWizardPage filesPage;
 	private IConfigurationElement config;
 
 	public WrtWidgetWizard() {
+        setDefaultPageImageDescriptor(WRTImages.newWizardBanner());
 		setWindowTitle("New Web Runtime Application");
 		setNeedsProgressMonitor(true);
 	}
--- a/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectsImportWizard.java	Thu Mar 11 16:16:44 2010 -0800
+++ b/org.symbian.tools.wrttools/src/org/symbian/tools/wrttools/wizards/projectimport/WrtProjectsImportWizard.java	Thu Mar 11 16:45:18 2010 -0800
@@ -30,6 +30,7 @@
 import org.eclipse.ui.INewWizard;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+import org.symbian.tools.wrttools.core.WRTImages;
 import org.symbian.tools.wrttools.util.ProjectUtils;
 
 public class WrtProjectsImportWizard extends Wizard implements
@@ -41,7 +42,8 @@
     public WrtProjectsImportWizard() {
         setWindowTitle("Import WRT Project");
 		setNeedsProgressMonitor(true);
-	}
+        setDefaultPageImageDescriptor(WRTImages.importWizardBanner());
+    }
 
 	@Override
 	public boolean performCancel() {