Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schindl2010-12-24 14:21:02 +0000
committerThomas Schindl2010-12-24 14:21:02 +0000
commit627a3bf37a6b0ab4cfa8501c75a0dd9ecb22d26a (patch)
tree878767b4298f8c0923143447be93efd747525a93
parent17e99285eb17566cb0e3cb2a5aea5b361f25061f (diff)
downloadorg.eclipse.e4.tools-627a3bf37a6b0ab4cfa8501c75a0dd9ecb22d26a.tar.gz
org.eclipse.e4.tools-627a3bf37a6b0ab4cfa8501c75a0dd9ecb22d26a.tar.xz
org.eclipse.e4.tools-627a3bf37a6b0ab4cfa8501c75a0dd9ecb22d26a.zip
Bug 323309 - [ModelTooling] Add Elements via the right mouse button
* adds context actions for virtual elements
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gifbin0 -> 378 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gifbin0 -> 347 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gifbin0 -> 969 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gifbin0 -> 937 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.pngbin0 -> 655 bytes
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java5
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java26
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties26
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java8
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java8
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java19
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java35
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java44
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java44
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java45
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java45
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java46
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java46
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java65
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java45
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java19
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java46
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java45
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java83
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java54
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java59
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java44
27 files changed, 698 insertions, 159 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif
new file mode 100644
index 00000000..bbbdd559
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif
new file mode 100644
index 00000000..013e818e
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif
new file mode 100644
index 00000000..94bdda3e
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif
new file mode 100644
index 00000000..f6da4c7a
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png
new file mode 100644
index 00000000..1514d51a
--- /dev/null
+++ b/bundles/org.eclipse.e4.tools.emf.ui/icons/full/obj16/cross.png
Binary files differ
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
index 9b51f06d..42670618 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/component/AbstractComponentEditor.java
@@ -25,6 +25,7 @@ import org.eclipse.emf.databinding.FeaturePath;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
@@ -131,6 +132,10 @@ public abstract class AbstractComponentEditor {
return img;
}
+ protected ImageDescriptor loadSharedDescriptor(Display d, URL path) {
+ return ImageDescriptor.createFromImage(loadSharedImage(d, path));
+ }
+
public FeaturePath[] getLabelProperties() {
return new FeaturePath[] {};
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
index 60c00aba..fbf1fc22 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.java
@@ -225,6 +225,7 @@ public class Messages extends NLS {
public static String VBindingTableEditor_Name;
public static String VBindingTableEditor_LabelDescription;
public static String VBindingTableEditor_BindingTables;
+ public static String VBindingTableEditor_AddBindingTable;
public static String AddonsEditor_ClassURI;
public static String AddonsEditor_TreeLabel;
@@ -356,22 +357,27 @@ public class Messages extends NLS {
public static String VApplicationCategoriesEditor_TreeLabel;
public static String VApplicationCategoriesEditor_TreeLabelDescription;
public static String VApplicationCategoriesEditor_Categories;
+ public static String VApplicationCategoriesEditor_AddCategory;
public static String VCommandEditor_TreeLabel;
public static String VCommandEditor_TreeLabelDescription;
public static String VCommandEditor_Commands;
+ public static String VCommandEditor_AddCommand;
public static String VHandlerEditor_TreeLabel;
public static String VHandlerEditor_TreeLabelDescription;
public static String VHandlerEditor_Handlers;
+ public static String VHandlerEditor_AddHandler;
public static String VMenuContributionsEditor_TreeLabel;
public static String VMenuContributionsEditor_TreeLabelDescription;
public static String VMenuContributionsEditor_MenuContributions;
+ public static String VMenuContributionsEditor_AddMenuContribution;
public static String VMenuEditor_TreeLabel;
public static String VMenuEditor_TreeLabelDescription;
public static String VMenuEditor_Menus;
+ public static String VMenuEditor_AddMenuContribution;
public static String VModelFragmentsEditor_TreeLabel;
public static String VModelFragmentsEditor_TreeLabelDescription;
@@ -384,30 +390,45 @@ public class Messages extends NLS {
public static String VPartDescriptor_TreeLabel;
public static String VPartDescriptor_TreeLabelDescription;
public static String VPartDescriptor_Descriptors;
+ public static String VPartDescriptor_AddPartDescriptor;
public static String VToolBarContributionsEditor_Contributions;
public static String VToolBarContributionsEditor_TreeLabelDescription;
public static String VToolBarContributionsEditor_TreeLabel;
+ public static String VToolBarContributionsEditor_AddToolBarContribution;
public static String VTrimContributionsEditor_TreeLabel;
public static String VTrimContributionsEditor_TreeLabelDescription;
public static String VTrimContributionsEditor_Contributions;
+ public static String VTrimContributionsEditor_AddTrimContribution;
public static String VWindowControlEditor_TreeLabel;
public static String VWindowControlEditor_TreeLabelDescription;
public static String VWindowControlEditor_Controls;
+ public static String VWindowControlEditor_AddPerspectiveStack;
+ public static String VWindowControlEditor_AddPartSashContainer;
+ public static String VWindowControlEditor_AddPartStack;
+ public static String VWindowControlEditor_AddPart;
+ public static String VWindowControlEditor_AddInputPart;
+ public static String VWindowControlEditor_AddArea;
public static String VWindowEditor_TreeLabel;
public static String VWindowEditor_TreeLabelDescription;
public static String VWindowEditor_Windows;
+ public static String VWindowEditor_AddTrimmedWindow;
+ public static String VWindowEditor_AddWindow;
public static String VWindowSharedElementsEditor_TreeLabel;
public static String VWindowSharedElementsEditor_TreeLabelDescription;
public static String VWindowSharedElementsEditor_Controls;
+ public static String VWindowSharedElementsEditor_AddPartSashContainer;
+ public static String VWindowSharedElementsEditor_AddPart;
+ public static String VWindowSharedElementsEditor_AddInputPart;
public static String VWindowTrimEditor_TreeLabel;
public static String VWindowTrimEditor_TreeLabelDescription;
public static String VWindowTrimEditor_Controls;
+ public static String VWindowTrimEditor_AddWindowTrim;
public static String AbstractIconDialog_IconName;
@@ -496,6 +517,7 @@ public class Messages extends NLS {
public static String VItemParametersEditor_TreeLabel;
public static String VItemParametersEditor_TreeLabelDescription;
public static String VItemParametersEditor_Parameters;
+ public static String VItemParametersEditor_AddParameter;
public static String CoreExpressionEditor_TreeLabel;
public static String CoreExpressionEditor_TreeLabelDescription;
@@ -504,6 +526,10 @@ public class Messages extends NLS {
public static String VMenuElementsEditor_TreeLabel;
public static String VMenuElementsEditor_TreeLabelDescription;
public static String VMenuElementsEditor_Children;
+ public static String VMenuElementsEditor_AddHandledMenuItem;
+ public static String VMenuElementsEditor_AddMenu;
+ public static String VMenuElementsEditor_AddDirectMenuItem;
+ public static String VMenuElementsEditor_AddSeparator;
public static String ExpressionIdDialog_ShellTitle;
public static String ExpressionIdDialog_DialogTitle;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
index efc3c629..2ee8972a 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/Messages.properties
@@ -221,6 +221,7 @@ VBindingTableEditor_Contexts=Contexts
VBindingTableEditor_Name=Name
VBindingTableEditor_LabelDescription=Description
VBindingTableEditor_BindingTables=Binding Tables
+VBindingTableEditor_AddBindingTable=Add Binding Table
AddonsEditor_ClassURI=Class URI
AddonsEditor_TreeLabel=Addon
@@ -351,22 +352,27 @@ VApplicationAddons_Commands=Commands
VApplicationCategoriesEditor_TreeLabel=Command Categories
VApplicationCategoriesEditor_TreeLabelDescription=Command Categories bla bla bla bla
VApplicationCategoriesEditor_Categories=Categories
+VApplicationCategoriesEditor_AddCategory=Add Category
VCommandEditor_TreeLabel=Commands
VCommandEditor_TreeLabelDescription=Commands Bla Bla Bla Bla Bla
VCommandEditor_Commands=Commands
+VCommandEditor_AddCommand=Add Command
VHandlerEditor_TreeLabel=Handlers
VHandlerEditor_TreeLabelDescription=Handlers Bla Bla Bla Bla Bla
VHandlerEditor_Handlers=Handlers
+VHandlerEditor_AddHandler=Add Handler
VMenuContributionsEditor_TreeLabel=Menu Contributions
VMenuContributionsEditor_TreeLabelDescription=Menu Contributions Bla Bla Bla Bla Bla
VMenuContributionsEditor_MenuContributions=Menu Contributions
+VMenuContributionsEditor_AddMenuContribution=Add Menu Contribution
VMenuEditor_TreeLabel=Menus
VMenuEditor_TreeLabelDescription=Menus Bla Bla Bla Bla Bla
VMenuEditor_Menus=Menus
+VMenuEditor_AddMenuContribution=Add Menu
VModelFragmentsEditor_TreeLabel=Fragments
VModelFragmentsEditor_TreeLabelDescription=Fragments Bla Bla Bla Bla Bla
@@ -379,30 +385,45 @@ VModelImportsEditor_Imports=Imports
VPartDescriptor_TreeLabel=Part Descriptors
VPartDescriptor_TreeLabelDescription=Part Descriptors Bla Bla Bla Bla Bla
VPartDescriptor_Descriptors=Descriptors
+VPartDescriptor_AddPartDescriptor=Add Descriptor
VToolBarContributionsEditor_TreeLabel=ToolBar Contributions
VToolBarContributionsEditor_TreeLabelDescription=ToolBar Contributions Bla Bla Bla Bla Bla
VToolBarContributionsEditor_Contributions=ToolBar Contributions
+VToolBarContributionsEditor_AddToolBarContribution=Add ToolBar Contribution
VTrimContributionsEditor_TreeLabel=Trim Contributions
VTrimContributionsEditor_TreeLabelDescription=Trim Contributions Bla Bla Bla Bla Bla
VTrimContributionsEditor_Contributions=Trim Contributions
+VTrimContributionsEditor_AddTrimContribution=Add Trim Contribution
VWindowControlEditor_TreeLabel=Controls
VWindowControlEditor_TreeLabelDescription=Controls Bla Bla Bla Bla Bla
VWindowControlEditor_Controls=Controls
+VWindowControlEditor_AddPerspectiveStack=Add Perspective Stack
+VWindowControlEditor_AddPartSashContainer=Add Part Sash Container
+VWindowControlEditor_AddPartStack=Add Part Stack
+VWindowControlEditor_AddPart=Add Part
+VWindowControlEditor_AddInputPart=Add Input Part
+VWindowControlEditor_AddArea=Add Area
VWindowEditor_TreeLabel=Windows
VWindowEditor_TreeLabelDescription=Windows Bla Bla Bla Bla Bla
VWindowEditor_Windows=Windows
+VWindowEditor_AddTrimmedWindow=Add Trimmed Window
+VWindowEditor_AddWindow=Add Window
VWindowSharedElementsEditor_TreeLabel=Shared Elements
VWindowSharedElementsEditor_TreeLabelDescription=Shared Elements Bla Bla Bla Bla
VWindowSharedElementsEditor_Controls=Controls
+VWindowSharedElementsEditor_AddPartSashContainer=Add Part Sash Container
+VWindowSharedElementsEditor_AddPart=Add Part
+VWindowSharedElementsEditor_AddInputPart=Add Input Part
VWindowTrimEditor_TreeLabel=Window Trims
VWindowTrimEditor_TreeLabelDescription=Window Trims Bla Bla Bla Bla Bla
VWindowTrimEditor_Controls=Controls
+VWindowTrimEditor_AddWindowTrim=Add Window Trim
AbstractIconDialog_IconName=IconName
@@ -491,6 +512,7 @@ ImageTooltip_FileSize=File-Size
VItemParametersEditor_TreeLabel=Parameters
VItemParametersEditor_TreeLabelDescription=Parameters Bla Bla Bla
VItemParametersEditor_Parameters=Parameters
+VItemParametersEditor_AddParameter=Add Parameter
CoreExpressionEditor_TreeLabel=Core Expression
CoreExpressionEditor_TreeLabelDescription=Core Expression Bla Bla Bla
@@ -499,6 +521,10 @@ CoreExpressionEditor_ExpressionId=Expression Id
VMenuElementsEditor_TreeLabel=Children
VMenuElementsEditor_TreeLabelDescription=Children Bla Bla Bla
VMenuElementsEditor_Children=Children
+VMenuElementsEditor_AddHandledMenuItem=Add Handled Menu Item
+VMenuElementsEditor_AddMenu=Add Menu
+VMenuElementsEditor_AddDirectMenuItem=Add Direct Menu Item
+VMenuElementsEditor_AddSeparator=Add Separator
ExpressionIdDialog_ShellTitle=Find Expression Id
ExpressionIdDialog_DialogTitle=Find Expression Id
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
index 6b8071d1..5c6e4c79 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java
@@ -148,6 +148,7 @@ import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider;
import org.eclipse.jface.databinding.viewers.TreeStructureAdvisor;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -166,6 +167,7 @@ import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.dnd.TransferData;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
@@ -212,6 +214,8 @@ public class ModelEditor {
private boolean fragment;
private Handler clipboardHandler;
+ private Image removeIcon;
+
@Inject
@Optional
private IClipboardService clipboardService;
@@ -236,6 +240,7 @@ public class ModelEditor {
this.context = context;
this.context.set(ModelEditor.class, this);
this.obsManager = new ObservablesManager();
+ this.removeIcon = new Image(composite.getDisplay(), ModelEditor.class.getResourceAsStream("/icons/full/obj16/cross.png"));
registerDefaultEditors();
registerVirtualEditors();
@@ -377,7 +382,7 @@ public class ModelEditor {
}
if (o.eContainer() != null) {
- actions.add(new Action(Messages.ModelEditor_Delete) {
+ actions.add(new Action(Messages.ModelEditor_Delete, ImageDescriptor.createFromImage(removeIcon)) {
public void run() {
Command cmd = RemoveCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o.eContainer(), o.eContainingFeature(), o);
if (cmd.canExecute()) {
@@ -748,6 +753,7 @@ public class ModelEditor {
@PreDestroy
void dispose() {
try {
+ removeIcon.dispose();
obsManager.dispose();
} catch (Exception e) {
// TODO: handle exception
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java
index b0227e57..c7c8b378 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java
@@ -94,14 +94,14 @@ public class AreaEditor extends AbstractComponentEditor {
MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
try {
- return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif")); //$NON-NLS-1$
+ return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area_vertical.gif")); //$NON-NLS-1$
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
- return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer_vertical.gif")); //$NON-NLS-1$
+ return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area_vertical.gif")); //$NON-NLS-1$
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -113,14 +113,14 @@ public class AreaEditor extends AbstractComponentEditor {
MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
try {
- return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif")); //$NON-NLS-1$
+ return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif")); //$NON-NLS-1$
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
try {
- return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/PartSashContainer.gif")); //$NON-NLS-1$
+ return loadSharedImage(display, new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/tbr/Area.gif")); //$NON-NLS-1$
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java
index f06206cd..dca00e32 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationAddons.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -54,12 +56,17 @@ public class VApplicationAddons extends AbstractComponentEditor {
public VApplicationAddons(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
- actions.add(new Action(Messages.VApplicationAddons_AddAddon) {
- @Override
- public void run() {
- handleAddAddon();
- }
- });
+ try {
+ actions.add(new Action(Messages.VApplicationAddons_AddAddon, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Addons.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAddAddon();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java
index dc92ad7e..eb5ef695 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VApplicationCategoriesEditor.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -54,6 +56,17 @@ public class VApplicationCategoriesEditor extends AbstractComponentEditor {
public VApplicationCategoriesEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VApplicationCategoriesEditor_AddCategory, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Category.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -177,15 +190,7 @@ public class VApplicationCategoriesEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MCategory command = CommandsFactoryImpl.eINSTANCE.createCategory();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -215,6 +220,18 @@ public class VApplicationCategoriesEditor extends AbstractComponentEditor {
return null;
}
+ protected void handleAdd() {
+ MCategory command = CommandsFactoryImpl.eINSTANCE.createCategory();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), ApplicationPackageImpl.Literals.APPLICATION__CATEGORIES, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
@Override
public List<Action> getActions(Object element) {
ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java
index 7705e08e..857a361e 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VBindingTableEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,9 +51,21 @@ public class VBindingTableEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer bindingViewer;
+ private List<Action> actions = new ArrayList<Action>();
public VBindingTableEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VBindingTableEditor_AddBindingTable, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingTable.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +189,7 @@ public class VBindingTableEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -206,9 +214,27 @@ public class VBindingTableEditor extends AbstractComponentEditor {
return parent;
}
+ protected void handleAdd() {
+ MBindingTable command = MCommandsFactory.INSTANCE.createBindingTable();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.BINDING_TABLE_CONTAINER__BINDING_TABLES, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
@Override
public IObservableList getChildList(Object element) {
return null;
}
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java
index 1646f412..81a39e63 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VCommandEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -49,10 +53,22 @@ public class VCommandEditor extends AbstractComponentEditor {
private TableViewer viewer;
private EStructuralFeature commandsFeature;
+ private List<Action> actions = new ArrayList<Action>();
public VCommandEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature commandsFeature) {
super(editingDomain, editor);
this.commandsFeature = commandsFeature;
+ try {
+ actions.add(new Action(Messages.VCommandEditor_AddCommand, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Command.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -176,15 +192,7 @@ public class VCommandEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -209,9 +217,27 @@ public class VCommandEditor extends AbstractComponentEditor {
return parent;
}
+ protected void handleAdd() {
+ MCommand command = CommandsFactoryImpl.eINSTANCE.createCommand();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), commandsFeature, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
@Override
public IObservableList getChildList(Object element) {
return null;
}
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java
index 2f5f7a69..9ccbd4d0 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VHandlerEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,9 +51,21 @@ public class VHandlerEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VHandlerEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VHandlerEditor_AddHandler, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Handler.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +189,7 @@ public class VHandlerEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MHandler handler = MCommandsFactory.INSTANCE.createHandler();
- setElementId(handler);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(handler);
- }
+ handleAdd();
}
});
@@ -210,4 +218,23 @@ public class VHandlerEditor extends AbstractComponentEditor {
public IObservableList getChildList(Object element) {
return null;
}
+
+ protected void handleAdd() {
+ MHandler handler = MCommandsFactory.INSTANCE.createHandler();
+ setElementId(handler);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS, handler);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(handler);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java
index de21d72f..08f398a6 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VItemParametersEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -30,6 +33,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -49,11 +53,23 @@ public class VItemParametersEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
private IEMFListProperty HANDLED_ITEM__PARAMETERS = EMFProperties.list(MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS);
public VItemParametersEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VItemParametersEditor_AddParameter, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Parameter.png"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -177,15 +193,7 @@ public class VItemParametersEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MParameter handler = MCommandsFactory.INSTANCE.createParameter();
- setElementId(handler);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(handler);
- }
+ handleAdd();
}
});
@@ -214,4 +222,23 @@ public class VItemParametersEditor extends AbstractComponentEditor {
public IObservableList getChildList(Object element) {
return HANDLED_ITEM__PARAMETERS.observe(element);
}
+
+ protected void handleAdd() {
+ MParameter handler = MCommandsFactory.INSTANCE.createParameter();
+ setElementId(handler);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS, handler);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(handler);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java
index 4443cf1c..346ad2a7 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuContributionsEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -48,8 +52,21 @@ public class VMenuContributionsEditor extends AbstractComponentEditor {
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
+
public VMenuContributionsEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VMenuContributionsEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuContribution.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +190,7 @@ public class VMenuContributionsEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -210,4 +219,23 @@ public class VMenuContributionsEditor extends AbstractComponentEditor {
public IObservableList getChildList(Object element) {
return null;
}
+
+ protected void handleAdd() {
+ MMenuContribution command = MMenuFactory.INSTANCE.createMenuContribution();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.MENU_CONTRIBUTIONS__MENU_CONTRIBUTIONS, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java
index 537f5a76..596bce56 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -30,6 +33,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -50,10 +54,22 @@ public class VMenuEditor extends AbstractComponentEditor {
private EMFDataBindingContext context;
private TableViewer viewer;
private EStructuralFeature feature;
+ private List<Action> actions = new ArrayList<Action>();
public VMenuEditor(EditingDomain editingDomain, ModelEditor editor, EStructuralFeature feature) {
super(editingDomain, editor);
this.feature = feature;
+ try {
+ actions.add(new Action(Messages.VMenuEditor_AddMenuContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -177,15 +193,7 @@ public class VMenuEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MMenu handler = MMenuFactory.INSTANCE.createMenu();
- setElementId(handler);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(handler);
- }
+ handleAdd();
}
});
@@ -211,7 +219,25 @@ public class VMenuEditor extends AbstractComponentEditor {
@Override
public IObservableList getChildList(Object element) {
- // TODO Auto-generated method stub
return null;
}
+
+ protected void handleAdd() {
+ MMenu handler = MMenuFactory.INSTANCE.createMenu();
+ setElementId(handler);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), feature, handler);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(handler);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java
index baebd345..1610a95c 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VMenuElementsEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -33,6 +36,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
@@ -55,11 +59,42 @@ public class VMenuElementsEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
public VMenuElementsEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VMenuElementsEditor_AddHandledMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/HandledMenuItem.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
+ }
+ });
+ actions.add(new Action(Messages.VMenuElementsEditor_AddMenu, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Menu.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(MenuPackageImpl.Literals.MENU, false);
+ }
+ });
+ actions.add(new Action(Messages.VMenuElementsEditor_AddDirectMenuItem, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/DirectMenuItem.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false);
+ }
+ });
+ actions.add(new Action(Messages.VMenuElementsEditor_AddSeparator, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/MenuSeparator.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true);
+ }
+ });
+
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -194,16 +229,7 @@ public class VMenuElementsEditor extends AbstractComponentEditor {
if (!childrenDropDown.getSelection().isEmpty()) {
Struct struct = (Struct) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement();
EClass eClass = struct.eClass;
- MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- if (!struct.separator) {
- getEditor().setSelection(eObject);
- }
- }
+ handleAdd(eClass, struct.separator);
}
}
});
@@ -245,4 +271,23 @@ public class VMenuElementsEditor extends AbstractComponentEditor {
}
}
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
+
+ protected void handleAdd(EClass eClass, boolean separator) {
+ MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ if (!separator) {
+ getEditor().setSelection(eObject);
+ }
+ }
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java
index cd3e2cb0..e0a5fdc6 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VPartDescriptor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,9 +51,21 @@ public class VPartDescriptor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VPartDescriptor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VPartDescriptor_AddPartDescriptor, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +189,7 @@ public class VPartDescriptor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -210,4 +218,23 @@ public class VPartDescriptor extends AbstractComponentEditor {
public IObservableList getChildList(Object element) {
return null;
}
+
+ protected void handleAdd() {
+ MPartDescriptor command = MBasicFactory.INSTANCE.createPartDescriptor();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART_DESCRIPTOR_CONTAINER__DESCRIPTORS, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java
index 3bc2433b..8629943a 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VRootBindingContexts.java
@@ -10,6 +10,8 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -54,12 +56,17 @@ public class VRootBindingContexts extends AbstractComponentEditor {
public VRootBindingContexts(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
- actions.add(new Action(Messages.VRootBindingContexts_AddContext) {
- @Override
- public void run() {
- handleAddContext();
- }
- });
+ try {
+ actions.add(new Action(Messages.VRootBindingContexts_AddContext, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/BindingContext.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAddContext();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java
index f5e19692..34b558e9 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VToolBarContributionsEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,9 +51,21 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VToolBarContributionsEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VToolBarContributionsEditor_AddToolBarContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/ToolBarContribution.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +189,7 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -208,7 +216,25 @@ public class VToolBarContributionsEditor extends AbstractComponentEditor {
@Override
public IObservableList getChildList(Object element) {
- // TODO Auto-generated method stub
return null;
}
+
+ protected void handleAdd() {
+ MToolBarContribution command = MMenuFactory.INSTANCE.createToolBarContribution();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTIONS__TOOL_BAR_CONTRIBUTIONS, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java
index 84de2e6b..6aec00c5 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VTrimContributionsEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -28,6 +31,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -47,9 +51,21 @@ public class VTrimContributionsEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VTrimContributionsEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VTrimContributionsEditor_AddTrimContribution, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/TrimContribution.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -173,15 +189,7 @@ public class VTrimContributionsEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution();
- setElementId(command);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(command);
- }
+ handleAdd();
}
});
@@ -210,4 +218,23 @@ public class VTrimContributionsEditor extends AbstractComponentEditor {
public IObservableList getChildList(Object element) {
return null;
}
+
+ protected void handleAdd() {
+ MTrimContribution command = MMenuFactory.INSTANCE.createTrimContribution();
+ setElementId(command);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), MenuPackageImpl.Literals.TRIM_CONTRIBUTIONS__TRIM_CONTRIBUTIONS, command);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(command);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java
index dd353195..c0277478 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowControlEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -32,6 +35,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
@@ -54,9 +58,57 @@ public class VWindowControlEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VWindowControlEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VWindowControlEditor_AddPerspectiveStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PerspectiveStack.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowControlEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer_vertical.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowControlEditor_AddPartStack, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartStack.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART_STACK);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowControlEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowControlEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowControlEditor_AddArea, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Area.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(AdvancedPackageImpl.Literals.AREA);
+ }
+ });
+
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -187,17 +239,7 @@ public class VWindowControlEditor extends AbstractComponentEditor {
public void widgetSelected(SelectionEvent e) {
if (!childrenDropDown.getSelection().isEmpty()) {
EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement();
-
- EObject eObject = EcoreUtil.create(eClass);
-
- setElementId(eObject);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(eObject);
- }
+ handleAdd(eClass);
}
}
});
@@ -229,4 +271,23 @@ public class VWindowControlEditor extends AbstractComponentEditor {
return null;
}
+ private void handleAdd(EClass eClass) {
+ EObject eObject = EcoreUtil.create(eClass);
+
+ setElementId(eObject);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(eObject);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java
index b8995ff3..462628b3 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -31,6 +34,7 @@ import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
@@ -53,9 +57,27 @@ public class VWindowEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VWindowEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VWindowEditor_AddTrimmedWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.TRIMMED_WINDOW);
+ }
+ });
+ actions.add(new Action(Messages.VWindowEditor_AddWindow, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Window.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.WINDOW);
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -175,8 +197,8 @@ public class VWindowEditor extends AbstractComponentEditor {
return eclass.getName();
}
});
- childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.WINDOW, BasicPackageImpl.Literals.TRIMMED_WINDOW });
- childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.WINDOW));
+ childrenDropDown.setInput(new EClass[] { BasicPackageImpl.Literals.TRIMMED_WINDOW, BasicPackageImpl.Literals.WINDOW });
+ childrenDropDown.setSelection(new StructuredSelection(BasicPackageImpl.Literals.TRIMMED_WINDOW));
b = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
b.setImage(getImage(b.getDisplay(), TABLE_ADD_IMAGE));
@@ -185,15 +207,7 @@ public class VWindowEditor extends AbstractComponentEditor {
@Override
public void widgetSelected(SelectionEvent e) {
EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement();
- EObject handler = EcoreUtil.create(eClass);
- setElementId(handler);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(handler);
- }
+ handleAdd(eClass);
}
});
@@ -226,4 +240,22 @@ public class VWindowEditor extends AbstractComponentEditor {
return null;
}
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
+
+ protected void handleAdd(EClass eClass) {
+ EObject handler = EcoreUtil.create(eClass);
+ setElementId(handler);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, handler);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(handler);
+ }
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java
index 5a1d061c..99be98eb 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowSharedElementsEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -31,6 +34,7 @@ import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.MoveCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
@@ -53,9 +57,36 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VWindowSharedElementsEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+
+ try {
+ actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPartSashContainer, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/PartSashContainer.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART_SASH_CONTAINER);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowSharedElementsEditor_AddPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.PART);
+ }
+ });
+
+ actions.add(new Action(Messages.VWindowSharedElementsEditor_AddInputPart, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/Part.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd(BasicPackageImpl.Literals.INPUT_PART);
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -197,15 +228,7 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor {
public void widgetSelected(SelectionEvent e) {
if (!childrenDropDown.getSelection().isEmpty()) {
EClass eClass = (EClass) ((IStructuredSelection) childrenDropDown.getSelection()).getFirstElement();
- EObject eObject = EcoreUtil.create(eClass);
- setElementId(eObject);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(eObject);
- }
+ handleAdd(eClass);
}
}
});
@@ -237,4 +260,22 @@ public class VWindowSharedElementsEditor extends AbstractComponentEditor {
return null;
}
+ protected void handleAdd(EClass eClass) {
+ EObject eObject = EcoreUtil.create(eClass);
+ setElementId(eObject);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS, eObject);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(eObject);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java
index 2e3a6a0b..f6ae8da4 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/virtual/VWindowTrimEditor.java
@@ -10,6 +10,9 @@
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.virtual;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -26,6 +29,7 @@ import org.eclipse.emf.databinding.EMFDataBindingContext;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.Action;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
@@ -44,9 +48,21 @@ public class VWindowTrimEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
private TableViewer viewer;
+ private List<Action> actions = new ArrayList<Action>();
public VWindowTrimEditor(EditingDomain editingDomain, ModelEditor editor) {
super(editingDomain, editor);
+ try {
+ actions.add(new Action(Messages.VWindowTrimEditor_AddWindowTrim, loadSharedDescriptor(Display.getCurrent(), new URL("platform:/plugin/org.eclipse.e4.tools.emf.ui/icons/full/modelelements/WindowTrim.gif"))) { //$NON-NLS-1$
+ @Override
+ public void run() {
+ handleAdd();
+ }
+ });
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
@Override
@@ -117,15 +133,7 @@ public class VWindowTrimEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar();
- setElementId(handler);
-
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler);
-
- if (cmd.canExecute()) {
- getEditingDomain().getCommandStack().execute(cmd);
- getEditor().setSelection(handler);
- }
+ handleAdd();
}
});
@@ -156,4 +164,22 @@ public class VWindowTrimEditor extends AbstractComponentEditor {
return null;
}
+ protected void handleAdd() {
+ MTrimBar handler = MBasicFactory.INSTANCE.createTrimBar();
+ setElementId(handler);
+
+ Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.TRIMMED_WINDOW__TRIM_BARS, handler);
+
+ if (cmd.canExecute()) {
+ getEditingDomain().getCommandStack().execute(cmd);
+ getEditor().setSelection(handler);
+ }
+ }
+
+ @Override
+ public List<Action> getActions(Object element) {
+ ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ l.addAll(actions);
+ return l;
+ }
} \ No newline at end of file

Back to the top