Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Rubezhny2020-04-29 18:47:22 +0000
committerNitin Dahyabhai2020-05-12 03:11:22 +0000
commitada1d9f33323e21ea538ce42b6d3a7e629816b21 (patch)
treec2d3218f3cb137468e77bcb397a2332cf8e3f6ba
parent7fd05d792c2c7d950f937d6511ba4d39de19ad50 (diff)
downloadwebtools.sourceediting-ada1d9f33323e21ea538ce42b6d3a7e629816b21.tar.gz
webtools.sourceediting-ada1d9f33323e21ea538ce42b6d3a7e629816b21.tar.xz
webtools.sourceediting-ada1d9f33323e21ea538ce42b6d3a7e629816b21.zip
Bug 562634 - Web UI directly references an action class defined in JSDT
Removed the mandatory dependency to JSDT from Web UI Change-Id: Ibb8682c4507f0d1e17f37f1cf0964c7386189c3c Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/META-INF/MANIFEST.MF3
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/icons/full/etool16/newjscript_wiz.gifbin0 -> 581 bytes
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/plugin.xml2
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/pom.xml2
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/AbstractOpenWizardAction.java10
-rw-r--r--web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/OpenJSWizardAction.java44
6 files changed, 49 insertions, 12 deletions
diff --git a/web/bundles/org.eclipse.wst.web.ui/META-INF/MANIFEST.MF b/web/bundles/org.eclipse.wst.web.ui/META-INF/MANIFEST.MF
index d1cbb64b19..4656a1786d 100644
--- a/web/bundles/org.eclipse.wst.web.ui/META-INF/MANIFEST.MF
+++ b/web/bundles/org.eclipse.wst.web.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.eclipse.wst.web.ui; singleton:=true
-Bundle-Version: 1.2.100.qualifier
+Bundle-Version: 1.2.101.qualifier
Bundle-Activator: org.eclipse.wst.web.ui.internal.WSTWebUIPlugin
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
@@ -26,6 +26,5 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="[3.13.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.7.0,4.0.0)",
org.eclipse.wst.css.ui;bundle-version="[1.1.0,1.2.0)",
org.eclipse.wst.html.ui;bundle-version="[1.1.0,1.2.0)",
- org.eclipse.wst.jsdt.ui;bundle-version="[2.0.0,3.0.0)",
org.eclipse.ui.navigator;bundle-version="[3.7.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/web/bundles/org.eclipse.wst.web.ui/icons/full/etool16/newjscript_wiz.gif b/web/bundles/org.eclipse.wst.web.ui/icons/full/etool16/newjscript_wiz.gif
new file mode 100644
index 0000000000..7cd1abc201
--- /dev/null
+++ b/web/bundles/org.eclipse.wst.web.ui/icons/full/etool16/newjscript_wiz.gif
Binary files differ
diff --git a/web/bundles/org.eclipse.wst.web.ui/plugin.xml b/web/bundles/org.eclipse.wst.web.ui/plugin.xml
index 634c03023f..4ccdef7107 100644
--- a/web/bundles/org.eclipse.wst.web.ui/plugin.xml
+++ b/web/bundles/org.eclipse.wst.web.ui/plugin.xml
@@ -117,7 +117,7 @@
tooltip="%action.tooltip.CSS" />
<action
class="org.eclipse.wst.web.ui.internal.actions.OpenJSWizardAction"
- icon="platform:/plugin/org.eclipse.wst.jsdt.ui/icons/full/etool16/newjscript_wiz.gif"
+ icon="platform:/plugin/org.eclipse.wst.web.ui/icons/full/etool16/newjscript_wiz.gif"
id="org.eclipse.wst.web.ui.actions.newJSFile"
label="%action.label.JS"
style="push"
diff --git a/web/bundles/org.eclipse.wst.web.ui/pom.xml b/web/bundles/org.eclipse.wst.web.ui/pom.xml
index 93c809ec01..bddd2ad36c 100644
--- a/web/bundles/org.eclipse.wst.web.ui/pom.xml
+++ b/web/bundles/org.eclipse.wst.web.ui/pom.xml
@@ -21,6 +21,6 @@
<groupId>org.eclipse.webtools.javaee</groupId>
<artifactId>org.eclipse.wst.web.ui</artifactId>
- <version>1.2.100-SNAPSHOT</version>
+ <version>1.2.101-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/AbstractOpenWizardAction.java b/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/AbstractOpenWizardAction.java
index a9434e4220..861f6d4b59 100644
--- a/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/AbstractOpenWizardAction.java
+++ b/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/AbstractOpenWizardAction.java
@@ -53,8 +53,13 @@ public abstract class AbstractOpenWizardAction implements IWorkbenchWindowAction
protected void openWizardDialog( IWorkbenchWizard wizard )
{
+ WizardDialog dialog = createWizardDialog(wizard);
+ dialog.open();
+ }
+
+ protected WizardDialog createWizardDialog(IWorkbenchWizard wizard) {
ISelection selection = window.getSelectionService().getSelection();
-
+
if ( selection instanceof IStructuredSelection )
{
wizard.init( window.getWorkbench(), (IStructuredSelection) selection );
@@ -68,7 +73,6 @@ public abstract class AbstractOpenWizardAction implements IWorkbenchWindowAction
WizardDialog dialog = new WizardDialog( parent, wizard );
dialog.create();
- dialog.open();
+ return dialog;
}
-
}
diff --git a/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/OpenJSWizardAction.java b/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/OpenJSWizardAction.java
index 82ded80869..27028c15d0 100644
--- a/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/OpenJSWizardAction.java
+++ b/web/bundles/org.eclipse.wst.web.ui/static_web_ui/org/eclipse/wst/web/ui/internal/actions/OpenJSWizardAction.java
@@ -12,15 +12,49 @@
*******************************************************************************/
package org.eclipse.wst.web.ui.internal.actions;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.wizards.IWizardDescriptor;
public class OpenJSWizardAction extends AbstractOpenWizardAction
{
-
+ static private final String NEW_JS_WIZARD = "org.eclipse.wst.jsdt.ui.NewJSWizard"; //$NON-NLS-1$
+ static private final String NEW_FILE_WIZARD = "org.eclipse.ui.wizards.new.file"; //$NON-NLS-1$
+
@Override
- public void run( IAction action )
- {
- openWizardDialog( new org.eclipse.wst.jsdt.internal.ui.wizards.NewJSWizard() );
+ public void run(IAction action) {
+ IWizardDescriptor newJSWizardDescriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(NEW_JS_WIZARD);
+ try {
+ IWorkbenchWizard wizard = newJSWizardDescriptor != null ? newJSWizardDescriptor.createWizard() : null;
+ if (wizard != null) {
+ openWizardDialog(wizard);
+ } else {
+ runAlternateWizard(action);
+ }
+ } catch (CoreException e1) {
+ // Ignore
+ }
+ }
+
+ public void runAlternateWizard(IAction action) {
+ IWizardDescriptor newFileWizardDescriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(NEW_FILE_WIZARD);
+ try {
+ IWorkbenchWizard wizard = newFileWizardDescriptor != null ? newFileWizardDescriptor.createWizard() : null;
+ if (wizard != null) {
+ WizardDialog dialog = createWizardDialog(wizard);
+ IWizardPage fp = wizard.getPage("newFilePage1"); //$NON-NLS-1$
+ if (fp instanceof WizardNewFileCreationPage) {
+ ((WizardNewFileCreationPage)fp).setFileExtension("js"); //$NON-NLS-1$
+ }
+ dialog.open();
+ }
+ } catch (CoreException e1) {
+ // Ignore
+ }
}
-
}

Back to the top