393448 - convert our plugin.xml popupMenus and actionsSets to the
command extension point
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
index 59063a4..6b9c12c 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/META-INF/MANIFEST.MF
@@ -26,6 +26,5 @@
Export-Package: org.eclipse.jpt.dbws.eclipselink.core.internal.gen;x-internal:=true,
org.eclipse.jpt.dbws.eclipselink.ui,
org.eclipse.jpt.dbws.eclipselink.ui.internal;x-internal:=true,
- org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;x-internal:=true,
org.eclipse.jpt.dbws.eclipselink.ui.internal.wizards.gen;x-internal:=true
Import-Package: com.ibm.icu.text;version="4.0.1"
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml
index 462d1ad..b562541 100644
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/plugin.xml
@@ -12,6 +12,54 @@
<plugin>
+
+ <!-- ***** commands ***** -->
+
+ <extension
+ point="org.eclipse.ui.commands">
+
+ <command
+ id="org.eclipse.jpt.dbws.ui.generateDbws"
+ name="%generateDBWS" >
+ </command>
+
+ </extension>
+
+
+ <!-- ***** handlers ***** -->
+
+ <extension
+ point="org.eclipse.ui.handlers">
+
+ <handler
+ commandId="org.eclipse.jpt.dbws.ui.generateDbws"
+ class="org.eclipse.jpt.dbws.eclipselink.ui.internal.handlers.GenerateDbwsHandler">
+ <activeWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <and>
+ <adapt type="org.eclipse.core.resources.IFile">
+ <and>
+ <test
+ property="org.eclipse.core.resources.name"
+ value="*builder.xml"/>
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jst.web"/>
+ </and>
+ </adapt>
+ </and>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+
+ </extension>
+
+
+ <!-- ***** menus ***** -->
+
<extension
point="org.eclipse.ui.menus">
@@ -24,9 +72,22 @@
label="%dbwsWizardCategoryName">
</menu>
</menuContribution>
+
+ <!-- contributions to the "Database Web Services" submenu -->
+
+ <menuContribution
+ locationURI="popup:org.eclipse.jpt.dbws.ui.menu.WebServices">
+
+ <command commandId="org.eclipse.jpt.dbws.ui.generateDbws">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ </menuContribution>
+
</extension>
-
+
+
+ <!-- ***** newWizards ***** -->
<extension
point="org.eclipse.ui.newWizards">
@@ -45,33 +106,5 @@
</wizard>
</extension>
-
-
- <extension
- point="org.eclipse.ui.popupMenus">
-
- <!-- contributions to the "Generate" submenu -->
- <objectContribution
- id="org.eclipse.jpt.dbws.eclipelink.ui.xsdFileActions"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*builder.xml">
-
- <filter
- name="projectNature"
- value="org.eclipse.jdt.core.javanature">
- </filter>
- <enablement>
- <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="jst.web"/>
- </enablement>
- <action
- id="org.eclipse.jpt.dbws.ui.generateDbws"
- label="%generateDBWS"
- menubarPath="org.eclipse.jpt.dbws.ui.menu.WebServices/content"
- class="org.eclipse.jpt.dbws.eclipselink.ui.internal.actions.GenerateDbwsAction">
- </action>
- </objectContribution>
-
- </extension>
-
</plugin>
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java
deleted file mode 100644
index 1dfee6b..0000000
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/GenerateDbwsAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.dbws.eclipselink.ui.internal.DbwsGeneratorUi;
-
-/**
- * GenerateDbwsAction
- */
-public class GenerateDbwsAction extends ObjectAction
-{
-
- @Override
- protected void execute(IFile xmlFile) {
-
- DbwsGeneratorUi.generate(xmlFile);
- }
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java
deleted file mode 100644
index 5c90f1e..0000000
--- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.ui/src/org/eclipse/jpt/dbws/eclipselink/ui/internal/actions/ObjectAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.dbws.eclipselink.ui.internal.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * GenerateEntitiesAction
- */
-public abstract class ObjectAction extends ActionDelegate implements IObjectActionDelegate
-{
- private ISelection currentSelection;
-
- public ObjectAction() {
- super();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- // do nothing
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- this.currentSelection = selection;
- }
-
- @Override
- public void run(IAction action) {
- if (this.currentSelection instanceof ITreeSelection) {
- for (Iterator<?> stream = ((ITreeSelection) this.currentSelection).iterator(); stream.hasNext(); ) {
- this.execute(stream.next());
- }
- }
- }
-
- protected void execute(Object selection) {
-
- if(selection instanceof IFile) {
- this.execute((IFile)selection);
- }
- }
-
- @SuppressWarnings("unused")
- protected void execute(IFile file) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
index 83ccf89..7b07908 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF
@@ -35,9 +35,9 @@
Export-Package: org.eclipse.jpt.jaxb.ui,
org.eclipse.jpt.jaxb.ui.internal;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.actions;x-internal:=true,
- org.eclipse.jpt.jaxb.ui.internal.commands;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.filters;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.gen;x-internal:=true,
+ org.eclipse.jpt.jaxb.ui.internal.handlers;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.jaxb21;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.jaxb22;x-internal:=true,
org.eclipse.jpt.jaxb.ui.internal.navigator;x-internal:=true,
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
index b12082d..f80c834 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml
Binary files differ
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java
deleted file mode 100644
index 526fd69..0000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.actions;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jpt.jaxb.ui.internal.ClassesGeneratorUi;
-
-/**
- * GenerateClassesAction
- */
-public class GenerateClassesAction extends ObjectAction
-{
-
- @Override
- protected void execute(IFile xsdFile) {
-
- ClassesGeneratorUi.generate(xsdFile);
- }
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java
deleted file mode 100644
index 652d75a..0000000
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2010 Oracle. All rights reserved.
-* This program and the accompanying materials are made available under the
-* terms of the Eclipse Public License v1.0, which accompanies this distribution
-* and is available at http://www.eclipse.org/legal/epl-v10.html.
-*
-* Contributors:
-* Oracle - initial API and implementation
-*******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.actions;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ITreeSelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionDelegate;
-
-/**
- * GenerateEntitiesAction
- */
-public abstract class ObjectAction extends ActionDelegate implements IObjectActionDelegate
-{
- private ISelection currentSelection;
-
- public ObjectAction() {
- super();
- }
-
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- // do nothing
- }
-
- @Override
- public void selectionChanged(IAction action, ISelection selection) {
- this.currentSelection = selection;
- }
-
- @Override
- public void run(IAction action) {
- if (this.currentSelection instanceof ITreeSelection) {
- for (Iterator<?> stream = ((ITreeSelection) this.currentSelection).iterator(); stream.hasNext(); ) {
- this.execute(stream.next());
- }
- }
- }
-
- protected void execute(Object selection) {
-
- if(selection instanceof IFile) {
- this.execute((IFile)selection);
- }
- }
-
- @SuppressWarnings("unused")
- protected void execute(IFile file) {
- throw new UnsupportedOperationException();
- }
-
-}
diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/handlers/CreatePackageInfoCommandHandler.java
similarity index 98%
rename from jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java
rename to jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/handlers/CreatePackageInfoCommandHandler.java
index 42bb24c..04cf56f 100644
--- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/commands/CreatePackageInfoCommandHandler.java
+++ b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/handlers/CreatePackageInfoCommandHandler.java
@@ -7,7 +7,7 @@
* Contributors:
* Oracle - initial API and implementation
******************************************************************************/
-package org.eclipse.jpt.jaxb.ui.internal.commands;
+package org.eclipse.jpt.jaxb.ui.internal.handlers;
import java.util.Iterator;
import java.util.List;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
index 27fc9f7..40322d1 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF
@@ -57,6 +57,7 @@
org.eclipse.jpt.jpa.eclipselink.ui.internal.persistence.options;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.persistencexml.details;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.platform;x-internal:=true,
+ org.eclipse.jpt.jpa.eclipselink.ui.internal.plugin;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.structure;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.v2_0.persistence;x-internal:=true,
org.eclipse.jpt.jpa.eclipselink.ui.internal.weave;x-internal:=true,
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
index 8a73d10..ae33610 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml
@@ -68,7 +68,7 @@
id="org.eclipse.jpt.jpa.eclipselink"
name="%eclipseLinkWizardCategoryName"
parentCategory="org.eclipse.jpt.jpa"/>
-
+
<!-- bug 395126
icon="platform:/plugin/org.eclipse.jpt.jpa.ui/$nl$/images/buttons/new-jpa-file.gif"
-->
@@ -233,6 +233,16 @@
<extension
point="org.eclipse.ui.commands">
+
+ <command
+ id="org.eclipse.jpt.jpa.eclipselink.ui.newEclipseLinkMappingFile"
+ name="%newEclipseLinkMappingFileWizardName">
+ </command>
+
+ <command
+ id="org.eclipse.jpt.jpa.eclipselink.ui.newDynamicEntity"
+ name="%newEclipseLinkDynamicEntityName">
+ </command>
<command
id="org.eclipse.jpt.jpa.eclipselink.ui.persistentTypeAddVirtualAttribute"
@@ -261,6 +271,16 @@
point="org.eclipse.ui.handlers">
<handler
+ commandId="org.eclipse.jpt.jpa.eclipselink.ui.newEclipseLinkMappingFile"
+ class="org.eclipse.jpt.jpa.eclipselink.ui.internal.handlers.NewEclipseLinkMappingFileHandler">
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.eclipselink.ui.newDynamicEntity"
+ class="org.eclipse.jpt.jpa.eclipselink.ui.internal.handlers.NewDynamicEntityHandler">
+ </handler>
+
+ <handler
commandId="org.eclipse.jpt.jpa.eclipselink.ui.persistentTypeAddVirtualAttribute"
class="org.eclipse.jpt.jpa.eclipselink.ui.internal.handlers.AddVirtualAttributeHandler">
<activeWhen>
@@ -361,8 +381,31 @@
<extension
point="org.eclipse.ui.menus">
+ <!-- contributions to the JptCreation pulldown -->
+ <menuContribution
+ locationURI="menu:org.eclipse.jpt.jpa.ui.jptCreation.pulldown?after=jptCreation.separator">
+
+ <command
+ commandId="org.eclipse.jpt.jpa.eclipselink.ui.newEclipseLinkMappingFile"
+ label="%newEclipseLinkMappingFileWizardName"
+ icon="platform:/plugin/org.eclipse.jpt.jpa.ui/images/buttons/new-jpa-file.gif"
+ disabledIcon="platform:/plugin/org.eclipse.jpt.jpa.ui/images/buttons/new-jpa-file.gif"
+ style="push">
+ </command>
+
+ <command
+ commandId="org.eclipse.jpt.jpa.eclipselink.ui.newDynamicEntity"
+ label="%newEclipseLinkDynamicEntityName"
+ icon="platform:/plugin/org.eclipse.jpt.jpa.ui/images/buttons/new-entity.gif"
+ disabledIcon="platform:/plugin/org.eclipse.jpt.jpa.ui/images/buttons/new-entity.gif"
+ style="push">
+ </command>
+
+ </menuContribution>
+
<!-- contributions to the "JPA Tools" submenu -->
- <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools?after=generate">
+ <menuContribution
+ locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools?after=generate">
<command commandId="org.eclipse.jpt.jpa.eclipselink.ui.generateDynamicEntities">
<visibleWhen checkEnabled="true"/>
@@ -384,7 +427,8 @@
</menuContribution>
<!-- contributions to objects in the JPA structure view -->
- <menuContribution locationURI="popup:org.eclipse.jpt.ui.jpaStructureView">
+ <menuContribution
+ locationURI="popup:org.eclipse.jpt.ui.jpaStructureView">
<command commandId="org.eclipse.jpt.jpa.eclipselink.ui.persistentTypeAddVirtualAttribute">
<visibleWhen checkEnabled="true"/>
@@ -392,7 +436,8 @@
</menuContribution>
<!-- contributions to "Move to XML" submenu-->
- <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.moveToXml">
+ <menuContribution
+ locationURI="popup:org.eclipse.jpt.jpa.ui.menu.moveToXml">
<command
commandId="org.eclipse.jpt.jpa.eclipselink.ui.convertJavaConverters"
@@ -403,7 +448,9 @@
</menuContribution>
<!-- contributions for any popup -->
- <menuContribution locationURI="popup:org.eclipse.ui.popup.any">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any">
+
<command commandId="org.eclipse.jpt.jpa.eclipselink.ui.upgradeToEclipseLinkMappingFile">
<visibleWhen>
<iterate ifEmpty="false">
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/commands/JavaConverterConversionHandler.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/commands/JavaConverterConversionHandler.java
index a90c210..34f74d9 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/commands/JavaConverterConversionHandler.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/commands/JavaConverterConversionHandler.java
@@ -11,7 +11,7 @@
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.eclipselink.ui.internal.platform.EclipseLinkJpaPlatformUi;
-import org.eclipse.jpt.jpa.ui.internal.commands.AbstractJavaMetadataConversionHandler;
+import org.eclipse.jpt.jpa.ui.internal.handlers.AbstractJavaMetadataConversionHandler;
public class JavaConverterConversionHandler
extends AbstractJavaMetadataConversionHandler
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
index cb80718..b9e2ad0 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties
@@ -74,8 +74,8 @@
jpaStructure = JPA Structure
JpaProposalCategory = JPA Proposals
-JptCreationActionSet.label = JPA Element Creation
-JptCreationActionSet.description = Command group for creating JPA elements
+JptCreationToolbar.label = JPA Element Creation
+JptCreationToolbar.description = Command group for creating JPA elements
NewEntityAction.label = New Entity
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml
index 5c18d8c..238eea6 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml
+++ b/jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml
@@ -226,29 +226,6 @@
factoryClass="org.eclipse.jpt.jpa.ui.internal.jpa2.platform.generic.Generic2_1JpaPlatformUiFactory"/>
</extension>
-
-
- <!-- ***** action sets ***** -->
-
- <extension
- point="org.eclipse.ui.actionSets">
-
- <actionSet
- description="%JptCreationActionSet.description"
- id="org.eclipse.jpt.jpa.ui.JptCreationActionSet"
- label="%JptCreationActionSet.label">
- <action
- class="org.eclipse.jpt.jpa.ui.internal.wizards.NewEntityDropDownAction"
- disabledIcon="$nl$/images/buttons/new-entity-disabled.gif"
- icon="$nl$/images/buttons/new-entity.gif"
- id="org.eclipse.jpt.jpa.ui.NewEntityAction"
- label="%NewEntityAction.label"
- style="pulldown"
- toolbarPath="Normal/JptWizards">
- </action>
- </actionSet>
-
- </extension>
<!-- ***** commands ***** -->
@@ -266,7 +243,37 @@
id="org.eclipse.jpt.jpa.ui.xmlFileUpgradeToLatestVersion"
name="%upgradeToLatestVersion">
</command>
+
+ <command
+ id="org.eclipse.jpt.jpa.ui.generateDDL"
+ name="%generateDDL" >
+ </command>
+
+ <command
+ id="org.eclipse.jpt.jpa.ui.newEntity"
+ name="%newJpaEntityWizardName">
+ </command>
+ <command
+ id="org.eclipse.jpt.jpa.ui.newMappingFile"
+ name="%newJpaMappingFileWizardName">
+ </command>
+
+ <command
+ id="org.eclipse.jpt.jpa.ui.generateEntities"
+ name="%generateEntities" >
+ </command>
+
+ <command
+ id="org.eclipse.jpt.jpa.ui.makePersistent"
+ name="%makePersistent" >
+ </command>
+
+ <command
+ id="org.eclipse.jpt.jpa.core.synchronizeClasses"
+ name="%synchronizeClasses" >
+ </command>
+
<category
id="org.eclipse.jpt.jpa.ui.jpaStructureViewCommands"
name="%jpaStructureViewCommandCategory">
@@ -361,7 +368,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.convertJavaProjectToJpa"
- class="org.eclipse.jpt.jpa.ui.internal.commands.ConvertJavaProjectToJpaCommandHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.ConvertJavaProjectToJpaCommandHandler">
<activeWhen>
<with variable="selection">
<count value="1"/>
@@ -383,7 +390,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.xmlFileUpgradeToLatestVersion"
- class="org.eclipse.jpt.jpa.ui.internal.commands.UpgradeXmlFileVersionHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.UpgradeXmlFileVersionHandler">
<activeWhen>
<iterate ifEmpty="false">
<adapt type="org.eclipse.jpt.jpa.core.context.XmlFile">
@@ -395,7 +402,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.xmlFileUpgradeToLatestVersion"
- class="org.eclipse.jpt.jpa.ui.internal.commands.UpgradeXmlResourceVersionHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.UpgradeXmlResourceVersionHandler">
<activeWhen>
<iterate ifEmpty="false">
<adapt type="org.eclipse.jpt.common.core.resource.xml.JptXmlResource">
@@ -404,10 +411,100 @@
</iterate>
</activeWhen>
</handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.ui.newEntity"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.NewEntityHandler">
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.ui.newMappingFile"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.NewMappingFileHandler">
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.ui.generateDDL"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.GenerateDDLHandler">
+ <activeWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <and>
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jpa"/>
+ </and>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.ui.generateEntities"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.GenerateEntitiesHandler">
+ <activeWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <adapt type="org.eclipse.core.resources.IProject">
+ <and>
+ <test
+ property="org.eclipse.wst.common.project.facet.core.projectFacet"
+ value="jpt.jpa"/>
+ </and>
+ </adapt>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.ui.makePersistent"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.MakePersistentHandler">
+ <enabledWhen>
+ <with variable="selection">
+ <count value="+"/>
+ <iterate>
+ <and>
+ <adapt type="org.eclipse.jdt.core.IJavaElement" />
+ <or>
+ <instanceof value="org.eclipse.jdt.core.ICompilationUnit"/>
+ <instanceof value="org.eclipse.jdt.core.IType"/>
+ <instanceof value="org.eclipse.jdt.core.IPackageFragment"/>
+ <instanceof value="org.eclipse.jdt.core.IPackageFragmentRoot"/>
+ </or>
+ </and>
+ </iterate>
+ </with>
+ </enabledWhen>
+ </handler>
+
+ <handler
+ commandId="org.eclipse.jpt.jpa.core.synchronizeClasses"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.SynchronizeClassesHandler">
+ <activeWhen>
+ <with variable="selection">
+ <count value="1"/>
+ <iterate>
+ <or>
+ <adapt type="org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml" />
+ <adapt type="org.eclipse.core.resources.IFile">
+ <test
+ property="org.eclipse.core.resources.name"
+ value="persistence.xml">
+ </test>
+ </adapt>
+ </or>
+ </iterate>
+ </with>
+ </activeWhen>
+ </handler>
<handler
commandId="org.eclipse.jpt.jpa.ui.entityMappingsAddPersistentClass"
- class="org.eclipse.jpt.jpa.ui.internal.commands.AddPersistentClassHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.AddPersistentClassHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -421,7 +518,7 @@
<handler
commandId="org.eclipse.ui.edit.delete"
- class="org.eclipse.jpt.jpa.ui.internal.commands.RemovePersistentClassHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.RemovePersistentClassHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -434,7 +531,7 @@
<handler
commandId="org.eclipse.ui.edit.delete"
- class="org.eclipse.jpt.jpa.ui.internal.commands.RemovePersistentAttributeFromXmlHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.RemovePersistentAttributeFromXmlHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -448,7 +545,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.persistentAttributeAddToXml"
- class="org.eclipse.jpt.jpa.ui.internal.commands.AddPersistentAttributeToXmlHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.AddPersistentAttributeToXmlHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -463,7 +560,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.persistentAttributeAddToXmlAndMap"
- class="org.eclipse.jpt.jpa.ui.internal.commands.AddPersistentAttributeToXmlAndMapHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.AddPersistentAttributeToXmlAndMapHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -477,7 +574,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.persistentTypeMapAs"
- class="org.eclipse.jpt.jpa.ui.internal.commands.PersistentTypeMapAsHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.PersistentTypeMapAsHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -490,7 +587,7 @@
<handler
commandId="org.eclipse.jpt.jpa.ui.persistentAttributeMapAs"
- class="org.eclipse.jpt.jpa.ui.internal.commands.PersistentAttributeMapAsHandler">
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.PersistentAttributeMapAsHandler">
<activeWhen>
<and>
<reference definitionId="org.eclipse.jpt.jpa.ui.reference.inJpaStructureView"/>
@@ -503,7 +600,7 @@
</handler>
<handler
- class="org.eclipse.jpt.jpa.ui.internal.commands.JavaGeneratorConversionHandler"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.JavaGeneratorConversionHandler"
commandId="org.eclipse.jpt.jpa.ui.convertJavaGenerators">
<activeWhen>
@@ -520,7 +617,7 @@
<handler
- class="org.eclipse.jpt.jpa.ui.internal.commands.JavaQueryConversionHandler"
+ class="org.eclipse.jpt.jpa.ui.internal.handlers.JavaQueryConversionHandler"
commandId="org.eclipse.jpt.jpa.ui.convertJavaQueries">
<activeWhen>
@@ -542,7 +639,52 @@
<extension
point="org.eclipse.ui.menus">
+
+ <!-- contributions for toolbar -->
+
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar?after=additions">
+ <toolbar
+ id="org.eclipse.jpt.jpa.ui.jptCreation.toolbar"
+ label="%JptCreationToolbar.label">
+
+ <command
+ commandId="org.eclipse.jpt.jpa.ui.newEntity"
+ id="org.eclipse.jpt.jpa.ui.jptCreation.pulldown"
+ label="%newJpaEntityWizardName"
+ icon="$nl$/images/buttons/new-entity.gif"
+ disabledIcon="$nl$/images/buttons/new-entity-disabled.gif"
+ style="pulldown">
+ </command>
+
+ </toolbar>
+
+ </menuContribution>
+
+ <menuContribution
+ locationURI="menu:org.eclipse.jpt.jpa.ui.jptCreation.pulldown">
+
+ <command
+ commandId="org.eclipse.jpt.jpa.ui.newEntity"
+ label="%newJpaEntityWizardName"
+ icon="$nl$/images/buttons/new-entity.gif"
+ disabledIcon="$nl$/images/buttons/new-entity-disabled.gif"
+ style="push">
+ </command>
+
+ <command
+ commandId="org.eclipse.jpt.jpa.ui.newMappingFile"
+ label="%newJpaMappingFileWizardName"
+ icon="$nl$/images/buttons/new-jpa-file.gif"
+ disabledIcon="$nl$/images/buttons/new-jpa-file.gif"
+ style="push">
+ </command>
+
+ <separator name="jptCreation.separator" visible="false"/>
+
+ </menuContribution>
+
<!-- contributions for any popup -->
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any">
@@ -630,10 +772,35 @@
</menu>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools">
+ <command commandId="org.eclipse.jpt.jpa.ui.generateDDL">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools">
+ <command commandId="org.eclipse.jpt.jpa.ui.generateEntities">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+
<separator name="generate"/>
</menuContribution>
-
+
+ <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools">
+ <command commandId="org.eclipse.jpt.jpa.ui.makePersistent">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ </menuContribution>
+
+ <menuContribution locationURI="popup:org.eclipse.jpt.jpa.ui.menu.JpaTools">
+ <command commandId="org.eclipse.jpt.jpa.core.synchronizeClasses">
+ <visibleWhen checkEnabled="true"/>
+ </command>
+ </menuContribution>
+
<!-- contributions to the project configure menu -->
<menuContribution locationURI="popup:org.eclipse.ui.projectConfigure?after=additions">
<command commandId="org.eclipse.jpt.jpa.ui.convertJavaProjectToJpa">
@@ -940,13 +1107,7 @@
<perspectiveShortcut id="org.eclipse.debug.ui.DebugPerspective"/>
<perspectiveShortcut id="org.eclipse.jst.j2ee.J2EEPerspective"/>
<perspectiveShortcut id="org.eclipse.jdt.ui.JavaBrowsingPerspective"/>
-
- <actionSet id="org.eclipse.debug.ui.launchActionSet"/>
- <actionSet id="org.eclipse.jdt.ui.JavaActionSet"/>
- <actionSet id="org.eclipse.jdt.ui.JavaElementCreationActionSet"/>
- <actionSet id="org.eclipse.ui.NavigateActionSet"/>
- <actionSet id="org.eclipse.jpt.jpa.ui.JptCreationActionSet"/>
-
+
<viewShortcut id="org.eclipse.jdt.ui.PackageExplorer"/>
<viewShortcut id="org.eclipse.jdt.ui.TypeHierarchy"/>
<viewShortcut id="org.eclipse.jdt.ui.SourceView"/>
@@ -969,89 +1130,7 @@
</extension>
-
- <!-- ***** pop-up menus ***** -->
- <extension
- point="org.eclipse.ui.popupMenus">
-
- <objectContribution
- id="org.eclipse.jpt.jpa.ui.project.JPATools"
- objectClass="org.eclipse.core.resources.IProject"
- adaptable="true">
-
- <!-- ignore the warning - see bug 247250 -->
- <enablement>
- <reference definitionId="org.eclipse.jpt.jpa.reference.hasJpaFacet"/>
- </enablement>
-
- <action
- id="org.eclipse.jpt.jpa.ui.generateEntities"
- label="%generateEntities"
- class="org.eclipse.jpt.jpa.ui.internal.actions.GenerateEntitiesAction"
- enablesFor="1"
- menubarPath="org.eclipse.jpt.jpa.ui.menu.JpaTools/generate"/>
-
- <action
- id="org.eclipse.jpt.jpa.ui.generateDDL"
- label="%generateDDL"
- class="org.eclipse.jpt.jpa.ui.internal.actions.GenerateDDLAction"
- enablesFor="1"
- menubarPath="org.eclipse.jpt.jpa.ui.menu.JpaTools/generate"/>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.jpa.ui.MakePersistent"
- objectClass="org.eclipse.jdt.core.IJavaElement"
- adaptable="true">
-
- <action
- class="org.eclipse.jpt.jpa.ui.internal.actions.MakePersistentAction"
- enablesFor="*"
- id="org.eclipse.jpt.jpa.ui.generateEntities"
- label="%makePersistent"
- menubarPath="org.eclipse.jpt.jpa.ui.menu.JpaTools/content">
- <enablement>
- <or>
- <objectClass name="org.eclipse.jdt.core.ICompilationUnit"/>
- <objectClass name="org.eclipse.jdt.core.IType"/>
- <objectClass name="org.eclipse.jdt.core.IPackageFragment"/>
- <objectClass name="org.eclipse.jdt.core.IPackageFragmentRoot"/>
- </or>
- </enablement>
- </action>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.jpa.ui.persistenceXmlFileActions"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="persistence.xml">
-
- <action
- id="synchClassesAction"
- label="%synchronizeClasses"
- menubarPath="org.eclipse.jpt.jpa.ui.menu.JpaTools/content"
- class="org.eclipse.jpt.jpa.ui.internal.actions.SynchronizeClassesAction"
- enablesFor="1"/>
-
- </objectContribution>
-
- <objectContribution
- id="org.eclipse.jpt.jpa.ui.persistenceXmlActions"
- objectClass="org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml">
- <action
- id="synchClassesAction"
- label="%synchronizeClasses"
- menubarPath="content"
- class="org.eclipse.jpt.jpa.ui.internal.actions.SynchronizeClassesAction"
- enablesFor="1"/>
- </objectContribution>
-
- </extension>
-
-
<!-- ***** preferences ***** -->
<extension
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java b/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java
deleted file mode 100644
index 96f3fed..0000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Oracle - copied and modified from NewJavaEEDropDownAction and NewTypeDropDownAction
- *******************************************************************************/
-package org.eclipse.jpt.jpa.ui.internal.wizards;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.RegistryFactory;
-import org.eclipse.jdt.internal.ui.util.CoreUtility;
-import org.eclipse.jdt.ui.actions.AbstractOpenWizardAction;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.jface.layout.PixelConverter;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.jpt.common.utility.internal.ArrayTools;
-import org.eclipse.jpt.jpa.ui.internal.plugin.JptJpaUiPlugin;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowPulldownDelegate2;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * A type wizard is added to the type drop down if it has a paramater 'javatype':
- * <wizard
- * name="My JPT Wizard"
- * icon="icons/wiz.gif"
- * category="mycategory"
- * id="xx.MyWizard">
- * <class class="org.xx.MyWizard">
- * <parameter name="jptartifact" value="true"/>
- * </class>
- * <description>
- * My JPT Wizard
- * </description>
- * </wizard>
- */
-public class NewEntityDropDownAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 {
-
- public static class OpenJptWizardAction extends AbstractOpenWizardAction implements Comparable<Object> {
-
- private final static String ATT_NAME = "name";//$NON-NLS-1$
- private final static String ATT_CLASS = "class";//$NON-NLS-1$
- private final static String ATT_ICON = "icon";//$NON-NLS-1$
- private static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
-
- private IConfigurationElement fConfigurationElement;
- private int menuIndex;
-
- public OpenJptWizardAction(IConfigurationElement element) {
- this.fConfigurationElement= element;
- setText(element.getAttribute(ATT_NAME));
-
- String description= getDescriptionFromConfig(this.fConfigurationElement);
- setDescription(description);
- setToolTipText(description);
- setImageDescriptor(getIconFromConfig(this.fConfigurationElement));
- setMenuIndex(getMenuIndexFromConfig(this.fConfigurationElement));
- }
-
- private String getDescriptionFromConfig(IConfigurationElement config) {
- IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length>=1) {
- return children[0].getValue();
- }
- return ""; //$NON-NLS-1$
- }
-
- private ImageDescriptor getIconFromConfig(IConfigurationElement config) {
- String iconName = config.getAttribute(ATT_ICON);
- if (iconName != null) {
- return AbstractUIPlugin.imageDescriptorFromPlugin(config.getContributor().getName(), iconName);
- }
- return null;
- }
-
- private int getMenuIndexFromConfig(IConfigurationElement config) {
- IConfigurationElement[] classElements = config.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (IConfigurationElement classElement : classElements) {
- IConfigurationElement[] paramElements = classElement.getChildren(TAG_PARAMETER);
- for (IConfigurationElement paramElement : paramElements) {
- if (ATT_MENUINDEX.equals(paramElement.getAttribute(TAG_NAME))) {
- return Integer.parseInt(paramElement.getAttribute(TAG_VALUE));
- }
- }
- }
- }
- return Integer.MAX_VALUE;
- }
-
- @Override
- public void run() {
- Shell shell = getShell();
- try {
- INewWizard wizard = createWizard();
- wizard.init(PlatformUI.getWorkbench(), getSelection());
-
- WizardDialog dialog = new WizardDialog(shell, wizard);
- PixelConverter converter = new PixelConverter(JFaceResources.getDialogFont());
- dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
- dialog.create();
- int res = dialog.open();
-
- notifyResult(res == Window.OK);
- } catch (CoreException e) {
- JptJpaUiPlugin.instance().logError(e);
- }
- }
-
- @Override
- protected INewWizard createWizard() throws CoreException {
- return (INewWizard) CoreUtility.createExtension(fConfigurationElement, ATT_CLASS);
- }
-
- public int getMenuIndex() {
- return this.menuIndex;
- }
-
- public void setMenuIndex(int menuIndex) {
- this.menuIndex = menuIndex;
- }
-
- public int compareTo(Object o) {
- OpenJptWizardAction action = (OpenJptWizardAction) o;
- return getMenuIndex() - action.getMenuIndex();
- }
-
- }
-
-
-
- private final static String TAG_WIZARD = "wizard";//$NON-NLS-1$
- private final static String ATT_JPTARTIFACT = "jptartifact";//$NON-NLS-1$
-
- private final static String TAG_PARAMETER = "parameter";//$NON-NLS-1$
- private final static String TAG_NAME = "name";//$NON-NLS-1$
- private final static String TAG_VALUE = "value";//$NON-NLS-1$
- protected final static String ATT_MENUINDEX = "menuIndex";//$NON-NLS-1$
-
- private static final String PL_NEW = "newWizards"; //$NON-NLS-1$
- private static final String TAG_CLASS = "class"; //$NON-NLS-1$
-
- private Menu fMenu;
-
- private Shell fWizardShell;
-
- public NewEntityDropDownAction() {
- this.fMenu= null;
- setMenuCreator(this);
- //PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IJavaHelpContextIds.OPEN_CLASS_WIZARD_ACTION);
- }
-
- public void dispose() {
- if (this.fMenu != null) {
- this.fMenu.dispose();
- this.fMenu= null;
- }
- }
-
- public Menu getMenu(Menu parent) {
- return null;
- }
-
- public Menu getMenu(Control parent) {
- if (this.fMenu == null) {
- this.fMenu = new Menu(parent);
- OpenJptWizardAction[] actions = getActionFromDescriptors();
- for (int i = 0; i < actions.length; i++) {
- OpenJptWizardAction curr = actions[i];
- curr.setShell(this.fWizardShell);
- ActionContributionItem item = new ActionContributionItem(curr);
- item.fill(this.fMenu, -1);
- }
-
- }
- return this.fMenu;
- }
-
- @Override
- public void run() {
- getDefaultAction().run();
- }
-
- public Action getDefaultAction() {
- Action[] actions = getActionFromDescriptors();
- if (actions.length > 0)
- return actions[0];
- return null;
- }
-
- public static OpenJptWizardAction[] getActionFromDescriptors() {
- ArrayList<OpenJptWizardAction> containers= new ArrayList<OpenJptWizardAction>();
-
- IExtensionPoint extensionPoint = RegistryFactory.getRegistry().getExtensionPoint(PlatformUI.PLUGIN_ID, PL_NEW);
- if (extensionPoint != null) {
- IConfigurationElement[] elements = extensionPoint.getConfigurationElements();
- for (int i = 0; i < elements.length; i++) {
- IConfigurationElement element= elements[i];
- if (element.getName().equals(TAG_WIZARD) && isJptArtifactWizard(element)) {
- containers.add(new OpenJptWizardAction(element));
- }
- }
- }
- return ArrayTools.sort(containers.toArray(new OpenJptWizardAction[containers.size()]));
- }
-
- private static boolean isJptArtifactWizard(IConfigurationElement element) {
- IConfigurationElement[] classElements= element.getChildren(TAG_CLASS);
- if (classElements.length > 0) {
- for (int i= 0; i < classElements.length; i++) {
- IConfigurationElement[] paramElements= classElements[i].getChildren(TAG_PARAMETER);
- for (int k = 0; k < paramElements.length; k++) {
- IConfigurationElement curr= paramElements[k];
- if (ATT_JPTARTIFACT.equals(curr.getAttribute(TAG_NAME))) {
- return Boolean.valueOf(curr.getAttribute(TAG_VALUE)).booleanValue();
- }
- }
- }
- }
- return false;
- }
-
- public void init(IWorkbenchWindow window) {
- fWizardShell= window.getShell();
- }
-
- public void run(IAction action) {
- run();
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- }
-
-}