Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.ui.di/pom.xml2
-rw-r--r--bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java33
-rw-r--r--bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java33
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gifbin0 -> 223 bytes
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gifbin0 -> 223 bytes
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gifbin0 -> 129 bytes
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml2
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java5
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java5
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java10
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java178
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java5
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java24
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java5
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/pom.xml2
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/impl/CommandsFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/impl/BasicFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/impl/ApplicationFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/impl/AdvancedFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiFactoryImpl.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java25
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java9
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java261
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java12
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java319
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java19
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java29
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java1
-rw-r--r--bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationSwitch.java1
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java52
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java20
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java87
48 files changed, 1156 insertions, 7 deletions
diff --git a/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
index b00330d9c04..1f7d98785f7 100644
--- a/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.di/META-INF/MANIFEST.MF
@@ -4,7 +4,7 @@ Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.e4.ui.di
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Import-Package: javax.inject;version="1.0.0"
diff --git a/bundles/org.eclipse.e4.ui.di/pom.xml b/bundles/org.eclipse.e4.ui.di/pom.xml
index f236a7ad6b2..804f6c598b2 100644
--- a/bundles/org.eclipse.e4.ui.di/pom.xml
+++ b/bundles/org.eclipse.e4.ui.di/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.di</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java
new file mode 100644
index 00000000000..11fbfa09e85
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToHide.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 MEDEVIT, FHV 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:
+ * Marco Descher <marco@descher.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use this annotation to act on to the list of dynamically shown entries within
+ * a DynamicMenuContributionItem. Usage in contribution class:
+ * <p>
+ * {@literal @}AboutToHide<br>
+ * public void aboutToHide(List&lt;MMenuElement&gt; items) { }
+ *
+ * @see org.eclipse.jface.action.IMenuListener2
+ */
+@Documented
+@Target({ ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AboutToHide {
+ // intentionally left empty
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java
new file mode 100644
index 00000000000..b3a74115d05
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.di/src/org/eclipse/e4/ui/di/AboutToShow.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 MEDEVIT, FHV 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:
+ * Marco Descher <marco@descher.at> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.e4.ui.di;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Use this annotation to provide MMenuElements to the list of dynamically shown entries
+ * within a DynamicMenuContributionItem. Usage in contribution class:
+ * <p>
+ * {@literal @}AboutToShow<br>
+ * public void aboutToShow(List&lt;MMenuElement&gt; items) { }
+ *
+ * @see org.eclipse.jface.action.IMenuListener
+ */
+@Documented
+@Target({ ElementType.METHOD })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface AboutToShow {
+ // intentionally left empty
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
index a3af1298283..78e17b28290 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.e4.ui.model.workbench.edit;singleton:=true
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.e4.ui.model.application.provider.UIElementsEditPlugin$Implementation
Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif
new file mode 100644
index 00000000000..4f1420c5598
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateElementContainer_children_DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif
new file mode 100644
index 00000000000..6b9afeaec63
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/ctool16/CreateWindow_sharedElements_DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif
new file mode 100644
index 00000000000..5a2614a83b0
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/icons/full/obj16/DynamicMenuContribution.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties b/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
index 13f120aee82..bb1f5837b8f 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/plugin.properties
@@ -282,3 +282,4 @@ _UI_StringToObjectMap_value_feature = Value
_UI_SnippetContainer_type = Snippet Container
_UI_SnippetContainer_snippets_feature = Snippets
_UI_ApplicationElement_persistedState_feature = Persisted State
+_UI_DynamicMenuContribution_type = Dynamic Menu Contribution
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml b/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
index e3fc86e0f16..7a42ee0259d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.model.workbench.edit</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
index 290d29a4bec..fddbc758fae 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/provider/ApplicationItemProvider.java
@@ -402,6 +402,11 @@ public class ApplicationItemProvider extends ElementContainerItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
index c3143e7d0d8..7688d48d02a 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/advanced/provider/PerspectiveStackItemProvider.java
@@ -311,6 +311,11 @@ public class PerspectiveStackItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
index c1f245d0bdf..712fb5fdc2d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/basic/provider/WindowItemProvider.java
@@ -592,6 +592,11 @@ public class WindowItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.SNIPPET_CONTAINER__SNIPPETS,
MAdvancedFactory.INSTANCE.createPlaceholder()));
newChildDescriptors.add
@@ -782,6 +787,11 @@ public class WindowItemProvider
newChildDescriptors.add
(createChildParameter
(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS,
MAdvancedFactory.INSTANCE.createPlaceholder()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java
new file mode 100644
index 00000000000..3e16e1ef576
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/DynamicMenuContributionItemProvider.java
@@ -0,0 +1,178 @@
+/**
+ * Copyright (c) 2008, 2012 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
+ */
+package org.eclipse.e4.ui.model.application.ui.menu.provider;
+
+
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
+
+import org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
+import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
+import org.eclipse.emf.edit.provider.ViewerNotification;
+
+/**
+ * This is the item provider adapter for a {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution} object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class DynamicMenuContributionItemProvider
+ extends MenuItemItemProvider
+ implements
+ IEditingDomainItemProvider,
+ IStructuredItemContentProvider,
+ ITreeItemContentProvider,
+ IItemLabelProvider,
+ IItemPropertySource {
+ /**
+ * This constructs an instance from a factory and a notifier.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DynamicMenuContributionItemProvider(AdapterFactory adapterFactory) {
+ super(adapterFactory);
+ }
+
+ /**
+ * This returns the property descriptors for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
+ if (itemPropertyDescriptors == null) {
+ super.getPropertyDescriptors(object);
+
+ addContributionURIPropertyDescriptor(object);
+ addObjectPropertyDescriptor(object);
+ }
+ return itemPropertyDescriptors;
+ }
+
+ /**
+ * This adds a property descriptor for the Contribution URI feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addContributionURIPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Contribution_contributionURI_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Contribution_contributionURI_feature", "_UI_Contribution_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This adds a property descriptor for the Object feature.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void addObjectPropertyDescriptor(Object object) {
+ itemPropertyDescriptors.add
+ (createItemPropertyDescriptor
+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
+ getResourceLocator(),
+ getString("_UI_Contribution_object_feature"), //$NON-NLS-1$
+ getString("_UI_PropertyDescriptor_description", "_UI_Contribution_object_feature", "_UI_Contribution_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT,
+ true,
+ false,
+ false,
+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
+ null,
+ null));
+ }
+
+ /**
+ * This returns DynamicMenuContribution.gif.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object getImage(Object object) {
+ return overlayImage(object, getResourceLocator().getImage("full/obj16/DynamicMenuContribution")); //$NON-NLS-1$
+ }
+
+ /**
+ * This returns the label text for the adapted class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String getText(Object object) {
+ String label = ((MDynamicMenuContribution)object).getElementId();
+ return label == null || label.length() == 0 ?
+ getString("_UI_DynamicMenuContribution_type") : //$NON-NLS-1$
+ getString("_UI_DynamicMenuContribution_type") + " " + label; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * This handles model notifications by calling {@link #updateChildren} to update any cached
+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void notifyChanged(Notification notification) {
+ updateChildren(notification);
+
+ switch (notification.getFeatureID(MDynamicMenuContribution.class)) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
+ return;
+ }
+ super.notifyChanged(notification);
+ }
+
+ /**
+ * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
+ * that can be created under this object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
+ super.collectNewChildDescriptors(newChildDescriptors, object);
+ }
+
+}
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
index 2aff8d78c8b..e03b82c7b02 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProvider.java
@@ -310,6 +310,11 @@ public class MenuItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MApplicationFactory.INSTANCE.createApplication()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
index c00e88c5b81..fc44e21c2d7 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/menu/provider/MenuItemProviderAdapterFactory.java
@@ -537,6 +537,29 @@ public class MenuItemProviderAdapterFactory extends MenuAdapterFactory implement
}
/**
+ * This keeps track of the one adapter used for all {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution} instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DynamicMenuContributionItemProvider dynamicMenuContributionItemProvider;
+
+ /**
+ * This creates an adapter for a {@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution}.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Adapter createDynamicMenuContributionAdapter() {
+ if (dynamicMenuContributionItemProvider == null) {
+ dynamicMenuContributionItemProvider = new DynamicMenuContributionItemProvider(this);
+ }
+
+ return dynamicMenuContributionItemProvider;
+ }
+
+ /**
* This returns the root adapter factory that contains this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -655,6 +678,7 @@ public class MenuItemProviderAdapterFactory extends MenuAdapterFactory implement
if (opaqueMenuItemItemProvider != null) opaqueMenuItemItemProvider.dispose();
if (opaqueMenuSeparatorItemProvider != null) opaqueMenuSeparatorItemProvider.dispose();
if (opaqueMenuItemProvider != null) opaqueMenuItemProvider.dispose();
+ if (dynamicMenuContributionItemProvider != null) dynamicMenuContributionItemProvider.dispose();
}
}
diff --git a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
index 1f2baef54ac..181fcad0762 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench.edit/src/org/eclipse/e4/ui/model/application/ui/provider/ElementContainerItemProvider.java
@@ -276,6 +276,11 @@ public class ElementContainerItemProvider
newChildDescriptors.add
(createChildParameter
(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
+ MMenuFactory.INSTANCE.createDynamicMenuContribution()));
+
+ newChildDescriptors.add
+ (createChildParameter
+ (UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN,
MBasicFactory.INSTANCE.createPart()));
newChildDescriptors.add
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
index 77aff9b5e79..74177267b64 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.ui.model.workbench/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.e4.ui.model.workbench;singleton:=true
-Bundle-Version: 0.10.1.qualifier
+Bundle-Version: 0.11.0.qualifier
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.e4.ui.model.application.impl.MWorkbenchModelActivator$Implementation
Bundle-Vendor: %providerName
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
index 012d1c377f9..b30b80d39d5 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
+++ b/bundles/org.eclipse.e4.ui.model.workbench/model/UIElements.ecore
@@ -346,6 +346,7 @@
transient="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OpaqueMenu" eSuperTypes="#//ui/menu/Menu"/>
+ <eClassifiers xsi:type="ecore:EClass" name="DynamicMenuContribution" eSuperTypes="#//ui/menu/MenuItem #//Contribution"/>
</eSubpackages>
<eSubpackages name="basic" nsURI="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic"
nsPrefix="basic">
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/pom.xml b/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
index a4fb3f7f169..48142b2954e 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
+++ b/bundles/org.eclipse.e4.ui.model.workbench/pom.xml
@@ -21,6 +21,6 @@
</parent>
<groupId>eclipse.platform.ui</groupId>
<artifactId>org.eclipse.e4.ui.model.workbench</artifactId>
- <version>0.10.1-SNAPSHOT</version>
+ <version>0.11.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/impl/CommandsFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/impl/CommandsFactoryImpl.java
index 11e3b0a1abd..b0c03c02c1a 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/impl/CommandsFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/impl/CommandsFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.commands.impl;
+import org.eclipse.e4.ui.model.application.commands.*;
import org.eclipse.e4.ui.model.application.commands.MBindingContext;
import org.eclipse.e4.ui.model.application.commands.MBindingTable;
import org.eclipse.e4.ui.model.application.commands.MCategory;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsAdapterFactory.java
index c832074bb67..6ad0af62d27 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsAdapterFactory.java
@@ -12,6 +12,7 @@ package org.eclipse.e4.ui.model.application.commands.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.MContribution;
+import org.eclipse.e4.ui.model.application.commands.*;
import org.eclipse.e4.ui.model.application.commands.MBindingContext;
import org.eclipse.e4.ui.model.application.commands.MBindingTable;
import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsSwitch.java
index f44f5fbe1c5..7538aaf1ea7 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/commands/util/CommandsSwitch.java
@@ -12,6 +12,7 @@ package org.eclipse.e4.ui.model.application.commands.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.MContribution;
+import org.eclipse.e4.ui.model.application.commands.*;
import org.eclipse.e4.ui.model.application.commands.MBindingContext;
import org.eclipse.e4.ui.model.application.commands.MBindingTable;
import org.eclipse.e4.ui.model.application.commands.MBindingTableContainer;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/impl/BasicFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/impl/BasicFactoryImpl.java
index 8374a8a1263..3579e98ca9f 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/impl/BasicFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/impl/BasicFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.descriptor.basic.impl;
+import org.eclipse.e4.ui.model.application.descriptor.basic.*;
import org.eclipse.e4.ui.model.application.descriptor.basic.MBasicFactory;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.emf.ecore.EClass;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicAdapterFactory.java
index 159fce8e151..d6aaa1fe5a7 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicAdapterFactory.java
@@ -13,6 +13,7 @@ package org.eclipse.e4.ui.model.application.descriptor.basic.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.commands.MBindings;
import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
+import org.eclipse.e4.ui.model.application.descriptor.basic.*;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer;
import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicSwitch.java
index f223ff78338..d0ce64854c5 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/descriptor/basic/util/BasicSwitch.java
@@ -13,6 +13,7 @@ package org.eclipse.e4.ui.model.application.descriptor.basic.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
import org.eclipse.e4.ui.model.application.commands.MBindings;
import org.eclipse.e4.ui.model.application.commands.MHandlerContainer;
+import org.eclipse.e4.ui.model.application.descriptor.basic.*;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptorContainer;
import org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/impl/ApplicationFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/impl/ApplicationFactoryImpl.java
index d41b0152c3b..3d3de47e2a7 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/impl/ApplicationFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/impl/ApplicationFactoryImpl.java
@@ -11,6 +11,7 @@
package org.eclipse.e4.ui.model.application.impl;
import java.util.Map;
+import org.eclipse.e4.ui.model.application.*;
import org.eclipse.e4.ui.model.application.MAddon;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationFactory;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/impl/AdvancedFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/impl/AdvancedFactoryImpl.java
index ff56b720653..5d70d48313f 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/impl/AdvancedFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/impl/AdvancedFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.ui.advanced.impl;
+import org.eclipse.e4.ui.model.application.ui.advanced.*;
import org.eclipse.e4.ui.model.application.ui.advanced.MAdvancedFactory;
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedAdapterFactory.java
index 864e5733356..c20849203b0 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedAdapterFactory.java
@@ -17,6 +17,7 @@ import org.eclipse.e4.ui.model.application.ui.MGenericStack;
import org.eclipse.e4.ui.model.application.ui.MGenericTile;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
+import org.eclipse.e4.ui.model.application.ui.advanced.*;
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedSwitch.java
index 954e649ff71..0a0cf7a6d6d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/advanced/util/AdvancedSwitch.java
@@ -17,6 +17,7 @@ import org.eclipse.e4.ui.model.application.ui.MGenericStack;
import org.eclipse.e4.ui.model.application.ui.MGenericTile;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
+import org.eclipse.e4.ui.model.application.ui.advanced.*;
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
import org.eclipse.e4.ui.model.application.ui.advanced.MPerspectiveStack;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicFactoryImpl.java
index 41906347722..68ac102daca 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/impl/BasicFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.ui.basic.impl;
+import org.eclipse.e4.ui.model.application.ui.basic.*;
import org.eclipse.e4.ui.model.application.ui.basic.MBasicFactory;
import org.eclipse.e4.ui.model.application.ui.basic.MInputPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicAdapterFactory.java
index b4561ac118d..d39fc070c83 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicAdapterFactory.java
@@ -24,6 +24,7 @@ import org.eclipse.e4.ui.model.application.ui.MInput;
import org.eclipse.e4.ui.model.application.ui.MSnippetContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
+import org.eclipse.e4.ui.model.application.ui.basic.*;
import org.eclipse.e4.ui.model.application.ui.basic.MInputPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicSwitch.java
index 7ae3910ea21..db96d370109 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/basic/util/BasicSwitch.java
@@ -24,6 +24,7 @@ import org.eclipse.e4.ui.model.application.ui.MInput;
import org.eclipse.e4.ui.model.application.ui.MSnippetContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
+import org.eclipse.e4.ui.model.application.ui.basic.*;
import org.eclipse.e4.ui.model.application.ui.basic.MInputPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainer;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiFactoryImpl.java
index 97c92c10dc4..f9d49346b53 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/impl/UiFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.ui.impl;
+import org.eclipse.e4.ui.model.application.ui.*;
import org.eclipse.e4.ui.model.application.ui.MCoreExpression;
import org.eclipse.e4.ui.model.application.ui.MUiFactory;
import org.eclipse.e4.ui.model.application.ui.SideValue;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java
new file mode 100644
index 00000000000..581016d5d2e
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MDynamicMenuContribution.java
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2008, 2012 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
+ */
+package org.eclipse.e4.ui.model.application.ui.menu;
+
+import org.eclipse.e4.ui.model.application.MContribution;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Dynamic Menu Contribution</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ *
+ * @model
+ * @generated
+ */
+public interface MDynamicMenuContribution extends MMenuItem, MContribution {
+} // MDynamicMenuContribution
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
index af88fb2c769..c49faad1faf 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/MMenuFactory.java
@@ -207,4 +207,13 @@ public interface MMenuFactory {
*/
MOpaqueMenu createOpaqueMenu();
+ /**
+ * Returns a new object of class '<em>Dynamic Menu Contribution</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Dynamic Menu Contribution</em>'.
+ * @generated
+ */
+ MDynamicMenuContribution createDynamicMenuContribution();
+
} //MMenuFactory
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java
new file mode 100644
index 00000000000..3739e24e56c
--- /dev/null
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/DynamicMenuContributionImpl.java
@@ -0,0 +1,261 @@
+/**
+ * Copyright (c) 2008, 2012 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
+ */
+package org.eclipse.e4.ui.model.application.ui.menu.impl;
+
+import org.eclipse.e4.ui.model.application.MContribution;
+
+import org.eclipse.e4.ui.model.application.impl.ApplicationPackageImpl;
+
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
+
+import org.eclipse.emf.common.notify.Notification;
+
+import org.eclipse.emf.ecore.EClass;
+
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Dynamic Menu Contribution</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl#getContributionURI <em>Contribution URI</em>}</li>
+ * <li>{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl#getObject <em>Object</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class DynamicMenuContributionImpl extends MenuItemImpl implements MDynamicMenuContribution {
+ /**
+ * The default value of the '{@link #getContributionURI() <em>Contribution URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContributionURI()
+ * @generated
+ * @ordered
+ */
+ protected static final String CONTRIBUTION_URI_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getContributionURI() <em>Contribution URI</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getContributionURI()
+ * @generated
+ * @ordered
+ */
+ protected String contributionURI = CONTRIBUTION_URI_EDEFAULT;
+
+ /**
+ * The default value of the '{@link #getObject() <em>Object</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getObject()
+ * @generated
+ * @ordered
+ */
+ protected static final Object OBJECT_EDEFAULT = null;
+
+ /**
+ * The cached value of the '{@link #getObject() <em>Object</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getObject()
+ * @generated
+ * @ordered
+ */
+ protected Object object = OBJECT_EDEFAULT;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected DynamicMenuContributionImpl() {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EClass eStaticClass() {
+ return MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getContributionURI() {
+ return contributionURI;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setContributionURI(String newContributionURI) {
+ String oldContributionURI = contributionURI;
+ contributionURI = newContributionURI;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI, oldContributionURI, contributionURI));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object getObject() {
+ return object;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setObject(Object newObject) {
+ Object oldObject = object;
+ object = newObject;
+ if (eNotificationRequired())
+ eNotify(new ENotificationImpl(this, Notification.SET, MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT, oldObject, object));
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public Object eGet(int featureID, boolean resolve, boolean coreType) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ return getContributionURI();
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ return getObject();
+ }
+ return super.eGet(featureID, resolve, coreType);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eSet(int featureID, Object newValue) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ setContributionURI((String)newValue);
+ return;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ setObject(newValue);
+ return;
+ }
+ super.eSet(featureID, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public void eUnset(int featureID) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ setContributionURI(CONTRIBUTION_URI_EDEFAULT);
+ return;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ setObject(OBJECT_EDEFAULT);
+ return;
+ }
+ super.eUnset(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public boolean eIsSet(int featureID) {
+ switch (featureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI:
+ return CONTRIBUTION_URI_EDEFAULT == null ? contributionURI != null : !CONTRIBUTION_URI_EDEFAULT.equals(contributionURI);
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT:
+ return OBJECT_EDEFAULT == null ? object != null : !OBJECT_EDEFAULT.equals(object);
+ }
+ return super.eIsSet(featureID);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
+ if (baseClass == MContribution.class) {
+ switch (derivedFeatureID) {
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI: return ApplicationPackageImpl.CONTRIBUTION__CONTRIBUTION_URI;
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT: return ApplicationPackageImpl.CONTRIBUTION__OBJECT;
+ default: return -1;
+ }
+ }
+ return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
+ if (baseClass == MContribution.class) {
+ switch (baseFeatureID) {
+ case ApplicationPackageImpl.CONTRIBUTION__CONTRIBUTION_URI: return MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI;
+ case ApplicationPackageImpl.CONTRIBUTION__OBJECT: return MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION__OBJECT;
+ default: return -1;
+ }
+ }
+ return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ if (eIsProxy()) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (contributionURI: "); //$NON-NLS-1$
+ result.append(contributionURI);
+ result.append(", object: "); //$NON-NLS-1$
+ result.append(object);
+ result.append(')');
+ return result.toString();
+ }
+
+} //DynamicMenuContributionImpl
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
index 674df3da96e..713e7374103 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuFactoryImpl.java
@@ -10,6 +10,7 @@
*/
package org.eclipse.e4.ui.model.application.ui.menu.impl;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
@@ -111,6 +112,7 @@ public class MenuFactoryImpl extends EFactoryImpl implements MMenuFactory {
case MenuPackageImpl.OPAQUE_MENU_ITEM: return (EObject)createOpaqueMenuItem();
case MenuPackageImpl.OPAQUE_MENU_SEPARATOR: return (EObject)createOpaqueMenuSeparator();
case MenuPackageImpl.OPAQUE_MENU: return (EObject)createOpaqueMenu();
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION: return (EObject)createDynamicMenuContribution();
default:
throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -351,6 +353,16 @@ public class MenuFactoryImpl extends EFactoryImpl implements MMenuFactory {
* <!-- end-user-doc -->
* @generated
*/
+ public MDynamicMenuContribution createDynamicMenuContribution() {
+ DynamicMenuContributionImpl dynamicMenuContribution = new DynamicMenuContributionImpl();
+ return dynamicMenuContribution;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
public ItemType createItemTypeFromString(EDataType eDataType, String initialValue) {
ItemType result = ItemType.get(initialValue);
if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
index bec00b844d7..0d946004f37 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/impl/MenuPackageImpl.java
@@ -18,6 +18,7 @@ import org.eclipse.e4.ui.model.application.ui.impl.UiPackageImpl;
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledToolItem;
@@ -6515,6 +6516,286 @@ public class MenuPackageImpl extends EPackageImpl {
public static final int OPAQUE_MENU_OPERATION_COUNT = MENU_OPERATION_COUNT + 0;
/**
+ * The meta object id for the '{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl <em>Dynamic Menu Contribution</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getDynamicMenuContribution()
+ * @generated
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION = 29;
+
+ /**
+ * The feature id for the '<em><b>Element Id</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ELEMENT_ID = MENU_ITEM__ELEMENT_ID;
+
+ /**
+ * The feature id for the '<em><b>Persisted State</b></em>' map.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__PERSISTED_STATE = MENU_ITEM__PERSISTED_STATE;
+
+ /**
+ * The feature id for the '<em><b>Tags</b></em>' attribute list.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TAGS = MENU_ITEM__TAGS;
+
+ /**
+ * The feature id for the '<em><b>Contributor URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTOR_URI = MENU_ITEM__CONTRIBUTOR_URI;
+
+ /**
+ * The feature id for the '<em><b>Transient Data</b></em>' map.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TRANSIENT_DATA = MENU_ITEM__TRANSIENT_DATA;
+
+ /**
+ * The feature id for the '<em><b>Widget</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__WIDGET = MENU_ITEM__WIDGET;
+
+ /**
+ * The feature id for the '<em><b>Renderer</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__RENDERER = MENU_ITEM__RENDERER;
+
+ /**
+ * The feature id for the '<em><b>To Be Rendered</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TO_BE_RENDERED = MENU_ITEM__TO_BE_RENDERED;
+
+ /**
+ * The feature id for the '<em><b>On Top</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ON_TOP = MENU_ITEM__ON_TOP;
+
+ /**
+ * The feature id for the '<em><b>Visible</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__VISIBLE = MENU_ITEM__VISIBLE;
+
+ /**
+ * The feature id for the '<em><b>Parent</b></em>' container reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__PARENT = MENU_ITEM__PARENT;
+
+ /**
+ * The feature id for the '<em><b>Container Data</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTAINER_DATA = MENU_ITEM__CONTAINER_DATA;
+
+ /**
+ * The feature id for the '<em><b>Cur Shared Ref</b></em>' reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CUR_SHARED_REF = MENU_ITEM__CUR_SHARED_REF;
+
+ /**
+ * The feature id for the '<em><b>Visible When</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__VISIBLE_WHEN = MENU_ITEM__VISIBLE_WHEN;
+
+ /**
+ * The feature id for the '<em><b>Accessibility Phrase</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ACCESSIBILITY_PHRASE = MENU_ITEM__ACCESSIBILITY_PHRASE;
+
+ /**
+ * The feature id for the '<em><b>Label</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__LABEL = MENU_ITEM__LABEL;
+
+ /**
+ * The feature id for the '<em><b>Icon URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ICON_URI = MENU_ITEM__ICON_URI;
+
+ /**
+ * The feature id for the '<em><b>Tooltip</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TOOLTIP = MENU_ITEM__TOOLTIP;
+
+ /**
+ * The feature id for the '<em><b>Enabled</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__ENABLED = MENU_ITEM__ENABLED;
+
+ /**
+ * The feature id for the '<em><b>Selected</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__SELECTED = MENU_ITEM__SELECTED;
+
+ /**
+ * The feature id for the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__TYPE = MENU_ITEM__TYPE;
+
+ /**
+ * The feature id for the '<em><b>Mnemonics</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__MNEMONICS = MENU_ITEM__MNEMONICS;
+
+ /**
+ * The feature id for the '<em><b>Contribution URI</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__CONTRIBUTION_URI = MENU_ITEM_FEATURE_COUNT + 0;
+
+ /**
+ * The feature id for the '<em><b>Object</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION__OBJECT = MENU_ITEM_FEATURE_COUNT + 1;
+
+ /**
+ * The number of structural features of the '<em>Dynamic Menu Contribution</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION_FEATURE_COUNT = MENU_ITEM_FEATURE_COUNT + 2;
+
+ /**
+ * The operation id for the '<em>Get Localized Accessibility Phrase</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_ACCESSIBILITY_PHRASE = MENU_ITEM___GET_LOCALIZED_ACCESSIBILITY_PHRASE;
+
+ /**
+ * The operation id for the '<em>Get Localized Label</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_LABEL = MENU_ITEM___GET_LOCALIZED_LABEL;
+
+ /**
+ * The operation id for the '<em>Get Localized Tooltip</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_TOOLTIP = MENU_ITEM___GET_LOCALIZED_TOOLTIP;
+
+ /**
+ * The operation id for the '<em>Get Localized Mnemonics</em>' operation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION___GET_LOCALIZED_MNEMONICS = MENU_ITEM___GET_LOCALIZED_MNEMONICS;
+
+ /**
+ * The number of operations of the '<em>Dynamic Menu Contribution</em>' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public static final int DYNAMIC_MENU_CONTRIBUTION_OPERATION_COUNT = MENU_ITEM_OPERATION_COUNT + 0;
+
+ /**
* The meta object id for the '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -6522,7 +6803,7 @@ public class MenuPackageImpl extends EPackageImpl {
* @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getItemType()
* @generated
*/
- public static final int ITEM_TYPE = 29;
+ public static final int ITEM_TYPE = 30;
/**
* <!-- begin-user-doc -->
@@ -6732,6 +7013,13 @@ public class MenuPackageImpl extends EPackageImpl {
* <!-- end-user-doc -->
* @generated
*/
+ private EClass dynamicMenuContributionEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
private EEnum itemTypeEEnum = null;
/**
@@ -7521,6 +7809,19 @@ public class MenuPackageImpl extends EPackageImpl {
/**
+ * Returns the meta object for class '{@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution <em>Dynamic Menu Contribution</em>}'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return the meta object for class '<em>Dynamic Menu Contribution</em>'.
+ * @see org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution
+ * @generated
+ */
+ public EClass getDynamicMenuContribution() {
+ return dynamicMenuContributionEClass;
+ }
+
+
+ /**
* Returns the meta object for enum '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
@@ -7645,6 +7946,8 @@ public class MenuPackageImpl extends EPackageImpl {
opaqueMenuEClass = createEClass(OPAQUE_MENU);
+ dynamicMenuContributionEClass = createEClass(DYNAMIC_MENU_CONTRIBUTION);
+
// Create enums
itemTypeEEnum = createEEnum(ITEM_TYPE);
}
@@ -7739,6 +8042,8 @@ public class MenuPackageImpl extends EPackageImpl {
opaqueMenuItemEClass.getESuperTypes().add(this.getMenuItem());
opaqueMenuSeparatorEClass.getESuperTypes().add(this.getMenuSeparator());
opaqueMenuEClass.getESuperTypes().add(this.getMenu());
+ dynamicMenuContributionEClass.getESuperTypes().add(this.getMenuItem());
+ dynamicMenuContributionEClass.getESuperTypes().add(theApplicationPackage.getContribution());
// Initialize classes, features, and operations; add parameters
initEClass(itemEClass, MItem.class, "Item", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
@@ -7825,6 +8130,8 @@ public class MenuPackageImpl extends EPackageImpl {
initEClass(opaqueMenuEClass, MOpaqueMenu.class, "OpaqueMenu", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+ initEClass(dynamicMenuContributionEClass, MDynamicMenuContribution.class, "DynamicMenuContribution", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$
+
// Initialize enums and add enum literals
initEEnum(itemTypeEEnum, ItemType.class, "ItemType"); //$NON-NLS-1$
addEEnumLiteral(itemTypeEEnum, ItemType.PUSH);
@@ -8336,6 +8643,16 @@ public class MenuPackageImpl extends EPackageImpl {
public static final EClass OPAQUE_MENU = eINSTANCE.getOpaqueMenu();
/**
+ * The meta object literal for the '{@link org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl <em>Dynamic Menu Contribution</em>}' class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.DynamicMenuContributionImpl
+ * @see org.eclipse.e4.ui.model.application.ui.menu.impl.MenuPackageImpl#getDynamicMenuContribution()
+ * @generated
+ */
+ public static final EClass DYNAMIC_MENU_CONTRIBUTION = eINSTANCE.getDynamicMenuContribution();
+
+ /**
* The meta object literal for the '{@link org.eclipse.e4.ui.model.application.ui.menu.ItemType <em>Item Type</em>}' enum.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
index c50d3f984df..a47eb6b642b 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuAdapterFactory.java
@@ -17,6 +17,7 @@ import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
@@ -225,6 +226,10 @@ public class MenuAdapterFactory extends AdapterFactoryImpl {
return createOpaqueMenuAdapter();
}
@Override
+ public Adapter caseDynamicMenuContribution(MDynamicMenuContribution object) {
+ return createDynamicMenuContributionAdapter();
+ }
+ @Override
public Adapter caseApplicationElement(MApplicationElement object) {
return createApplicationElementAdapter();
}
@@ -679,6 +684,20 @@ public class MenuAdapterFactory extends AdapterFactoryImpl {
}
/**
+ * Creates a new adapter for an object of class '{@link org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution <em>Dynamic Menu Contribution</em>}'.
+ * <!-- begin-user-doc -->
+ * This default implementation returns null so that we can easily ignore cases;
+ * it's useful to ignore a case when inheritance will catch all the cases anyway.
+ * <!-- end-user-doc -->
+ * @return the new adapter.
+ * @see org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution
+ * @generated
+ */
+ public Adapter createDynamicMenuContributionAdapter() {
+ return null;
+ }
+
+ /**
* Creates a new adapter for an object of class '{@link org.eclipse.e4.ui.model.application.MApplicationElement <em>Element</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
index 23acb3499ca..8e4e4737cc7 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/menu/util/MenuSwitch.java
@@ -17,6 +17,7 @@ import org.eclipse.e4.ui.model.application.ui.MElementContainer;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.basic.MTrimElement;
+import org.eclipse.e4.ui.model.application.ui.menu.*;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectToolItem;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
@@ -409,6 +410,19 @@ public class MenuSwitch<T1> extends Switch<T1> {
if (result == null) result = defaultCase(theEObject);
return result;
}
+ case MenuPackageImpl.DYNAMIC_MENU_CONTRIBUTION: {
+ MDynamicMenuContribution dynamicMenuContribution = (MDynamicMenuContribution)theEObject;
+ T1 result = caseDynamicMenuContribution(dynamicMenuContribution);
+ if (result == null) result = caseMenuItem(dynamicMenuContribution);
+ if (result == null) result = caseContribution(dynamicMenuContribution);
+ if (result == null) result = caseItem(dynamicMenuContribution);
+ if (result == null) result = caseMenuElement(dynamicMenuContribution);
+ if (result == null) result = caseUIElement(dynamicMenuContribution);
+ if (result == null) result = caseUILabel(dynamicMenuContribution);
+ if (result == null) result = caseApplicationElement(dynamicMenuContribution);
+ if (result == null) result = defaultCase(theEObject);
+ return result;
+ }
default: return defaultCase(theEObject);
}
}
@@ -849,6 +863,21 @@ public class MenuSwitch<T1> extends Switch<T1> {
}
/**
+ * Returns the result of interpreting the object as an instance of '<em>Dynamic Menu Contribution</em>'.
+ * <!-- begin-user-doc -->
+ * This implementation returns null;
+ * returning a non-null result will terminate the switch.
+ * <!-- end-user-doc -->
+ * @param object the target of the switch.
+ * @return the result of interpreting the object as an instance of '<em>Dynamic Menu Contribution</em>'.
+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
+ * @generated
+ */
+ public T1 caseDynamicMenuContribution(MDynamicMenuContribution object) {
+ return null;
+ }
+
+ /**
* Returns the result of interpreting the object as an instance of '<em>Element</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiAdapterFactory.java
index dd37f9ea67d..67cdedd9c8e 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiAdapterFactory.java
@@ -11,6 +11,7 @@
package org.eclipse.e4.ui.model.application.ui.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
+import org.eclipse.e4.ui.model.application.ui.*;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MCoreExpression;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiSwitch.java
index b8ffb094309..faec4486c4a 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/ui/util/UiSwitch.java
@@ -11,6 +11,7 @@
package org.eclipse.e4.ui.model.application.ui.util;
import org.eclipse.e4.ui.model.application.MApplicationElement;
+import org.eclipse.e4.ui.model.application.ui.*;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MCoreExpression;
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
index 4f818b0e1a4..6f000f1ffa8 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationAdapterFactory.java
@@ -11,6 +11,7 @@
package org.eclipse.e4.ui.model.application.util;
import java.util.Map;
+import org.eclipse.e4.ui.model.application.*;
import org.eclipse.e4.ui.model.application.MAddon;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationElement;
diff --git a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationSwitch.java b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationSwitch.java
index 1aa07699452..2555ff84a1d 100644
--- a/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationSwitch.java
+++ b/bundles/org.eclipse.e4.ui.model.workbench/src/org/eclipse/e4/ui/model/application/util/ApplicationSwitch.java
@@ -11,6 +11,7 @@
package org.eclipse.e4.ui.model.application.util;
import java.util.Map;
+import org.eclipse.e4.ui.model.application.*;
import org.eclipse.e4.ui.model.application.MAddon;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.MApplicationElement;
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
index f066a6df04a..4b6814250e2 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerHideProcessor.java
@@ -10,9 +10,16 @@
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import java.util.ArrayList;
+import java.util.List;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.ui.di.AboutToHide;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
@@ -44,6 +51,8 @@ public class MenuManagerHideProcessor implements IMenuListener2 {
* @see
* org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface
* .action.IMenuManager)
+ *
+ * SWT.Hide pre-processing method for MenuManager
*/
public void menuAboutToShow(IMenuManager manager) {
if (!(manager instanceof MenuManager)) {
@@ -55,6 +64,49 @@ public class MenuManagerHideProcessor implements IMenuListener2 {
if (menuModel instanceof MPopupMenu) {
hidePopup(menu, (MPopupMenu) menuModel, menuManager);
}
+ if (menuModel != null && menu != null)
+ processDynamicElements(menu, menuModel);
+ }
+
+ /**
+ * Process dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menu
+ * @param menuModel
+ *
+ */
+ private void processDynamicElements(Menu menu, final MMenu menuModel) {
+ if (!menu.isDisposed()) {
+ menu.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+
+ MMenuElement[] ml = menuModel.getChildren().toArray(
+ new MMenuElement[menuModel.getChildren().size()]);
+ for (int i = 0; i < ml.length; i++) {
+
+ MMenuElement currentMenuElement = ml[i];
+ if (currentMenuElement instanceof MDynamicMenuContribution) {
+ Object contribution = ((MDynamicMenuContribution) currentMenuElement)
+ .getObject();
+
+ IEclipseContext dynamicMenuContext = EclipseContextFactory
+ .create();
+ @SuppressWarnings("unchecked")
+ ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement
+ .getTransientData()
+ .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY);
+ dynamicMenuContext.set(List.class, mel);
+ ContextInjectionFactory.invoke(contribution,
+ AboutToHide.class, dynamicMenuContext);
+ }
+
+ }
+
+ }
+ });
+ }
+
}
/*
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
index f4d21bff7fa..c5f3befcdba 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerRenderer.java
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Marco Descher <descher@medevit.at> - Bug 389063 Dynamic Menu Contribution
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
@@ -36,6 +37,7 @@ import org.eclipse.e4.ui.model.application.ui.MUILabel;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuContribution;
@@ -946,4 +948,22 @@ public class MenuManagerRenderer extends SWTPartRenderer {
menuManager.markDirty();
}
}
+
+ /**
+ * Clean dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menuManager
+ * @param menuModel
+ * @param dump
+ */
+ public void removeDynamicMenuContributions(MenuManager menuManager,
+ MMenu menuModel, ArrayList<MMenuElement> dump) {
+ removeMenuContributions(menuModel, dump);
+ for (MMenuElement mMenuElement : dump) {
+ IContributionItem ici = getContribution(mMenuElement);
+ menuManager.remove(ici);
+ clearModelToContribution(menuModel, ici);
+ }
+ }
}
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
index e10afdd4bab..b22cb04d625 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/MenuManagerShowProcessor.java
@@ -7,17 +7,27 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 389063 Dynamic Menu Contribution
*******************************************************************************/
package org.eclipse.e4.ui.workbench.renderers.swt;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import javax.inject.Inject;
+import org.eclipse.e4.core.contexts.ContextInjectionFactory;
+import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
+import org.eclipse.e4.core.services.contributions.IContributionFactory;
+import org.eclipse.e4.ui.di.AboutToShow;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.internal.workbench.swt.Policy;
import org.eclipse.e4.ui.internal.workbench.swt.WorkbenchSWTActivator;
import org.eclipse.e4.ui.model.application.ui.MContext;
+import org.eclipse.e4.ui.model.application.ui.menu.MDynamicMenuContribution;
import org.eclipse.e4.ui.model.application.ui.menu.MMenu;
+import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MPopupMenu;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.swt.factories.IRendererFactory;
@@ -49,6 +59,9 @@ public class MenuManagerShowProcessor implements IMenuListener2 {
@Inject
private MenuManagerRenderer renderer;
+ @Inject
+ private IContributionFactory contributionFactory;
+
private HashMap<Menu, Runnable> pendingCleanup = new HashMap<Menu, Runnable>();
/*
@@ -65,6 +78,7 @@ public class MenuManagerShowProcessor implements IMenuListener2 {
MenuManager menuManager = (MenuManager) manager;
final MMenu menuModel = renderer.getMenuModel(menuManager);
final Menu menu = menuManager.getMenu();
+
if (menuModel != null && menuManager != null) {
cleanUp(menu, menuModel, menuManager);
}
@@ -89,6 +103,8 @@ public class MenuManagerShowProcessor implements IMenuListener2 {
* @see
* org.eclipse.jface.action.IMenuListener2#menuAboutToHide(org.eclipse.jface
* .action.IMenuManager)
+ *
+ * SWT.Show post processing method for MenuManager
*/
public void menuAboutToHide(IMenuManager manager) {
if (!(manager instanceof MenuManager)) {
@@ -98,10 +114,81 @@ public class MenuManagerShowProcessor implements IMenuListener2 {
final MMenu menuModel = renderer.getMenuModel(menuManager);
final Menu menu = menuManager.getMenu();
if (menuModel != null) {
+ processDynamicElements(menuModel, menuManager);
showMenu(menu, menuModel, menuManager);
}
}
+ /**
+ * HashMap key for storage of {@link MDynamicMenuContribution} elements used
+ * in {@link #processDynamicElements(MMenu, MenuManager)}
+ */
+ protected static final String DYNAMIC_ELEMENT_STORAGE_KEY = MenuManagerShowProcessor.class
+ .getSimpleName() + ".dynamicElements"; //$NON-NLS-1$
+
+ /**
+ * Process dynamic menu contributions provided by
+ * {@link MDynamicMenuContribution} application model elements
+ *
+ * @param menuModel
+ * @param menuManager
+ *
+ */
+ private void processDynamicElements(MMenu menuModel, MenuManager menuManager) {
+ MMenuElement[] ml = menuModel.getChildren().toArray(
+ new MMenuElement[menuModel.getChildren().size()]);
+ for (int i = 0; i < ml.length; i++) {
+
+ MMenuElement currentMenuElement = ml[i];
+ if (currentMenuElement instanceof MDynamicMenuContribution) {
+ Object contribution = ((MDynamicMenuContribution) currentMenuElement)
+ .getObject();
+ if (contribution == null) {
+ IEclipseContext context = modelService
+ .getContainingContext(menuModel);
+ contribution = contributionFactory.create(
+ ((MDynamicMenuContribution) currentMenuElement)
+ .getContributionURI(), context);
+ ((MDynamicMenuContribution) currentMenuElement)
+ .setObject(contribution);
+ }
+
+ IEclipseContext dynamicMenuContext = EclipseContextFactory
+ .create();
+ ArrayList<MMenuElement> mel = new ArrayList<MMenuElement>();
+ dynamicMenuContext.set(List.class, mel);
+ ContextInjectionFactory.invoke(contribution, AboutToShow.class,
+ dynamicMenuContext);
+
+ // remove existing entries for this dynamic contribution item if
+ // there are any
+ Map<String, Object> storageMap = currentMenuElement
+ .getTransientData();
+ @SuppressWarnings("unchecked")
+ ArrayList<MMenuElement> dump = (ArrayList<MMenuElement>) storageMap
+ .get(DYNAMIC_ELEMENT_STORAGE_KEY);
+ if (dump != null && dump.size() > 0)
+ renderer.removeDynamicMenuContributions(menuManager,
+ menuModel, dump);
+
+ storageMap.remove(DYNAMIC_ELEMENT_STORAGE_KEY);
+
+ // ensure that each element of the list has a valid element id
+ // and set the parent of the entries
+ for (int j = 0; j < mel.size(); j++) {
+ MMenuElement menuElement = mel.get(j);
+ if (menuElement.getElementId() == null
+ || menuElement.getElementId().length() < 1)
+ menuElement.setElementId(currentMenuElement
+ .getElementId() + "." + j); //$NON-NLS-1$
+ menuElement.setParent(currentMenuElement.getParent());
+ renderer.modelProcessSwitch(menuManager, menuElement);
+ }
+ storageMap.put(DYNAMIC_ELEMENT_STORAGE_KEY, mel);
+ }
+ }
+ }
+
private void cleanUp(final Menu menu, MMenu menuModel,
MenuManager menuManager) {
trace("cleanUp", menu, null); //$NON-NLS-1$

Back to the top