Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjonas2014-11-27 13:15:25 +0000
committerjonas2014-11-27 13:15:25 +0000
commitec7f1d331a387a00dba59c53c150a30023d0ee93 (patch)
tree051025081d8584de0c8c29ea0828748dfac9a7ba /bundles
parent86c11de8fd50c2de67062bc635e76f0b7e56c914 (diff)
downloadorg.eclipse.e4.tools-ec7f1d331a387a00dba59c53c150a30023d0ee93.tar.gz
org.eclipse.e4.tools-ec7f1d331a387a00dba59c53c150a30023d0ee93.tar.xz
org.eclipse.e4.tools-ec7f1d331a387a00dba59c53c150a30023d0ee93.zip
Bug 444692 - Remove WarningsI20141127-2200
Added org.eclipse.e4 to accesible packages in emf.ui bundle
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/.classpath6
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java88
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java11
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/ModelEditor.java634
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java7
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AreaEditor.java5
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java25
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java1
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java3
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java5
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java5
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java50
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java31
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java31
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java112
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java161
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java147
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java81
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java142
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java131
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java126
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java117
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java84
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java92
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java118
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java85
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java45
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java80
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java87
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java95
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java63
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java156
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java12
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java8
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java5
-rw-r--r--bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java7
46 files changed, 1728 insertions, 1150 deletions
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/.classpath b/bundles/org.eclipse.e4.tools.emf.ui/.classpath
index ad32c83a..64449070 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/.classpath
+++ b/bundles/org.eclipse.e4.tools.emf.ui/.classpath
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/e4/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java
index afebef3b..1372aa5b 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/CommandToStringConverter.java
@@ -17,7 +17,6 @@ import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-@SuppressWarnings("restriction")
public class CommandToStringConverter extends Converter {
private final Messages Messages;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
index 6fa6d071..939337a2 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/Util.java
@@ -45,7 +45,6 @@ import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
-@SuppressWarnings("restriction")
public class Util {
public static final boolean isNullOrEmpty(String element) {
return element == null || element.trim().length() == 0;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
index 405b9fe8..caf35ad2 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/common/XMIModelResource.java
@@ -42,7 +42,6 @@ import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-@SuppressWarnings("restriction")
public class XMIModelResource implements IModelResource {
private final EditingDomain editingDomain;
private final Resource resource;
@@ -67,7 +66,7 @@ public class XMIModelResource implements IModelResource {
});
editingDomain = new AdapterFactoryEditingDomain(adapterFactory, commandStack, resourceSet);
resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap()
- .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new E4XMIResourceFactory());
+ .put(Resource.Factory.Registry.DEFAULT_EXTENSION, new E4XMIResourceFactory());
resource = resourceSet.getResource(uri, true);
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java
index 6bf45848..9da394cf 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/PatternFilter.java
@@ -15,7 +15,6 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
-@SuppressWarnings("restriction")
public class PatternFilter extends org.eclipse.e4.ui.workbench.swt.internal.copy.PatternFilter {
/**
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java
index 87a3383e..edad4587 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/E4PickList.java
@@ -6,12 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Steven Spungin <steven@spungin.tv> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common;
import java.util.List;
+
import org.eclipse.e4.tools.emf.ui.common.Util;
import org.eclipse.e4.tools.emf.ui.common.component.AbstractComponentEditor;
import org.eclipse.e4.tools.emf.ui.internal.Messages;
@@ -41,11 +42,9 @@ import org.eclipse.swt.widgets.Composite;
* Pressing CR in the combo will execute the ADD command.
* </p>
* <p>
- * <em>E4 specific:</em> The default feature is
- * UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN. Other features must
- * override appropriate methods. The picker uses an Array Content Provider. The
- * list uses an ObservableListContentProvider and a Struct class to contain the
- * object and label.
+ * <em>E4 specific:</em> The default feature is UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN. Other features must
+ * override appropriate methods. The picker uses an Array Content Provider. The list uses an
+ * ObservableListContentProvider and a Struct class to contain the object and label.
* </p>
*
* @author Steven Spungin
@@ -68,7 +67,8 @@ public class E4PickList extends AbstractPickList {
}
}
- public E4PickList(Composite parent, int style, List<PickListFeatures> listFeatures, final Messages messages, final AbstractComponentEditor componentEditor, final EStructuralFeature feature) {
+ public E4PickList(Composite parent, int style, List<PickListFeatures> listFeatures, final Messages messages,
+ final AbstractComponentEditor componentEditor, final EStructuralFeature feature) {
super(parent, style, listFeatures, messages, componentEditor);
this.componentEditor = componentEditor;
@@ -78,13 +78,13 @@ public class E4PickList extends AbstractPickList {
picker.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
- Struct struct = (Struct) element;
+ final Struct struct = (Struct) element;
return struct.label;
}
});
viewer.setLabelProvider(new ComponentLabelProvider(componentEditor.getEditor(), messages));
- ObservableListContentProvider cp = new ObservableListContentProvider();
+ final ObservableListContentProvider cp = new ObservableListContentProvider();
viewer.setContentProvider(cp);
}
@@ -96,10 +96,11 @@ public class E4PickList extends AbstractPickList {
* @param i
*/
protected void tryEObjectMove(Object obj, EObject container, int delta) {
- List<?> l = (List<?>) container.eGet(feature);
- int idx = l.indexOf(obj) + delta;
- if ((delta > 0 && idx < l.size()) || (delta < 0 && idx >= 0)) {
- Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster().getValue(), feature, obj, idx);
+ final List<?> l = (List<?>) container.eGet(feature);
+ final int idx = l.indexOf(obj) + delta;
+ if (delta > 0 && idx < l.size() || delta < 0 && idx >= 0) {
+ final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster()
+ .getValue(), feature, obj, idx);
if (cmd.canExecute()) {
componentEditor.getEditingDomain().getCommandStack().execute(cmd);
@@ -111,16 +112,17 @@ public class E4PickList extends AbstractPickList {
@Override
protected void addPressed() {
if (!picker.getSelection().isEmpty()) {
- Struct struct = (Struct) ((IStructuredSelection) picker.getSelection()).getFirstElement();
- EClass eClass = struct.eClass;
+ final Struct struct = (Struct) ((IStructuredSelection) picker.getSelection()).getFirstElement();
+ final EClass eClass = struct.eClass;
_handleAdd(eClass, struct.separator);
}
}
protected void _handleAdd(EClass eClass, boolean separator) {
- MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
+ final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster().getValue(), feature, eObject);
+ final Command cmd = AddCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster()
+ .getValue(), feature, eObject);
if (cmd.canExecute()) {
componentEditor.getEditingDomain().getCommandStack().execute(cmd);
@@ -132,9 +134,11 @@ public class E4PickList extends AbstractPickList {
protected void setElementId(Object element) {
if (componentEditor.getEditor().isAutoCreateElementId() && element instanceof MApplicationElement) {
- MApplicationElement el = (MApplicationElement) element;
+ final MApplicationElement el = (MApplicationElement) element;
if (el.getElementId() == null || el.getElementId().trim().length() == 0) {
- el.setElementId(Util.getDefaultElementId(((EObject) componentEditor.getMaster().getValue()).eResource(), el, componentEditor.getEditor().getProject()));
+ el.setElementId(Util.getDefaultElementId(
+ ((EObject) componentEditor.getMaster().getValue()).eResource(), el, componentEditor.getEditor()
+ .getProject()));
}
}
}
@@ -142,34 +146,36 @@ public class E4PickList extends AbstractPickList {
protected List<?> getContainerChildren(Object master) {
if (master instanceof MElementContainer<?>) {
return ((MElementContainer<?>) master).getChildren();
- } else {
- return null;
}
+ return null;
}
@Override
protected void moveUpPressed() {
if (!viewer.getSelection().isEmpty()) {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (s.size() == 1) {
- Object obj = s.getFirstElement();
- Object container = componentEditor.getMaster().getValue();
+ final Object obj = s.getFirstElement();
+ final Object container = componentEditor.getMaster().getValue();
if (feature == ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE) {
tryEObjectMove(obj, (EObject) container, -1);
return;
}
- List<?> children = getContainerChildren(container);
+ final List<?> children = getContainerChildren(container);
if (children == null) {
return;
}
- int idx = children.indexOf(obj) - 1;
+ final int idx = children.indexOf(obj) - 1;
if (idx >= 0) {
if (obj instanceof MUIElement && feature == UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
- if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj, componentEditor.getEditor().isLiveModel(), idx)) {
+ if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj,
+ componentEditor.getEditor().isLiveModel(), idx)) {
viewer.setSelection(new StructuredSelection(obj));
}
- } else if (obj instanceof MApplicationElement || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) {
- Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster().getValue(), feature, obj, idx);
+ } else if (obj instanceof MApplicationElement
+ || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) {
+ final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor
+ .getMaster().getValue(), feature, obj, idx);
if (cmd.canExecute()) {
componentEditor.getEditingDomain().getCommandStack().execute(cmd);
viewer.setSelection(new StructuredSelection(obj));
@@ -183,26 +189,29 @@ public class E4PickList extends AbstractPickList {
@Override
protected void moveDownPressed() {
if (!viewer.getSelection().isEmpty()) {
- IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
if (s.size() == 1) {
- Object obj = s.getFirstElement();
- Object container = componentEditor.getMaster().getValue();
+ final Object obj = s.getFirstElement();
+ final Object container = componentEditor.getMaster().getValue();
if (feature == ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE) {
tryEObjectMove(obj, (EObject) container, 1);
return;
}
- List<?> children = getContainerChildren(container);
+ final List<?> children = getContainerChildren(container);
if (children == null) {
return;
}
- int idx = children.indexOf(obj) + 1;
+ final int idx = children.indexOf(obj) + 1;
if (idx < children.size()) {
if (obj instanceof MUIElement && feature == UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
- if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj, componentEditor.getEditor().isLiveModel(), idx)) {
+ if (Util.moveElementByIndex(componentEditor.getEditingDomain(), (MUIElement) obj,
+ componentEditor.getEditor().isLiveModel(), idx)) {
viewer.setSelection(new StructuredSelection(obj));
}
- } else if (obj instanceof MApplicationElement || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) {
- Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster().getValue(), feature, obj, idx);
+ } else if (obj instanceof MApplicationElement
+ || obj instanceof org.eclipse.emf.ecore.impl.MinimalEObjectImpl.Container) {
+ final Command cmd = MoveCommand.create(componentEditor.getEditingDomain(), componentEditor
+ .getMaster().getValue(), feature, obj, idx);
if (cmd.canExecute()) {
componentEditor.getEditingDomain().getCommandStack().execute(cmd);
viewer.setSelection(new StructuredSelection(obj));
@@ -216,8 +225,9 @@ public class E4PickList extends AbstractPickList {
@Override
protected void removePressed() {
if (!viewer.getSelection().isEmpty()) {
- List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList();
- Command cmd = RemoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster().getValue(), feature, keybinding);
+ final List<?> keybinding = ((IStructuredSelection) viewer.getSelection()).toList();
+ final Command cmd = RemoveCommand.create(componentEditor.getEditingDomain(), componentEditor.getMaster()
+ .getValue(), feature, keybinding);
if (cmd.canExecute()) {
componentEditor.getEditingDomain().getCommandStack().execute(cmd);
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java
index 8bf286bf..9ec9da8f 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/EClassLabelProvider.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Steven Spungin <steven@spungin.tv> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common;
@@ -22,7 +22,7 @@ import org.eclipse.jface.viewers.LabelProvider;
*
*/
public class EClassLabelProvider extends LabelProvider {
- private ModelEditor editor;
+ private final ModelEditor editor;
public EClassLabelProvider(ModelEditor editor) {
this.editor = editor;
@@ -30,12 +30,11 @@ public class EClassLabelProvider extends LabelProvider {
@Override
public String getText(Object element) {
- EClass eclass = (EClass) element;
- AbstractComponentEditor elementEditor = editor.getEditor(eclass);
+ final EClass eclass = (EClass) element;
+ final AbstractComponentEditor elementEditor = editor.getEditor(eclass);
if (elementEditor != null) {
return elementEditor.getLabel(element);
- } else {
- return eclass.getName();
}
+ return eclass.getName();
}
}
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 601f235d..07b3e16c 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
@@ -6,11 +6,12 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Wim Jongman <wim.jongman@remainsoftware.com> - Maintenance
- * Marco Descher <marco@descher.at> - Bug395982, 426653, 422465, 429674
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Bug 396902, 431755, 431735, 424730, 424730, 391089, 437236, 437552, Ongoing Maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Wim Jongman <wim.jongman@remainsoftware.com> - Maintenance
+ * Marco Descher <marco@descher.at> - Bug395982, 426653, 422465, 429674
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 396902, 431755, 431735, 424730, 424730, 391089, 437236, 437552, Ongoing
+ * Maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common;
@@ -20,9 +21,11 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.ObservablesManager;
import org.eclipse.core.databinding.observable.IObservable;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -242,41 +245,48 @@ public class ModelEditor implements IGotoObject {
public static final String VIRTUAL_HANDLER = ModelEditor.class.getName() + ".VIRTUAL_HANDLER"; //$NON-NLS-1$
public static final String VIRTUAL_BINDING_TABLE = ModelEditor.class.getName() + ".VIRTUAL_BINDING_TABLE"; //$NON-NLS-1$
public static final String VIRTUAL_COMMAND = ModelEditor.class.getName() + ".VIRTUAL_COMMAND"; //$NON-NLS-1$
- public static final String VIRTUAL_APPLICATION_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_APPLICATION_WINDOWS"; //$NON-NLS-1$
- public static final String VIRTUAL_PERSPECTIVE_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_PERSPECTIVE_WINDOWS"; //$NON-NLS-1$
+ public static final String VIRTUAL_APPLICATION_WINDOWS = ModelEditor.class.getName()
+ + ".VIRTUAL_APPLICATION_WINDOWS"; //$NON-NLS-1$
+ public static final String VIRTUAL_PERSPECTIVE_WINDOWS = ModelEditor.class.getName()
+ + ".VIRTUAL_PERSPECTIVE_WINDOWS"; //$NON-NLS-1$
public static final String VIRTUAL_WINDOW_WINDOWS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_WINDOWS"; //$NON-NLS-1$
public static final String VIRTUAL_WINDOW_CONTROLS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_CONTROLS"; //$NON-NLS-1$
public static final String VIRTUAL_PART_DESCRIPTORS = ModelEditor.class.getName() + ".VIRTUAL_PART_DESCRIPTORS"; //$NON-NLS-1$
- public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName() + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$
- public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName() + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$
+ public static final String VIRTUAL_PARTDESCRIPTOR_MENU = ModelEditor.class.getName()
+ + ".VIRTUAL_PARTDESCRIPTOR_MENU"; //$NON-NLS-1$
+ public static final String VIRTUAL_TRIMMED_WINDOW_TRIMS = ModelEditor.class.getName()
+ + ".VIRTUAL_TRIMMED_WINDOW_TRIMS"; //$NON-NLS-1$
public static final String VIRTUAL_ADDONS = ModelEditor.class.getName() + ".VIRTUAL_ADDONS"; //$NON-NLS-1$
public static final String VIRTUAL_MENU_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_MENU_CONTRIBUTIONS"; //$NON-NLS-1$
- public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$
+ public static final String VIRTUAL_TOOLBAR_CONTRIBUTIONS = ModelEditor.class.getName()
+ + ".VIRTUAL_TOOLBAR_CONTRIBUTIONS"; //$NON-NLS-1$
public static final String VIRTUAL_TRIM_CONTRIBUTIONS = ModelEditor.class.getName() + ".VIRTUAL_TRIM_CONTRIBUTIONS"; //$NON-NLS-1$
- public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$
+ public static final String VIRTUAL_WINDOW_SHARED_ELEMENTS = ModelEditor.class.getName()
+ + ".VIRTUAL_WINDOW_SHARED_ELEMENTS"; //$NON-NLS-1$
public static final String VIRTUAL_MODEL_FRAGEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_FRAGEMENTS"; //$NON-NLS-1$
public static final String VIRTUAL_MODEL_IMPORTS = ModelEditor.class.getName() + ".VIRTUAL_MODEL_IMPORTS"; //$NON-NLS-1$
public static final String VIRTUAL_CATEGORIES = ModelEditor.class.getName() + ".VIRTUAL_CATEGORIES"; //$NON-NLS-1$
public static final String VIRTUAL_PARAMETERS = ModelEditor.class.getName() + ".VIRTUAL_PARAMETERS"; //$NON-NLS-1$
public static final String VIRTUAL_MENUELEMENTS = ModelEditor.class.getName() + ".VIRTUAL_MENUELEMENTS"; //$NON-NLS-1$
public static final String VIRTUAL_ROOT_CONTEXTS = ModelEditor.class.getName() + ".VIRTUAL_ROOT_CONTEXTS"; //$NON-NLS-1$
- public static final String VIRTUAL_PERSPECTIVE_CONTROLS = ModelEditor.class.getName() + "VIRTUAL_PERSPECTIVE_CONTROLS"; //$NON-NLS-1$
+ public static final String VIRTUAL_PERSPECTIVE_CONTROLS = ModelEditor.class.getName()
+ + "VIRTUAL_PERSPECTIVE_CONTROLS"; //$NON-NLS-1$
public static final String VIRTUAL_SNIPPETS = ModelEditor.class.getName() + "VIRTUAL_SNIPPETS"; //$NON-NLS-1$
public static final int TAB_FORM = 0;
public static final int TAB_XMI = 1;
public static final int TAB_LIST = 2;
- private Map<EClass, AbstractComponentEditor> editorMap = new HashMap<EClass, AbstractComponentEditor>();
- private Map<String, AbstractComponentEditor> virtualEditors = new HashMap<String, AbstractComponentEditor>();
- private Map<Class<?>, List<AbstractElementEditorContribution>> tabContributions = new HashMap<Class<?>, List<AbstractElementEditorContribution>>();
- private List<FeaturePath> labelFeaturePaths = new ArrayList<FeaturePath>();
- private List<IEditorFeature> editorFeatures = new ArrayList<IEditorFeature>();
- private List<IContributionClassCreator> contributionCreator = new ArrayList<IContributionClassCreator>();
+ private final Map<EClass, AbstractComponentEditor> editorMap = new HashMap<EClass, AbstractComponentEditor>();
+ private final Map<String, AbstractComponentEditor> virtualEditors = new HashMap<String, AbstractComponentEditor>();
+ private final Map<Class<?>, List<AbstractElementEditorContribution>> tabContributions = new HashMap<Class<?>, List<AbstractElementEditorContribution>>();
+ private final List<FeaturePath> labelFeaturePaths = new ArrayList<FeaturePath>();
+ private final List<IEditorFeature> editorFeatures = new ArrayList<IEditorFeature>();
+ private final List<IContributionClassCreator> contributionCreator = new ArrayList<IContributionClassCreator>();
private TreeViewer viewer;
- private IModelResource modelProvider;
- private IProject project;
+ private final IModelResource modelProvider;
+ private final IProject project;
@Inject
ESelectionService selectionService;
@@ -284,7 +294,7 @@ public class ModelEditor implements IGotoObject {
@Inject
MApplication app;
- private IEclipseContext context;
+ private final IEclipseContext context;
private boolean fragment;
private Handler clipboardHandler;
@@ -316,7 +326,7 @@ public class ModelEditor implements IGotoObject {
@Optional
private IModelExtractor modelExtractor;
- private ObservablesManager obsManager;
+ private final ObservablesManager obsManager;
private final IResourcePool resourcePool;
@@ -342,23 +352,25 @@ public class ModelEditor implements IGotoObject {
private XmiTab xmiTab;
- public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project, final IResourcePool resourcePool) {
+ public ModelEditor(Composite composite, IEclipseContext context, IModelResource modelProvider, IProject project,
+ final IResourcePool resourcePool) {
this.resourcePool = resourcePool;
this.modelProvider = modelProvider;
this.project = project;
this.context = context;
this.context.set(ModelEditor.class, this);
- this.obsManager = new ObservablesManager();
+ obsManager = new ObservablesManager();
if (project != null) {
String localeString = ""; //$NON-NLS-1$
- Object object = this.context.get(TranslationService.LOCALE);
+ final Object object = this.context.get(TranslationService.LOCALE);
// TODO simplify once we break e4 tools
// compatibility with Luna, in Luna we representation has changed to
// be Locale instead of String
if (object != null) {
localeString = object.toString();
}
- ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project, localeString) {
+ final ProjectOSGiTranslationProvider translationProvider = new ProjectOSGiTranslationProvider(project,
+ localeString) {
@Override
protected void updateResourceBundle() {
super.updateResourceBundle();
@@ -464,7 +476,7 @@ public class ModelEditor implements IGotoObject {
// This allows external commands to interact with the view.
// Eventually, all 3 tabs, or even the ModelEditor itself, could
// implement the interface.
- String key = "org.eclipse.e4.tools.active-object-viewer"; //$NON-NLS-1$
+ final String key = "org.eclipse.e4.tools.active-object-viewer"; //$NON-NLS-1$
if (listTab != null && editorTabFolder.getSelectionIndex() == getTabIndex(listTab.getTabItem())) {
app.getContext().set(key, listTab);
} else {
@@ -487,9 +499,9 @@ public class ModelEditor implements IGotoObject {
private void findAndHighlight(Control control) {
if (control != null) {
MApplicationElement m = findModelElement(control);
- MApplicationElement o = m;
+ final MApplicationElement o = m;
if (m != null) {
- List<MApplicationElement> l = new ArrayList<MApplicationElement>();
+ final List<MApplicationElement> l = new ArrayList<MApplicationElement>();
do {
l.add(m);
m = (MApplicationElement) ((EObject) m).eContainer();
@@ -497,7 +509,8 @@ public class ModelEditor implements IGotoObject {
if (o instanceof MPart) {
System.err.println(getClass().getName() + ".findAndHighLight: " + o); //$NON-NLS-1$
- System.err.println(getClass().getName() + ".findAndHighLight: " + ((EObject) o).eContainingFeature()); //$NON-NLS-1$
+ System.err.println(getClass().getName()
+ + ".findAndHighLight: " + ((EObject) o).eContainingFeature()); //$NON-NLS-1$
}
viewer.setSelection(new StructuredSelection(o));
@@ -517,30 +530,30 @@ public class ModelEditor implements IGotoObject {
}
private XmiTab createXMITab(Composite composite) {
- IEclipseContext childContext = context.createChild();
+ final IEclipseContext childContext = context.createChild();
childContext.set(Composite.class, composite);
childContext.set(EMFDocumentResourceMediator.class, emfDocumentProvider);
childContext.set(IEclipsePreferences.class, preferences);
childContext.set(IResourcePool.class, resourcePool);
- XmiTab ret = ContextInjectionFactory.make(XmiTab.class, childContext);
+ final XmiTab ret = ContextInjectionFactory.make(XmiTab.class, childContext);
return ret;
}
private Composite createFormTab(Composite composite) {
- SashForm form = new SashForm(composite, SWT.HORIZONTAL);
+ final SashForm form = new SashForm(composite, SWT.HORIZONTAL);
form.setBackground(form.getDisplay().getSystemColor(SWT.COLOR_WHITE));
viewer = createTreeViewerArea(form);
- Composite parent = new Composite(form, SWT.NONE);
- FillLayout l = new FillLayout();
+ final Composite parent = new Composite(form, SWT.NONE);
+ final FillLayout l = new FillLayout();
parent.setLayout(l);
- Composite editingArea = new Composite(parent, SWT.BORDER);
- GridLayout gl = new GridLayout();
+ final Composite editingArea = new Composite(parent, SWT.BORDER);
+ final GridLayout gl = new GridLayout();
editingArea.setLayout(gl);
- Composite headerContainer = new Composite(editingArea, SWT.NONE);
+ final Composite headerContainer = new Composite(editingArea, SWT.NONE);
headerContainer.setLayout(new GridLayout(3, false));
headerContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -550,7 +563,7 @@ public class ModelEditor implements IGotoObject {
final Label sectionHeaderLabel = new Label(headerContainer, SWT.NONE);
sectionHeaderLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final Label separatorLabel = new Label(headerContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
+ final GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
separatorLabel.setLayoutData(gridData);
@@ -564,17 +577,17 @@ public class ModelEditor implements IGotoObject {
@Override
public void keyReleased(final KeyEvent e) {
if (e.keyCode == SWT.DEL) {
- List<EObject> list = new ArrayList<EObject>();
+ final List<EObject> list = new ArrayList<EObject>();
final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- for (Object o : ((StructuredSelection) selection).toList()) {
+ for (final Object o : ((StructuredSelection) selection).toList()) {
if (o instanceof EObject) {
list.add((EObject) o);
}
}
if (list.isEmpty() == false) {
- Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), list);
+ final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), list);
if (cmd.canExecute()) {
- ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd);
+ modelProvider.getEditingDomain().getCommandStack().execute(cmd);
}
}
}
@@ -587,7 +600,7 @@ public class ModelEditor implements IGotoObject {
if (!event.getSelection().isEmpty()) {
final IStructuredSelection s = (IStructuredSelection) event.getSelection();
if (s.getFirstElement() instanceof EObject) {
- EObject obj = (EObject) s.getFirstElement();
+ final EObject obj = (EObject) s.getFirstElement();
final AbstractComponentEditor editor = getEditor(obj.eClass());
if (editor != null) {
currentEditor = editor;
@@ -597,7 +610,7 @@ public class ModelEditor implements IGotoObject {
@Override
public void run() {
- Composite comp = editor.getEditor(contentContainer, s.getFirstElement());
+ final Composite comp = editor.getEditor(contentContainer, s.getFirstElement());
comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
layout.topControl = comp;
contentContainer.layout(true);
@@ -605,7 +618,7 @@ public class ModelEditor implements IGotoObject {
});
}
} else {
- VirtualEntry<?> entry = (VirtualEntry<?>) s.getFirstElement();
+ final VirtualEntry<?> entry = (VirtualEntry<?>) s.getFirstElement();
final AbstractComponentEditor editor = virtualEditors.get(entry.getId());
if (editor != null) {
currentEditor = editor;
@@ -615,7 +628,7 @@ public class ModelEditor implements IGotoObject {
@Override
public void run() {
- Composite comp = editor.getEditor(contentContainer, s.getFirstElement());
+ final Composite comp = editor.getEditor(contentContainer, s.getFirstElement());
comp.setBackgroundMode(SWT.INHERIT_DEFAULT);
layout.topControl = comp;
contentContainer.layout(true);
@@ -641,7 +654,7 @@ public class ModelEditor implements IGotoObject {
form.setWeights(new int[] { 3, 4 });
- MenuManager mgr = new MenuManager();
+ final MenuManager mgr = new MenuManager();
mgr.setRemoveAllWhenShown(true);
mgr.addMenuListener(new IMenuListener() {
@@ -649,39 +662,42 @@ public class ModelEditor implements IGotoObject {
public void menuAboutToShow(IMenuManager manager) {
final IStructuredSelection s = (IStructuredSelection) viewer.getSelection();
final List<?> listOfSelections = s.toList();
- int noSelected = listOfSelections.size();
+ final int noSelected = listOfSelections.size();
boolean addSeparator = false;
if (!s.isEmpty() && noSelected == 1) {
List<Action> actions;
if (s.getFirstElement() instanceof VirtualEntry<?>) {
- actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActions(s.getFirstElement());
+ actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActions(
+ s.getFirstElement());
if (actions.size() > 0) {
- MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild);
- for (Action a : actions) {
+ final MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild);
+ for (final Action a : actions) {
addSeparator = true;
addMenu.add(a);
}
manager.add(addMenu);
}
- actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActionsImport(s.getFirstElement());
+ actions = virtualEditors.get(((VirtualEntry<?>) s.getFirstElement()).getId()).getActionsImport(
+ s.getFirstElement());
if (actions.size() > 0) {
- MenuManager menu = new MenuManager(messages.ModelEditor_Import3x);
- for (Action a : actions) {
+ final MenuManager menu = new MenuManager(messages.ModelEditor_Import3x);
+ for (final Action a : actions) {
addSeparator = true;
menu.add(a);
}
manager.add(menu);
}
- if (addSeparator)
+ if (addSeparator) {
manager.add(new Separator());
+ }
} else {
final EObject o = (EObject) s.getFirstElement();
- AbstractComponentEditor editor = getEditor(o.eClass());
+ final AbstractComponentEditor editor = getEditor(o.eClass());
// Build Add Child menu
if (editor != null) {
@@ -691,8 +707,8 @@ public class ModelEditor implements IGotoObject {
}
if (actions.size() > 0) {
- MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild);
- for (Action a : actions) {
+ final MenuManager addMenu = new MenuManager(messages.ModelEditor_AddChild);
+ for (final Action a : actions) {
addSeparator = true;
addMenu.add(a);
}
@@ -708,8 +724,8 @@ public class ModelEditor implements IGotoObject {
if (actions.size() > 0) {
// TODO WIM - extract nls
- MenuManager menu = new MenuManager(messages.ModelEditor_Import3x);
- for (Action a : actions) {
+ final MenuManager menu = new MenuManager(messages.ModelEditor_Import3x);
+ for (final Action a : actions) {
addSeparator = true;
menu.add(a);
}
@@ -718,12 +734,13 @@ public class ModelEditor implements IGotoObject {
if (o.eContainer() != null) {
addSeparator = true;
- manager.add(new Action(messages.ModelEditor_Delete, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) {
+ manager.add(new Action(messages.ModelEditor_Delete, ImageDescriptor
+ .createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_Obj16_cross))) {
@Override
public void run() {
- Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), o);
+ final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), o);
if (cmd.canExecute()) {
- ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd);
+ modelProvider.getEditingDomain().getCommandStack().execute(cmd);
}
}
});
@@ -732,38 +749,40 @@ public class ModelEditor implements IGotoObject {
}
// multi selection
if (noSelected > 0) {
- if ((!isModelFragment()) && modelExtractor != null)
- manager.add(new Action(messages.ModelEditor_ExtractFragment, ImageDescriptor.createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_ModelFragments))) {
+ if (!isModelFragment() && modelExtractor != null) {
+ manager.add(new Action(messages.ModelEditor_ExtractFragment, ImageDescriptor
+ .createFromImage(resourcePool.getImageUnchecked(ResourceProvider.IMG_ModelFragments))) {
@Override
public void run() {
- ArrayList<MApplicationElement> maes = new ArrayList<MApplicationElement>();
- for (Object objSelect : listOfSelections) {
+ final ArrayList<MApplicationElement> maes = new ArrayList<MApplicationElement>();
+ for (final Object objSelect : listOfSelections) {
EObject container = null;
if (objSelect instanceof VirtualEntry<?>) {
- VirtualEntry<?> ve = (VirtualEntry<?>) objSelect;
+ final VirtualEntry<?> ve = (VirtualEntry<?>) objSelect;
container = (EObject) ve.getOriginalParent();
- IObservableList list = ve.getList();
- Iterator<?> iterator = list.iterator();
+ final IObservableList list = ve.getList();
+ final Iterator<?> iterator = list.iterator();
while (iterator.hasNext()) {
maes.add((MApplicationElement) iterator.next());
}
} else {
container = ((EObject) objSelect).eContainer();
- MApplicationElement objSelect2 = (MApplicationElement) objSelect;
- if (!(objSelect2 instanceof MApplication))
+ final MApplicationElement objSelect2 = (MApplicationElement) objSelect;
+ if (!(objSelect2 instanceof MApplication)) {
maes.add(objSelect2);
- else {
+ } else {
// can't extract application
return;
}
}
- String containerId = ((MApplicationElement) container).getElementId();
+ final String containerId = ((MApplicationElement) container).getElementId();
if (containerId == null || containerId.length() == 0) {
- MessageDialog.openError(viewer.getControl().getShell(), null, messages.ModelEditor_ExtractFragment_NoParentId);
+ MessageDialog.openError(viewer.getControl().getShell(), null,
+ messages.ModelEditor_ExtractFragment_NoParentId);
return;
}
@@ -771,54 +790,57 @@ public class ModelEditor implements IGotoObject {
}
if (modelExtractor.extract(viewer.getControl().getShell(), project, maes)) {
- Command cmd = DeleteCommand.create(ModelEditor.this.modelProvider.getEditingDomain(), maes);
+ final Command cmd = DeleteCommand.create(modelProvider.getEditingDomain(), maes);
if (cmd.canExecute()) {
- ModelEditor.this.modelProvider.getEditingDomain().getCommandStack().execute(cmd);
+ modelProvider.getEditingDomain().getCommandStack().execute(cmd);
}
}
- };
+ }
});
+ }
}
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.scripting"); //$NON-NLS-1$
final IConfigurationElement[] elements = extPoint.getConfigurationElements();
- if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement && noSelected == 1) {
+ if (elements.length > 0 && !s.isEmpty() && s.getFirstElement() instanceof MApplicationElement
+ && noSelected == 1) {
if (addSeparator) {
manager.add(new Separator());
}
addSeparator = false;
- MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script);
+ final MenuManager scriptExecute = new MenuManager(messages.ModelEditor_Script);
manager.add(scriptExecute);
- for (IConfigurationElement e : elements) {
+ for (final IConfigurationElement e : elements) {
final IConfigurationElement le = e;
scriptExecute.add(new Action(e.getAttribute("label")) { //$NON-NLS-1$
- @Override
- public void run() {
- try {
- MApplicationElement o = (MApplicationElement) s.getFirstElement();
- IScriptingSupport support = (IScriptingSupport) le.createExecutableExtension("class"); //$NON-NLS-1$
- IEclipseContext ctx = null;
- if (project == null) {
- if (o instanceof MContext) {
- ctx = ((MContext) o).getContext();
- } else {
- ctx = ModelUtils.getContainingContext(o);
+ @Override
+ public void run() {
+ try {
+ final MApplicationElement o = (MApplicationElement) s.getFirstElement();
+ final IScriptingSupport support = (IScriptingSupport) le
+ .createExecutableExtension("class"); //$NON-NLS-1$
+ IEclipseContext ctx = null;
+ if (project == null) {
+ if (o instanceof MContext) {
+ ctx = ((MContext) o).getContext();
+ } else {
+ ctx = ModelUtils.getContainingContext(o);
+ }
}
- }
- support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ctx);
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ support.openEditor(viewer.getControl().getShell(), s.getFirstElement(), ctx);
+ } catch (final CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
- }
- });
+ });
}
}
@@ -828,18 +850,19 @@ public class ModelEditor implements IGotoObject {
manager.add(new Separator());
}
- Action nlsAction = new Action(messages.ModelEditor_ExternalizeStrings) {
+ final Action nlsAction = new Action(messages.ModelEditor_ExternalizeStrings) {
@Override
public void run() {
- ExternalizeStringHandler h = ContextInjectionFactory.make(ExternalizeStringHandler.class, context);
+ final ExternalizeStringHandler h = ContextInjectionFactory.make(
+ ExternalizeStringHandler.class, context);
ContextInjectionFactory.invoke(h, Execute.class, context);
}
};
- Action extIdAction = new Action(messages.ModelEditor_ExportIds) {
+ final Action extIdAction = new Action(messages.ModelEditor_ExportIds) {
@Override
public void run() {
- ExportIdsHandler h = ContextInjectionFactory.make(ExportIdsHandler.class, context);
+ final ExportIdsHandler h = ContextInjectionFactory.make(ExportIdsHandler.class, context);
ContextInjectionFactory.invoke(h, Execute.class, context);
}
};
@@ -871,7 +894,7 @@ public class ModelEditor implements IGotoObject {
manager.add(new Separator());
}
- Action expandAction = new Action(messages.ModelEditor_ExpandSubtree) {
+ final Action expandAction = new Action(messages.ModelEditor_ExpandSubtree) {
@Override
public void run() {
if (!s.isEmpty()) {
@@ -889,7 +912,7 @@ public class ModelEditor implements IGotoObject {
if (s.getFirstElement() instanceof EObject) {
manager.add(new Separator());
final EObject el = (EObject) s.getFirstElement();
- Action gotoXmiAction = new Action(messages.ModelEditor_goto_xmi) {
+ final Action gotoXmiAction = new Action(messages.ModelEditor_goto_xmi) {
@Override
public void run() {
gotoEObject(TAB_XMI, el);
@@ -899,7 +922,7 @@ public class ModelEditor implements IGotoObject {
if (listTab != null) {
if (EmfUtil.getAttribute(el, "elementId") != null) { //$NON-NLS-1$
- Action gotoListAction = new Action(messages.ModelEditor_goto_list) {
+ final Action gotoListAction = new Action(messages.ModelEditor_goto_list) {
@Override
public void run() {
gotoEObject(TAB_LIST, el);
@@ -979,17 +1002,17 @@ public class ModelEditor implements IGotoObject {
}
private void loadContributionCreators() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
- for (IConfigurationElement el : extPoint.getConfigurationElements()) {
+ for (final IConfigurationElement el : extPoint.getConfigurationElements()) {
if (!"contributionClassCreator".equals(el.getName())) { //$NON-NLS-1$
continue;
}
try {
contributionCreator.add((IContributionClassCreator) el.createExecutableExtension("class")); //$NON-NLS-1$
- } catch (CoreException e) {
+ } catch (final CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -997,7 +1020,7 @@ public class ModelEditor implements IGotoObject {
}
public IContributionClassCreator getContributionCreator(EClass eClass) {
- for (IContributionClassCreator c : contributionCreator) {
+ for (final IContributionClassCreator c : contributionCreator) {
if (c.isSupported(eClass)) {
return c;
}
@@ -1006,17 +1029,17 @@ public class ModelEditor implements IGotoObject {
}
private void loadEditorFeatures() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
- for (IConfigurationElement el : extPoint.getConfigurationElements()) {
+ for (final IConfigurationElement el : extPoint.getConfigurationElements()) {
if (!"editorfeature".equals(el.getName())) { //$NON-NLS-1$
continue;
}
try {
editorFeatures.add((IEditorFeature) el.createExecutableExtension("class")); //$NON-NLS-1$
- } catch (CoreException e) {
+ } catch (final CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@@ -1032,9 +1055,9 @@ public class ModelEditor implements IGotoObject {
}
public List<FeatureClass> getFeatureClasses(EClass eClass, EStructuralFeature feature) {
- List<FeatureClass> list = new ArrayList<IEditorFeature.FeatureClass>();
+ final List<FeatureClass> list = new ArrayList<IEditorFeature.FeatureClass>();
- for (IEditorFeature f : editorFeatures) {
+ for (final IEditorFeature f : editorFeatures) {
list.addAll(f.getFeatureClasses(eClass, feature));
}
@@ -1050,18 +1073,22 @@ public class ModelEditor implements IGotoObject {
treeArea.setBackgroundMode(SWT.INHERIT_DEFAULT);
TreeViewer tempViewer = null;
- String property = System.getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED);
- if (property != null || preferences.getBoolean(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, false)) { //$NON-NLS-1$
- FilteredTree viewParent = new FilteredTree(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL, new PatternFilter(), false);
+ final String property = System
+ .getProperty(ORG_ECLIPSE_E4_TOOLS_MODELEDITOR_FILTEREDTREE_ENABLED_XMITAB_DISABLED);
+ if (property != null || preferences.getBoolean(ModelEditorPreferences.TAB_FORM_SEARCH_SHOW, false)) {
+ final FilteredTree viewParent = new FilteredTree(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL
+ | SWT.V_SCROLL, new PatternFilter(), false);
tempViewer = viewParent.getViewer();
} else {
- tempViewer = new TreeViewerEx(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL, emfDocumentProvider, modelProvider);
+ tempViewer = new TreeViewerEx(treeArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL,
+ emfDocumentProvider, modelProvider);
}
final TreeViewer viewer = tempViewer;
viewer.setLabelProvider(new ComponentLabelProvider(this, messages));
- ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(new ObservableFactoryImpl(), new TreeStructureAdvisor() {
- });
+ final ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider(
+ new ObservableFactoryImpl(), new TreeStructureAdvisor() {
+ });
viewer.setContentProvider(contentProvider);
final WritableSet clearedSet = new WritableSet();
@@ -1070,13 +1097,13 @@ public class ModelEditor implements IGotoObject {
@Override
public void handleSetChange(SetChangeEvent event) {
- for (Object o : event.diff.getAdditions()) {
+ for (final Object o : event.diff.getAdditions()) {
if (o instanceof EObject) {
clearedSet.add(o);
}
}
- for (Object o : event.diff.getRemovals()) {
+ for (final Object o : event.diff.getRemovals()) {
if (o instanceof EObject) {
clearedSet.remove(o);
}
@@ -1084,8 +1111,8 @@ public class ModelEditor implements IGotoObject {
}
});
- for (FeaturePath p : labelFeaturePaths) {
- IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet);
+ for (final FeaturePath p : labelFeaturePaths) {
+ final IObservableMap map = EMFProperties.value(p).observeDetail(clearedSet);
map.addMapChangeListener(new IMapChangeListener() {
@Override
@@ -1102,14 +1129,15 @@ public class ModelEditor implements IGotoObject {
@Override
public void doubleClick(DoubleClickEvent event) {
- TreeViewer viewer = (TreeViewer) event.getViewer();
- IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
- Object selectedNode = thisSelection.getFirstElement();
+ final TreeViewer viewer = (TreeViewer) event.getViewer();
+ final IStructuredSelection thisSelection = (IStructuredSelection) event.getSelection();
+ final Object selectedNode = thisSelection.getFirstElement();
if (mod1Down) {
- if (viewer.getExpandedState(selectedNode))
+ if (viewer.getExpandedState(selectedNode)) {
viewer.setExpandedState(selectedNode, false);
- else
+ } else {
viewer.expandToLevel(selectedNode, AbstractTreeViewer.ALL_LEVELS);
+ }
} else {
viewer.setExpandedState(selectedNode, !viewer.getExpandedState(selectedNode));
}
@@ -1125,24 +1153,26 @@ public class ModelEditor implements IGotoObject {
}
});
- int ops = DND.DROP_MOVE;
+ final int ops = DND.DROP_MOVE;
viewer.addDragSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DragListener(viewer));
- viewer.addDropSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DropListener(viewer, modelProvider.getEditingDomain()));
+ viewer.addDropSupport(ops, new Transfer[] { MemoryTransfer.getInstance() }, new DropListener(viewer,
+ modelProvider.getEditingDomain()));
return viewer;
}
private void registerContributedVirtualEditors() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
- for (IConfigurationElement el : extPoint.getConfigurationElements()) {
+ for (final IConfigurationElement el : extPoint.getConfigurationElements()) {
if (!"virtualeditor".equals(el.getName())) { //$NON-NLS-1$
continue;
}
- IContributionFactory fact = context.get(IContributionFactory.class);
- AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("bundleclass://" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ final IContributionFactory fact = context.get(IContributionFactory.class);
+ final AbstractComponentEditor editor = (AbstractComponentEditor) fact.create(
+ "bundleclass://" + el.getContributor().getName() + "/" + el.getAttribute("class"), context); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
registerVirtualEditor(el.getAttribute("id"), editor); //$NON-NLS-1$
}
}
@@ -1152,24 +1182,36 @@ public class ModelEditor implements IGotoObject {
registerVirtualEditor(VIRTUAL_HANDLER, ContextInjectionFactory.make(VHandlerEditor.class, context));
registerVirtualEditor(VIRTUAL_BINDING_TABLE, ContextInjectionFactory.make(VBindingTableEditor.class, context));
registerVirtualEditor(VIRTUAL_COMMAND, ContextInjectionFactory.make(VCommandEditor.class, context));
- registerVirtualEditor(VIRTUAL_APPLICATION_WINDOWS, ContextInjectionFactory.make(VApplicationWindowEditor.class, context));
+ registerVirtualEditor(VIRTUAL_APPLICATION_WINDOWS,
+ ContextInjectionFactory.make(VApplicationWindowEditor.class, context));
registerVirtualEditor(VIRTUAL_WINDOW_WINDOWS, ContextInjectionFactory.make(VWindowWindowsEditor.class, context));
- registerVirtualEditor(VIRTUAL_PERSPECTIVE_WINDOWS, ContextInjectionFactory.make(VPerspectiveWindowsEditor.class, context));
- registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS, ContextInjectionFactory.make(VWindowControlEditor.class, context));
+ registerVirtualEditor(VIRTUAL_PERSPECTIVE_WINDOWS,
+ ContextInjectionFactory.make(VPerspectiveWindowsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_WINDOW_CONTROLS,
+ ContextInjectionFactory.make(VWindowControlEditor.class, context));
registerVirtualEditor(VIRTUAL_PART_DESCRIPTORS, ContextInjectionFactory.make(VPartDescriptor.class, context));
- registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU, ContextInjectionFactory.make(VPartDescriptorMenuEditor.class, context));
- registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS, ContextInjectionFactory.make(VWindowTrimEditor.class, context));
+ registerVirtualEditor(VIRTUAL_PARTDESCRIPTOR_MENU,
+ ContextInjectionFactory.make(VPartDescriptorMenuEditor.class, context));
+ registerVirtualEditor(VIRTUAL_TRIMMED_WINDOW_TRIMS,
+ ContextInjectionFactory.make(VWindowTrimEditor.class, context));
registerVirtualEditor(VIRTUAL_ADDONS, ContextInjectionFactory.make(VApplicationAddons.class, context));
- registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS, ContextInjectionFactory.make(VMenuContributionsEditor.class, context));
- registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS, ContextInjectionFactory.make(VToolBarContributionsEditor.class, context));
- registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS, ContextInjectionFactory.make(VTrimContributionsEditor.class, context));
- registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS, ContextInjectionFactory.make(VWindowSharedElementsEditor.class, context));
- registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS, ContextInjectionFactory.make(VModelFragmentsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_MENU_CONTRIBUTIONS,
+ ContextInjectionFactory.make(VMenuContributionsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_TOOLBAR_CONTRIBUTIONS,
+ ContextInjectionFactory.make(VToolBarContributionsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_TRIM_CONTRIBUTIONS,
+ ContextInjectionFactory.make(VTrimContributionsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_WINDOW_SHARED_ELEMENTS,
+ ContextInjectionFactory.make(VWindowSharedElementsEditor.class, context));
+ registerVirtualEditor(VIRTUAL_MODEL_FRAGEMENTS,
+ ContextInjectionFactory.make(VModelFragmentsEditor.class, context));
registerVirtualEditor(VIRTUAL_MODEL_IMPORTS, ContextInjectionFactory.make(VModelImportsEditor.class, context));
- registerVirtualEditor(VIRTUAL_CATEGORIES, ContextInjectionFactory.make(VApplicationCategoriesEditor.class, context));
+ registerVirtualEditor(VIRTUAL_CATEGORIES,
+ ContextInjectionFactory.make(VApplicationCategoriesEditor.class, context));
registerVirtualEditor(VIRTUAL_PARAMETERS, ContextInjectionFactory.make(VItemParametersEditor.class, context));
registerVirtualEditor(VIRTUAL_ROOT_CONTEXTS, ContextInjectionFactory.make(VRootBindingContexts.class, context));
- registerVirtualEditor(VIRTUAL_PERSPECTIVE_CONTROLS, ContextInjectionFactory.make(VPerspectiveControlEditor.class, context));
+ registerVirtualEditor(VIRTUAL_PERSPECTIVE_CONTROLS,
+ ContextInjectionFactory.make(VPerspectiveControlEditor.class, context));
registerVirtualEditor(VIRTUAL_SNIPPETS, ContextInjectionFactory.make(VSnippetsEditor.class, context));
}
@@ -1182,30 +1224,31 @@ public class ModelEditor implements IGotoObject {
}
private void registerContributedEditors() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
- for (IConfigurationElement el : extPoint.getConfigurationElements()) {
+ for (final IConfigurationElement el : extPoint.getConfigurationElements()) {
if (!"editor".equals(el.getName())) { //$NON-NLS-1$
continue;
}
try {
- IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$
- EClass eClass = desc.getEClass();
- IContributionFactory fact = context.get(IContributionFactory.class);
- AbstractComponentEditor editor = (AbstractComponentEditor) fact.create("bundleclass://" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$
+ final IEditorDescriptor desc = (IEditorDescriptor) el.createExecutableExtension("descriptorClass"); //$NON-NLS-1$
+ final EClass eClass = desc.getEClass();
+ final IContributionFactory fact = context.get(IContributionFactory.class);
+ final AbstractComponentEditor editor = (AbstractComponentEditor) fact.create(
+ "bundleclass://" + el.getContributor().getName() + "/" + desc.getEditorClass().getName(), context); //$NON-NLS-1$ //$NON-NLS-2$
registerEditor(eClass, editor);
- } catch (CoreException e) {
+ } catch (final CoreException e) {
e.printStackTrace();
}
}
}
private void registerContributedEditorTabs() {
- IExtensionRegistry registry = RegistryFactory.getRegistry();
- IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
- for (IConfigurationElement el : extPoint.getConfigurationElements()) {
+ final IExtensionRegistry registry = RegistryFactory.getRegistry();
+ final IExtensionPoint extPoint = registry.getExtensionPoint("org.eclipse.e4.tools.emf.ui.editors"); //$NON-NLS-1$
+ for (final IConfigurationElement el : extPoint.getConfigurationElements()) {
if (!"editorTab".equals(el.getName())) { //$NON-NLS-1$
continue;
}
@@ -1213,28 +1256,30 @@ public class ModelEditor implements IGotoObject {
try {
final Object o = el.createExecutableExtension("contribution"); //$NON-NLS-1$
if (o instanceof AbstractElementEditorContribution) {
- AbstractElementEditorContribution contribution = (AbstractElementEditorContribution) o;
+ final AbstractElementEditorContribution contribution = (AbstractElementEditorContribution) o;
ContextInjectionFactory.inject(contribution, context);
- Class<?> contribElem = contribution.getContributableTo();
- if (contribElem == null)
+ final Class<?> contribElem = contribution.getContributableTo();
+ if (contribElem == null) {
continue;
+ }
if (!tabContributions.containsKey(contribElem)) {
tabContributions.put(contribElem, new ArrayList<AbstractElementEditorContribution>());
}
- List<AbstractElementEditorContribution> res = tabContributions.get(contribElem);
+ final List<AbstractElementEditorContribution> res = tabContributions.get(contribElem);
res.add(contribution);
}
- } catch (CoreException e) {
+ } catch (final CoreException e) {
e.printStackTrace();
}
}
}
public List<AbstractElementEditorContribution> getTabContributionsForClass(Class<?> clazz) {
- List<AbstractElementEditorContribution> ret = new ArrayList<AbstractElementEditorContribution>();
- for (Class<?> clasz : tabContributions.keySet()) {
- if (clasz.isAssignableFrom(clazz))
+ final List<AbstractElementEditorContribution> ret = new ArrayList<AbstractElementEditorContribution>();
+ for (final Class<?> clasz : tabContributions.keySet()) {
+ if (clasz.isAssignableFrom(clazz)) {
ret.addAll(tabContributions.get(clasz));
+ }
}
return ret;
}
@@ -1242,55 +1287,87 @@ public class ModelEditor implements IGotoObject {
private void registerDefaultEditors() {
System.err.println(getClass().getName() + ".registerDefaultEditors: " + resourcePool); //$NON-NLS-1$
- registerEditor(ApplicationPackageImpl.Literals.APPLICATION, ContextInjectionFactory.make(ApplicationEditor.class, context));
+ registerEditor(ApplicationPackageImpl.Literals.APPLICATION,
+ ContextInjectionFactory.make(ApplicationEditor.class, context));
registerEditor(ApplicationPackageImpl.Literals.ADDON, ContextInjectionFactory.make(AddonsEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.KEY_BINDING, ContextInjectionFactory.make(KeyBindingEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.KEY_BINDING,
+ ContextInjectionFactory.make(KeyBindingEditor.class, context));
registerEditor(CommandsPackageImpl.Literals.HANDLER, ContextInjectionFactory.make(HandlerEditor.class, context));
registerEditor(CommandsPackageImpl.Literals.COMMAND, ContextInjectionFactory.make(CommandEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER, ContextInjectionFactory.make(CommandParameterEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.PARAMETER, ContextInjectionFactory.make(ParameterEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE, ContextInjectionFactory.make(BindingTableEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT, ContextInjectionFactory.make(BindingContextEditor.class, context));
- registerEditor(CommandsPackageImpl.Literals.CATEGORY, ContextInjectionFactory.make(CategoryEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.COMMAND_PARAMETER,
+ ContextInjectionFactory.make(CommandParameterEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.PARAMETER,
+ ContextInjectionFactory.make(ParameterEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.BINDING_TABLE,
+ ContextInjectionFactory.make(BindingTableEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.BINDING_CONTEXT,
+ ContextInjectionFactory.make(BindingContextEditor.class, context));
+ registerEditor(CommandsPackageImpl.Literals.CATEGORY,
+ ContextInjectionFactory.make(CategoryEditor.class, context));
registerEditor(MenuPackageImpl.Literals.TOOL_BAR, ContextInjectionFactory.make(ToolBarEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, ContextInjectionFactory.make(DirectToolItemEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, ContextInjectionFactory.make(HandledToolItemEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, ContextInjectionFactory.make(ToolBarSeparatorEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL, ContextInjectionFactory.make(ToolControlEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM,
+ ContextInjectionFactory.make(DirectToolItemEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM,
+ ContextInjectionFactory.make(HandledToolItemEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR,
+ ContextInjectionFactory.make(ToolBarSeparatorEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.TOOL_CONTROL,
+ ContextInjectionFactory.make(ToolControlEditor.class, context));
registerEditor(MenuPackageImpl.Literals.MENU, ContextInjectionFactory.make(MenuEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.POPUP_MENU, ContextInjectionFactory.make(PopupMenuEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR, ContextInjectionFactory.make(MenuSeparatorEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, ContextInjectionFactory.make(HandledMenuItemEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, ContextInjectionFactory.make(DirectMenuItemEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION, ContextInjectionFactory.make(MenuContributionEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION, ContextInjectionFactory.make(ToolBarContributionEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION, ContextInjectionFactory.make(TrimContributionEditor.class, context));
- registerEditor(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, ContextInjectionFactory.make(DynamicMenuContributionEditor.class, context));
-
- registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION, ContextInjectionFactory.make(CoreExpressionEditor.class, context));
-
- registerEditor(BasicPackageImpl.Literals.COMPOSITE_PART, ContextInjectionFactory.make(CompositePartEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.POPUP_MENU,
+ ContextInjectionFactory.make(PopupMenuEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.MENU_SEPARATOR,
+ ContextInjectionFactory.make(MenuSeparatorEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.HANDLED_MENU_ITEM,
+ ContextInjectionFactory.make(HandledMenuItemEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.DIRECT_MENU_ITEM,
+ ContextInjectionFactory.make(DirectMenuItemEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.MENU_CONTRIBUTION,
+ ContextInjectionFactory.make(MenuContributionEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION,
+ ContextInjectionFactory.make(ToolBarContributionEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.TRIM_CONTRIBUTION,
+ ContextInjectionFactory.make(TrimContributionEditor.class, context));
+ registerEditor(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION,
+ ContextInjectionFactory.make(DynamicMenuContributionEditor.class, context));
+
+ registerEditor(UiPackageImpl.Literals.CORE_EXPRESSION,
+ ContextInjectionFactory.make(CoreExpressionEditor.class, context));
+
+ registerEditor(BasicPackageImpl.Literals.COMPOSITE_PART,
+ ContextInjectionFactory.make(CompositePartEditor.class, context));
registerEditor(BasicPackageImpl.Literals.PART, ContextInjectionFactory.make(PartEditor.class, context));
registerEditor(BasicPackageImpl.Literals.WINDOW, ContextInjectionFactory.make(WindowEditor.class, context));
- registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW, ContextInjectionFactory.make(TrimmedWindowEditor.class, context));
- registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER, ContextInjectionFactory.make(PartSashContainerEditor.class, context));
+ registerEditor(BasicPackageImpl.Literals.TRIMMED_WINDOW,
+ ContextInjectionFactory.make(TrimmedWindowEditor.class, context));
+ registerEditor(BasicPackageImpl.Literals.PART_SASH_CONTAINER,
+ ContextInjectionFactory.make(PartSashContainerEditor.class, context));
registerEditor(AdvancedPackageImpl.Literals.AREA, ContextInjectionFactory.make(AreaEditor.class, context));
- registerEditor(BasicPackageImpl.Literals.PART_STACK, ContextInjectionFactory.make(PartStackEditor.class, context));
+ registerEditor(BasicPackageImpl.Literals.PART_STACK,
+ ContextInjectionFactory.make(PartStackEditor.class, context));
registerEditor(BasicPackageImpl.Literals.TRIM_BAR, ContextInjectionFactory.make(TrimBarEditor.class, context));
registerEditor(BasicPackageImpl.Literals.DIALOG, ContextInjectionFactory.make(DialogEditor.class, context));
- registerEditor(BasicPackageImpl.Literals.WIZARD_DIALOG, ContextInjectionFactory.make(WizardDialogEditor.class, context));
-
- registerEditor(org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR, ContextInjectionFactory.make(PartDescriptorEditor.class, context));
-
- registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK, ContextInjectionFactory.make(PerspectiveStackEditor.class, context));
- registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE, ContextInjectionFactory.make(PerspectiveEditor.class, context));
- registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER, ContextInjectionFactory.make(PlaceholderEditor.class, context));
-
- registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS, ContextInjectionFactory.make(ModelFragmentsEditor.class, context));
- registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT, ContextInjectionFactory.make(StringModelFragment.class, context));
+ registerEditor(BasicPackageImpl.Literals.WIZARD_DIALOG,
+ ContextInjectionFactory.make(WizardDialogEditor.class, context));
+
+ registerEditor(
+ org.eclipse.e4.ui.model.application.descriptor.basic.impl.BasicPackageImpl.Literals.PART_DESCRIPTOR,
+ ContextInjectionFactory.make(PartDescriptorEditor.class, context));
+
+ registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE_STACK,
+ ContextInjectionFactory.make(PerspectiveStackEditor.class, context));
+ registerEditor(AdvancedPackageImpl.Literals.PERSPECTIVE,
+ ContextInjectionFactory.make(PerspectiveEditor.class, context));
+ registerEditor(AdvancedPackageImpl.Literals.PLACEHOLDER,
+ ContextInjectionFactory.make(PlaceholderEditor.class, context));
+
+ registerEditor(FragmentPackageImpl.Literals.MODEL_FRAGMENTS,
+ ContextInjectionFactory.make(ModelFragmentsEditor.class, context));
+ registerEditor(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT,
+ ContextInjectionFactory.make(StringModelFragment.class, context));
}
public void tab_list_show(Boolean show) {
@@ -1306,7 +1383,7 @@ public class ModelEditor implements IGotoObject {
}
} else {
if (listTab == null) {
- IEclipseContext child = context.createChild();
+ final IEclipseContext child = context.createChild();
child.set(CTabFolder.class, editorTabFolder);
child.set(EMFDocumentResourceMediator.class, emfDocumentProvider);
child.set(IGotoObject.class, this);
@@ -1319,10 +1396,11 @@ public class ModelEditor implements IGotoObject {
@Inject
public void setNotVisibleColor(@Preference(ModelEditorPreferences.NOT_VISIBLE_COLOR) String color) {
- RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_KEY);
+ final RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_KEY);
if (current == null || !current.equals(color)) {
- JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200)));
+ JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_KEY,
+ StringConverter.asRGB(color, new RGB(200, 200, 200)));
}
if (viewer != null) {
@@ -1333,10 +1411,11 @@ public class ModelEditor implements IGotoObject {
@Inject
public void setNotRenderedColor(@Preference(ModelEditorPreferences.NOT_RENDERED_COLOR) String color) {
- RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_RENDERED_KEY);
+ final RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_RENDERED_KEY);
if (current == null || !current.equals(color)) {
- JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_RENDERED_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200)));
+ JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_RENDERED_KEY,
+ StringConverter.asRGB(color, new RGB(200, 200, 200)));
}
if (viewer != null) {
@@ -1346,11 +1425,14 @@ public class ModelEditor implements IGotoObject {
}
@Inject
- public void setNotVisibleRenderedColor(@Preference(ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR) String color) {
- RGB current = JFaceResources.getColorRegistry().getRGB(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY);
+ public void setNotVisibleRenderedColor(
+ @Preference(ModelEditorPreferences.NOT_VISIBLE_AND_RENDERED_COLOR) String color) {
+ final RGB current = JFaceResources.getColorRegistry().getRGB(
+ ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY);
if (current == null || !current.equals(color)) {
- JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY, StringConverter.asRGB(color, new RGB(200, 200, 200)));
+ JFaceResources.getColorRegistry().put(ComponentLabelProvider.NOT_VISIBLE_AND_RENDERED_KEY,
+ StringConverter.asRGB(color, new RGB(200, 200, 200)));
}
if (viewer != null) {
@@ -1362,9 +1444,9 @@ public class ModelEditor implements IGotoObject {
public void registerEditor(EClass eClass, AbstractComponentEditor editor) {
editorMap.put(eClass, editor);
- for (FeaturePath p : editor.getLabelProperties()) {
+ for (final FeaturePath p : editor.getLabelProperties()) {
boolean found = false;
- for (FeaturePath tmp : labelFeaturePaths) {
+ for (final FeaturePath tmp : labelFeaturePaths) {
if (equalsPaths(p, tmp)) {
found = true;
break;
@@ -1394,14 +1476,15 @@ public class ModelEditor implements IGotoObject {
public AbstractComponentEditor getEditor(EClass eClass) {
AbstractComponentEditor editor = editorMap.get(eClass);
if (editor == null) {
- for (EClass cl : eClass.getESuperTypes()) {
+ for (final EClass cl : eClass.getESuperTypes()) {
editor = getEditor(cl);
if (editor != null) {
return editor;
}
}
- if (editor == null)
+ if (editor == null) {
editor = ContextInjectionFactory.make(DefaultEditor.class, context);
+ }
}
return editor;
}
@@ -1446,7 +1529,7 @@ public class ModelEditor implements IGotoObject {
void dispose() {
try {
obsManager.dispose();
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
@@ -1477,7 +1560,7 @@ public class ModelEditor implements IGotoObject {
@SuppressWarnings("unchecked")
private void handleStructurePaste() {
- Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
+ final Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
Object o = clip.getContents(MemoryTransfer.getInstance());
clip.dispose();
if (o == null) {
@@ -1486,12 +1569,12 @@ public class ModelEditor implements IGotoObject {
o = EcoreUtil.copy((EObject) o);
- Object parent = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
+ final Object parent = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
EStructuralFeature feature = null;
EObject container = null;
if (parent instanceof VirtualEntry<?>) {
- VirtualEntry<?> v = (VirtualEntry<?>) parent;
+ final VirtualEntry<?> v = (VirtualEntry<?>) parent;
feature = ((IEMFProperty) v.getProperty()).getStructuralFeature();
container = (EObject) v.getOriginalParent();
} else {
@@ -1500,9 +1583,9 @@ public class ModelEditor implements IGotoObject {
container = (EObject) parent;
} else if (parent instanceof EObject) {
container = (EObject) parent;
- EClass eClass = container.eClass();
+ final EClass eClass = container.eClass();
- for (EStructuralFeature f : eClass.getEAllStructuralFeatures()) {
+ for (final EStructuralFeature f : eClass.getEAllStructuralFeatures()) {
if (ModelUtils.getTypeArgument(eClass, f.getEGenericType()).isInstance(o)) {
feature = f;
break;
@@ -1512,9 +1595,9 @@ public class ModelEditor implements IGotoObject {
}
if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && container != null) {
- MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) o).eClass());
+ final MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) o).eClass());
el.setElementId(((MApplicationElement) o).getElementId());
- Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, el);
+ final Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, el);
if (cmd.canExecute()) {
getModelProvider().getEditingDomain().getCommandStack().execute(cmd);
}
@@ -1522,7 +1605,7 @@ public class ModelEditor implements IGotoObject {
}
if (feature != null && container != null) {
- Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o);
+ final Command cmd = AddCommand.create(getModelProvider().getEditingDomain(), container, feature, o);
if (cmd.canExecute()) {
getModelProvider().getEditingDomain().getCommandStack().execute(cmd);
if (isLiveModel()) {
@@ -1548,10 +1631,11 @@ public class ModelEditor implements IGotoObject {
}
private void handleStructureCopy() {
- Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
+ final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
if (o != null && o instanceof EObject) {
- Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
- clip.setContents(new Object[] { EcoreUtil.copy((EObject) o) }, new Transfer[] { MemoryTransfer.getInstance() });
+ final Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
+ clip.setContents(new Object[] { EcoreUtil.copy((EObject) o) },
+ new Transfer[] { MemoryTransfer.getInstance() });
clip.dispose();
}
}
@@ -1570,13 +1654,14 @@ public class ModelEditor implements IGotoObject {
}
private void handleStructureCut() {
- Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
+ final Object o = ((IStructuredSelection) viewer.getSelection()).getFirstElement();
if (o != null && o instanceof EObject) {
- Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
+ final Clipboard clip = new Clipboard(viewer.getControl().getDisplay());
clip.setContents(new Object[] { o }, new Transfer[] { MemoryTransfer.getInstance() });
clip.dispose();
- EObject eObj = (EObject) o;
- Command cmd = RemoveCommand.create(getModelProvider().getEditingDomain(), eObj.eContainer(), eObj.eContainingFeature(), eObj);
+ final EObject eObj = (EObject) o;
+ final Command cmd = RemoveCommand.create(getModelProvider().getEditingDomain(), eObj.eContainer(),
+ eObj.eContainingFeature(), eObj);
if (cmd.canExecute()) {
getModelProvider().getEditingDomain().getCommandStack().execute(cmd);
}
@@ -1593,7 +1678,7 @@ public class ModelEditor implements IGotoObject {
} else if (target instanceof VirtualEntry<?>) {
return ((VirtualEntry<?>) target).getList();
} else {
- AbstractComponentEditor editor = getEditor(((EObject) target).eClass());
+ final AbstractComponentEditor editor = getEditor(((EObject) target).eClass());
if (editor != null) {
return editor.getChildList(target);
}
@@ -1612,19 +1697,19 @@ public class ModelEditor implements IGotoObject {
@Override
public void dragStart(DragSourceEvent event) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
event.doit = !selection.isEmpty() && selection.getFirstElement() instanceof MApplicationElement;
}
@Override
public void dragSetData(DragSourceEvent event) {
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+ final IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
event.data = selection.toArray();
}
}
class DropListener extends ViewerDropAdapter {
- private EditingDomain domain;
+ private final EditingDomain domain;
protected DropListener(Viewer viewer, EditingDomain domain) {
super(viewer);
@@ -1633,11 +1718,12 @@ public class ModelEditor implements IGotoObject {
@Override
public boolean performDrop(Object data) {
- Object[] dropDataArray = (Object[]) data;
- for (Object object : dropDataArray) {
- boolean result = performSingleDrop(object);
- if (!result)
+ final Object[] dropDataArray = (Object[]) data;
+ for (final Object object : dropDataArray) {
+ final boolean result = performSingleDrop(object);
+ if (!result) {
return false;
+ }
}
return true;
}
@@ -1651,8 +1737,8 @@ public class ModelEditor implements IGotoObject {
feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN;
parent = (EObject) getCurrentTarget();
} else if (getCurrentTarget() instanceof VirtualEntry<?>) {
- VirtualEntry<?> entry = (VirtualEntry<?>) getCurrentTarget();
- IListProperty prop = entry.getProperty();
+ final VirtualEntry<?> entry = (VirtualEntry<?>) getCurrentTarget();
+ final IListProperty prop = entry.getProperty();
if (prop instanceof IEMFProperty) {
feature = ((IEMFProperty) prop).getStructuralFeature();
parent = (EObject) entry.getOriginalParent();
@@ -1660,8 +1746,8 @@ public class ModelEditor implements IGotoObject {
}
} else if (getCurrentTarget() instanceof EObject) {
parent = (EObject) getCurrentTarget();
- for (EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) {
- EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType());
+ for (final EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) {
+ final EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType());
if (cl.isInstance(data)) {
feature = f;
break;
@@ -1670,7 +1756,7 @@ public class ModelEditor implements IGotoObject {
}
if (feature != null && parent != null) {
- Command cmd = AddCommand.create(domain, parent, feature, data);
+ final Command cmd = AddCommand.create(domain, parent, feature, data);
if (cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
if (isLiveModel()) {
@@ -1685,12 +1771,12 @@ public class ModelEditor implements IGotoObject {
EStructuralFeature feature = null;
EObject parent = null;
- TreeItem item = (TreeItem) getCurrentEvent().item;
+ final TreeItem item = (TreeItem) getCurrentEvent().item;
if (item != null) {
- TreeItem parentItem = item.getParentItem();
+ final TreeItem parentItem = item.getParentItem();
if (item != null) {
if (parentItem.getData() instanceof VirtualEntry<?>) {
- VirtualEntry<?> vE = (VirtualEntry<?>) parentItem.getData();
+ final VirtualEntry<?> vE = (VirtualEntry<?>) parentItem.getData();
parent = (EObject) vE.getOriginalParent();
feature = ((IEMFProperty) vE.getProperty()).getStructuralFeature();
} else if (parentItem.getData() instanceof MElementContainer<?>) {
@@ -1698,8 +1784,8 @@ public class ModelEditor implements IGotoObject {
feature = UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN;
} else if (parentItem.getData() instanceof EObject) {
parent = (EObject) parentItem.getData();
- for (EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) {
- EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType());
+ for (final EStructuralFeature f : parent.eClass().getEAllStructuralFeatures()) {
+ final EClassifier cl = ModelUtils.getTypeArgument(parent.eClass(), f.getEGenericType());
if (cl.isInstance(data)) {
feature = f;
break;
@@ -1710,9 +1796,9 @@ public class ModelEditor implements IGotoObject {
}
if (feature == FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS && parent != null) {
- MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) data).eClass());
+ final MApplicationElement el = (MApplicationElement) EcoreUtil.create(((EObject) data).eClass());
el.setElementId(((MApplicationElement) data).getElementId());
- Command cmd = AddCommand.create(domain, parent, feature, el);
+ final Command cmd = AddCommand.create(domain, parent, feature, el);
if (cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
}
@@ -1720,7 +1806,7 @@ public class ModelEditor implements IGotoObject {
}
if (feature != null && parent != null && parent.eGet(feature) instanceof List<?>) {
- List<Object> list = (List<Object>) parent.eGet(feature);
+ final List<Object> list = (List<Object>) parent.eGet(feature);
int index = list.indexOf(getCurrentTarget());
if (index >= list.size()) {
@@ -1731,7 +1817,7 @@ public class ModelEditor implements IGotoObject {
if (parent instanceof MElementContainer<?> && data instanceof MUIElement) {
Util.moveElementByIndex(domain, (MUIElement) data, isLiveModel(), index);
} else {
- Command cmd = MoveCommand.create(domain, parent, feature, data, index);
+ final Command cmd = MoveCommand.create(domain, parent, feature, data, index);
if (cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
return true;
@@ -1743,7 +1829,7 @@ public class ModelEditor implements IGotoObject {
data = EcoreUtil.copy((EObject) data);
}
- Command cmd = AddCommand.create(domain, parent, feature, data, index);
+ final Command cmd = AddCommand.create(domain, parent, feature, data, index);
if (cmd.canExecute()) {
domain.getCommandStack().execute(cmd);
if (isLiveModel()) {
@@ -1784,28 +1870,31 @@ public class ModelEditor implements IGotoObject {
private boolean isValidDrop(Object target, MApplicationElement instance, boolean isIndex) {
if (target instanceof MElementContainer<?>) {
@SuppressWarnings("unchecked")
- MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) target;
+ final MElementContainer<MUIElement> container = (MElementContainer<MUIElement>) target;
if (isIndex || !container.getChildren().contains(instance)) {
- EClassifier classifier = ModelUtils.getTypeArgument(((EObject) container).eClass(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN.getEGenericType());
+ final EClassifier classifier = ModelUtils.getTypeArgument(((EObject) container).eClass(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN.getEGenericType());
return classifier.isInstance(instance);
}
} else if (target instanceof VirtualEntry<?>) {
@SuppressWarnings("unchecked")
- VirtualEntry<Object> vTarget = (VirtualEntry<Object>) target;
+ final VirtualEntry<Object> vTarget = (VirtualEntry<Object>) target;
if (isIndex || !vTarget.getList().contains(instance)) {
if (vTarget.getProperty() instanceof IEMFProperty) {
- EStructuralFeature feature = ((IEMFProperty) vTarget.getProperty()).getStructuralFeature();
- EObject parent = (EObject) vTarget.getOriginalParent();
- EClassifier classifier = ModelUtils.getTypeArgument(parent.eClass(), feature.getEGenericType());
+ final EStructuralFeature feature = ((IEMFProperty) vTarget.getProperty())
+ .getStructuralFeature();
+ final EObject parent = (EObject) vTarget.getOriginalParent();
+ final EClassifier classifier = ModelUtils.getTypeArgument(parent.eClass(),
+ feature.getEGenericType());
return classifier.isInstance(instance);
}
}
} else if (target instanceof EObject) {
- EObject eObj = (EObject) target;
- for (EStructuralFeature f : eObj.eClass().getEAllStructuralFeatures()) {
- EClassifier cl = ModelUtils.getTypeArgument(eObj.eClass(), f.getEGenericType());
+ final EObject eObj = (EObject) target;
+ for (final EStructuralFeature f : eObj.eClass().getEAllStructuralFeatures()) {
+ final EClassifier cl = ModelUtils.getTypeArgument(eObj.eClass(), f.getEGenericType());
if (cl.isInstance(instance)) {
return true;
}
@@ -1824,7 +1913,8 @@ public class ModelEditor implements IGotoObject {
switch (targetHint) {
case TAB_FORM:
// make sure tree node has been instantiated
- ObservableListTreeContentProvider provider = (ObservableListTreeContentProvider) viewer.getContentProvider();
+ final ObservableListTreeContentProvider provider = (ObservableListTreeContentProvider) viewer
+ .getContentProvider();
getFirstMatchingItem(object, provider, provider.getChildren(viewer.getInput()));
viewer.reveal(object);
@@ -1839,7 +1929,7 @@ public class ModelEditor implements IGotoObject {
try {
xmiTab.gotoEObject(object);
- } catch (Exception e) {
+ } catch (final Exception e) {
e.printStackTrace();
}
break;
@@ -1863,7 +1953,7 @@ public class ModelEditor implements IGotoObject {
if (items[i] == target) {
return items[i];
}
- Object found = getFirstMatchingItem(target, provider, provider.getChildren(items[i]));
+ final Object found = getFirstMatchingItem(target, provider, provider.getChildren(items[i]));
if (found != null) {
return found;
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
index e5b7a76f..a4168da6 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/AddonsEditor.java
@@ -58,7 +58,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class AddonsEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
@@ -158,7 +157,7 @@ public class AddonsEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
final Link lnk;
// ------------------------------------------------------------
{
@@ -198,8 +197,8 @@ public class AddonsEditor extends AbstractComponentEditor {
textProp.observeDelayed(200, t),
EMFEditProperties.value(getEditingDomain(),
ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()),
- new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
- new UpdateValueStrategy());
+ new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
+ new UpdateValueStrategy());
Util.addDecoration(t, binding);
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java
index 72e4bd40..7ec370f3 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ApplicationEditor.java
@@ -84,7 +84,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class ApplicationEditor extends AbstractComponentEditor {
private Composite composite;
@@ -199,7 +198,7 @@ public class ApplicationEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.ApplicationEditor_BindingContexts);
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 006c99be..dea1d51b 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
@@ -81,7 +81,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class AreaEditor extends AbstractComponentEditor {
private Composite composite;
@@ -233,7 +232,7 @@ public class AreaEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
ControlFactory.createTextField(parent, Messages.AreaEditor_LabelLabel, master, context, textProp,
EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL));
ControlFactory.createTextField(parent, Messages.AreaEditor_Tooltip, master, context, textProp,
@@ -302,7 +301,7 @@ public class AreaEditor extends AbstractComponentEditor {
final IViewerValueProperty vProp = ViewerProperties.singleSelection();
context.bindValue(vProp.observe(viewer),
EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL)
- .observeDetail(getMaster()));
+ .observeDetail(getMaster()));
}
ControlFactory.createSelectedElement(parent, this, context, Messages.AreaEditor_SelectedElement);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java
index 453c2ef4..b036df18 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingContextEditor.java
@@ -53,7 +53,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-@SuppressWarnings("restriction")
public class BindingContextEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
@@ -170,7 +169,7 @@ public class BindingContextEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
ControlFactory.createTextField(parent, Messages.BindingContextEditor_Name, master, context, textProp,
EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.BINDING_CONTEXT__NAME),
Messages.BindingContextEditor_NameWarning);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java
index 025f10ee..68f99664 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/BindingTableEditor.java
@@ -62,7 +62,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class BindingTableEditor extends AbstractComponentEditor {
private Composite composite;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java
index 6e8078b3..147b1d21 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CategoryEditor.java
@@ -36,7 +36,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
-@SuppressWarnings("restriction")
public class CategoryEditor extends AbstractComponentEditor {
private Composite composite;
@@ -127,7 +126,7 @@ public class CategoryEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
ControlFactory.createTextField(parent, Messages.CategoryEditor_Name, master, context, textProp,
EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.CATEGORY__NAME));
ControlFactory.createTextField(parent, Messages.CategoryEditor_Description, master, context, textProp,
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
index b7e53422..c5645349 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandEditor.java
@@ -60,7 +60,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class CommandEditor extends AbstractComponentEditor {
private Composite composite;
@@ -165,7 +164,7 @@ public class CommandEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id,
Messages.ModelTooling_CommandId_tooltip, master, context, textProp, EMFEditProperties.value(
getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID),
- Messages.ModelTooling_Empty_Warning);
+ Messages.ModelTooling_Empty_Warning);
ControlFactory.createTextField(parent, Messages.CommandEditor_Name, master, context, textProp,
EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND__COMMAND_NAME));
ControlFactory.createTextField(parent, Messages.CommandEditor_LabelDescription, master, context, textProp,
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java
index b25b4735..3db9f0a8 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CommandParameterEditor.java
@@ -40,7 +40,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-@SuppressWarnings("restriction")
public class CommandParameterEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
@@ -140,7 +139,7 @@ public class CommandParameterEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID),
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID),
Messages.ModelTooling_Empty_Warning);
ControlFactory.createTextField(parent, Messages.CommandParameterEditor_Name, master, context, textProp,
EMFEditProperties.value(getEditingDomain(), CommandsPackageImpl.Literals.COMMAND_PARAMETER__NAME),
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java
index 176383c8..ca2c9060 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CompositePartEditor.java
@@ -78,7 +78,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class CompositePartEditor extends AbstractComponentEditor {
private Composite composite;
@@ -154,17 +153,17 @@ public class CompositePartEditor extends AbstractComponentEditor {
// --- Import Actions ---
actionsImport.add(new Action("Views", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$
- @Override
- public void run() {
- handleImportChild(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_VIEW);
- }
- });
+ @Override
+ public void run() {
+ handleImportChild(BasicPackageImpl.Literals.PART, RegistryUtil.HINT_VIEW);
+ }
+ });
actionsImport.add(new Action("Editors", createImageDescriptor(ResourceProvider.IMG_Part)) { //$NON-NLS-1$
- @Override
- public void run() {
- handleImportChild(BasicPackageImpl.Literals.INPUT_PART, RegistryUtil.HINT_EDITOR);
- }
- });
+ @Override
+ public void run() {
+ handleImportChild(BasicPackageImpl.Literals.INPUT_PART, RegistryUtil.HINT_EDITOR);
+ }
+ });
}
@@ -257,7 +256,7 @@ public class CompositePartEditor extends AbstractComponentEditor {
ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
EMFEditProperties
- .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
context, textProp,
EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
@@ -330,7 +329,7 @@ public class CompositePartEditor extends AbstractComponentEditor {
final IViewerValueProperty vProp = ViewerProperties.singleSelection();
context.bindValue(vProp.observe(viewer),
EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL)
- .observeDetail(getMaster()));
+ .observeDetail(getMaster()));
}
ControlFactory.createSelectedElement(parent, this, context, Messages.CompositePartEditor_SelectedElement);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
index 2930a6e8..d7766c13 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ControlFactory.java
@@ -107,7 +107,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class ControlFactory {
public static final String COPY_HANDLER = ControlFactory.class.getName() + ".COPY_HANDLER"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java
index f0f21c6d..0c81147f 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/CoreExpressionEditor.java
@@ -39,7 +39,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class CoreExpressionEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
@@ -111,7 +110,7 @@ public class CoreExpressionEditor extends AbstractComponentEditor {
t.setLayoutData(gd);
context.bindValue(textProp.observeDelayed(200, t),
EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.CORE_EXPRESSION__CORE_EXPRESSION_ID)
- .observeDetail(getMaster()));
+ .observeDetail(getMaster()));
if (getEditor().getExtensionLookup() == null) {
gd.horizontalSpan = 2;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
index 1b24c05f..4298b057 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectMenuItemEditor.java
@@ -58,7 +58,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class DirectMenuItemEditor extends MenuItemEditor {
private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties
.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
@@ -162,8 +161,8 @@ public class DirectMenuItemEditor extends MenuItemEditor {
textProp.observeDelayed(200, t),
EMFEditProperties.value(getEditingDomain(),
ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master),
- new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
- new UpdateValueStrategy());
+ new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
+ new UpdateValueStrategy());
Util.addDecoration(t, binding);
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
index a36a712e..ffe3a7eb 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DirectToolItemEditor.java
@@ -57,7 +57,6 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Text;
-@SuppressWarnings("restriction")
public class DirectToolItemEditor extends ToolItemEditor {
private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties
.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
@@ -121,8 +120,8 @@ public class DirectToolItemEditor extends ToolItemEditor {
});
final Binding binding = context.bindValue(textProp.observeDelayed(200, t),
EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI)
- .observeDetail(master), new UpdateValueStrategy()
- .setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
+ .observeDetail(master), new UpdateValueStrategy()
+ .setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
Util.addDecoration(t, binding);
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
index fa879a23..216c817d 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/DynamicMenuContributionEditor.java
@@ -6,13 +6,14 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Marco Descher <marco@descher.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Bug 424730
+ * Marco Descher <marco@descher.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 424730
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -90,9 +91,8 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
if (element instanceof MUIElement) {
if (((MUIElement) element).isToBeRendered()) {
return createImage(ResourceProvider.IMG_DynamicMenuContribution);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_DynamicMenuContribution);
}
+ return createImage(ResourceProvider.IMG_Tbr_DynamicMenuContribution);
}
return null;
@@ -136,10 +136,11 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
return composite;
}
- private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
parent = createScrollableContainer(folder);
@@ -149,7 +150,7 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -157,13 +158,18 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTranslatedTextField(parent, Messages.DynamicMenuContributionEditor_LabelLabel, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTranslatedTextField(parent, Messages.DynamicMenuContributionEditor_LabelLabel,
+ getMaster(), context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
// ------------------------------------------------------------
final Link lnk;
{
- final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION);
+ final IContributionClassCreator c = getEditor().getContributionCreator(
+ MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION);
if (project != null && c != null) {
lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.DynamicMenuContributionEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
@@ -171,17 +177,18 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
lnk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, lnk.getShell());
+ c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project,
+ lnk.getShell());
}
});
} else {
lnk = null;
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.DynamicMenuContributionEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t.addModifyListener(new ModifyListener() {
@@ -189,11 +196,16 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
@Override
public void modifyText(ModifyEvent e) {
if (lnk != null) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ lnk.setToolTipText(((Text) e.getSource()).getText());
}
}
});
- Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
+ final Binding binding = context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(getMaster()),
+ new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
+ new UpdateValueStrategy());
Util.addDecoration(t, binding);
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
@@ -203,7 +215,9 @@ public class DynamicMenuContributionEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
+ final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext,
+ getEditingDomain(), (MContribution) getMaster().getValue(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
dialog.open();
}
});
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java
index ac3297d0..c60364c1 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledMenuItemEditor.java
@@ -6,11 +6,12 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
@@ -50,8 +51,10 @@ import org.eclipse.swt.widgets.Text;
public class HandledMenuItemEditor extends MenuItemEditor {
- private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS);
- private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
+ private final IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(),
+ MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS);
+ private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties
+ .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
@Inject
private IModelResource resource;
@@ -64,12 +67,11 @@ public class HandledMenuItemEditor extends MenuItemEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_HandledMenuItem);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_HandledMenuItem);
}
+ return createImage(ResourceProvider.IMG_Tbr_HandledMenuItem);
}
return null;
@@ -87,19 +89,22 @@ public class HandledMenuItemEditor extends MenuItemEditor {
@Override
protected void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, final WritableValue master) {
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.HandledMenuItemEditor_Command);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t.setEditable(false);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages)));
+ context.bindValue(textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND)
+ .observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy()
+ .setConverter(new CommandToStringConverter(Messages)));
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
@@ -108,7 +113,8 @@ public class HandledMenuItemEditor extends MenuItemEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource, Messages);
+ final HandledMenuItemCommandSelectionDialog dialog = new HandledMenuItemCommandSelectionDialog(b
+ .getShell(), (MHandledItem) getMaster().getValue(), resource, Messages);
dialog.open();
}
});
@@ -137,7 +143,8 @@ public class HandledMenuItemEditor extends MenuItemEditor {
}
});
- list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, Messages.HandledMenuItemEditor_Parameters) {
+ list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element,
+ Messages.HandledMenuItemEditor_Parameters) {
@Override
protected boolean accepted(MParameter o) {
return true;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java
index 9234824b..0110964f 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/HandledToolItemEditor.java
@@ -6,11 +6,12 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
@@ -49,8 +50,10 @@ import org.eclipse.swt.widgets.Text;
public class HandledToolItemEditor extends ToolItemEditor {
- private IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS);
- private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
+ private final IEMFEditListProperty HANDLED_ITEM__PARAMETERS = EMFEditProperties.list(getEditingDomain(),
+ MenuPackageImpl.Literals.HANDLED_ITEM__PARAMETERS);
+ private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties
+ .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
@Inject
private IModelResource resource;
@@ -63,12 +66,11 @@ public class HandledToolItemEditor extends ToolItemEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_HandledToolItem);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_HandledToolItem);
}
+ return createImage(ResourceProvider.IMG_Tbr_HandledToolItem);
}
return null;
@@ -76,18 +78,21 @@ public class HandledToolItemEditor extends ToolItemEditor {
@Override
protected void createSubTypeFormElements(Composite parent, EMFDataBindingContext context, final WritableValue master) {
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.HandledToolItemEditor_Command);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t.setEditable(false);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND).observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy().setConverter(new CommandToStringConverter(Messages)));
+ context.bindValue(textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.HANDLED_ITEM__COMMAND)
+ .observeDetail(master), new UpdateValueStrategy(), new UpdateValueStrategy()
+ .setConverter(new CommandToStringConverter(Messages)));
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
@@ -96,7 +101,8 @@ public class HandledToolItemEditor extends ToolItemEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b.getShell(), (MHandledItem) getMaster().getValue(), resource, Messages);
+ final HandledToolItemCommandSelectionDialog dialog = new HandledToolItemCommandSelectionDialog(b
+ .getShell(), (MHandledItem) getMaster().getValue(), resource, Messages);
dialog.open();
}
});
@@ -136,7 +142,8 @@ public class HandledToolItemEditor extends ToolItemEditor {
}
});
- list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element, Messages.HandledToolItemEditor_Parameters) {
+ list.add(new VirtualEntry<MParameter>(ModelEditor.VIRTUAL_PARAMETERS, HANDLED_ITEM__PARAMETERS, element,
+ Messages.HandledToolItemEditor_Parameters) {
@Override
protected boolean accepted(MParameter o) {
return true;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java
index c71c83e0..2f16ac52 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuContributionEditor.java
@@ -6,18 +6,20 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Marco Descher <marco@descher.at> - Bug 397650, Bug 395982, Bug 396975
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 397650, Bug 395982, Bug 396975
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -71,9 +73,10 @@ public class MenuContributionEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
private IModelResource resource;
@@ -88,7 +91,8 @@ public class MenuContributionEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) {
+ actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem,
+ createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
@@ -100,19 +104,22 @@ public class MenuContributionEditor extends AbstractComponentEditor {
handleAdd(MenuPackageImpl.Literals.MENU, false);
}
});
- actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) {
+ actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem,
+ createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false);
}
});
- actions.add(new Action(Messages.MenuEditor_AddSeparator, createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) {
+ actions.add(new Action(Messages.MenuEditor_AddSeparator,
+ createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true);
}
});
- actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution, createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) {
+ actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution,
+ createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false);
@@ -125,9 +132,8 @@ public class MenuContributionEditor extends AbstractComponentEditor {
if (element instanceof MUIElement) {
if (((MUIElement) element).isToBeRendered()) {
return createImage(ResourceProvider.IMG_MenuContribution);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_MenuContribution);
}
+ return createImage(ResourceProvider.IMG_Tbr_MenuContribution);
}
return null;
@@ -182,7 +188,7 @@ public class MenuContributionEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -194,7 +200,7 @@ public class MenuContributionEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -202,46 +208,58 @@ public class MenuContributionEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuContributionEditor_ParentId);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
t.setLayoutData(gd);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID).observeDetail(getMaster()));
+ context.bindValue(textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID)
+ .observeDetail(getMaster()));
- Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
+ final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom));
b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MenuIdDialog dialog = new MenuIdDialog(t.getShell(), resource, (MMenuContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
+ final MenuIdDialog dialog = new MenuIdDialog(t.getShell(), resource,
+ (MMenuContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
dialog.open();
}
});
}
- ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT));
+ ControlFactory
+ .createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(),
+ MenuPackageImpl.Literals.MENU_CONTRIBUTION__POSITION_IN_PARENT));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
- EClass eClass = struct.eClass;
- MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
+ final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
+ final EClass eClass = struct.eClass;
+ final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -255,17 +273,32 @@ public class MenuContributionEditor extends AbstractComponentEditor {
pickList.setText(Messages.MenuContributionEditor_MenuItems);
final TableViewer viewer = pickList.getList();
- IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(master));
- Struct defaultStruct = new Struct(Messages.MenuContributionEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
- pickList.setInput(new Struct[] { new Struct(Messages.MenuContributionEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuContributionEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuContributionEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false), new Struct(Messages.MenuContributionEditor_DynamicMenuContribution, MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) });
+ final Struct defaultStruct = new Struct(Messages.MenuContributionEditor_HandledMenuItem,
+ MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
+ pickList.setInput(new Struct[] {
+ new Struct(Messages.MenuContributionEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true),
+ new Struct(Messages.MenuContributionEditor_Menu, MenuPackageImpl.Literals.MENU, false),
+ defaultStruct,
+ new Struct(Messages.MenuContributionEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM,
+ false),
+ new Struct(Messages.MenuContributionEditor_DynamicMenuContribution,
+ MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) });
pickList.setSelection(new StructuredSelection(defaultStruct));
}
- ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
- ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -273,8 +306,10 @@ public class MenuContributionEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
createContributedEditorTabs(folder, context, getMaster(), MMenuContribution.class);
@@ -294,9 +329,10 @@ public class MenuContributionEditor extends AbstractComponentEditor {
}
protected void handleAdd(EClass eClass, boolean separator) {
- MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
+ final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -308,7 +344,7 @@ public class MenuContributionEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final 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/MenuEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java
index b30f22ad..e70ee3e1 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuEditor.java
@@ -1,22 +1,24 @@
/*******************************************************************************
-f * Copyright (c) 2010, 2014 BestSolution.at and others.
+ * f * Copyright (c) 2010, 2014 BestSolution.at 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:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Marco Descher <marco@descher.at> - Bug 395982
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 395982
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.list.IListChangeListener;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -95,10 +97,12 @@ public class MenuEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
- private IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties.value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IEMFValueProperty UI_ELEMENT__VISIBLE_WHEN = EMFProperties
+ .value(UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
@Optional
@@ -116,7 +120,8 @@ public class MenuEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem, createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) {
+ actions.add(new Action(Messages.MenuEditor_AddHandledMenuItem,
+ createImageDescriptor(ResourceProvider.IMG_HandledMenuItem)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
@@ -128,29 +133,34 @@ public class MenuEditor extends AbstractComponentEditor {
handleAdd(MenuPackageImpl.Literals.MENU, false);
}
});
- actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem, createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) {
+ actions.add(new Action(Messages.MenuEditor_AddDirectMenuItem,
+ createImageDescriptor(ResourceProvider.IMG_DirectMenuItem)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false);
}
});
- actions.add(new Action(Messages.MenuEditor_AddSeparator, createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) {
+ actions.add(new Action(Messages.MenuEditor_AddSeparator,
+ createImageDescriptor(ResourceProvider.IMG_MenuSeparator)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.MENU_SEPARATOR, true);
}
});
- actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution, createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) {
+ actions.add(new Action(Messages.MenuEditor_AddDynamicMenuContribution,
+ createImageDescriptor(ResourceProvider.IMG_DynamicMenuContribution)) {
@Override
public void run() {
handleAdd(MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false);
}
});
- addExpression = new Action(Messages.MenuEditor_AddCoreExpression, createImageDescriptor(ResourceProvider.IMG_CoreExpression)) {
+ addExpression = new Action(Messages.MenuEditor_AddCoreExpression,
+ createImageDescriptor(ResourceProvider.IMG_CoreExpression)) {
@Override
public void run() {
- MUIElement e = (MUIElement) getMaster().getValue();
- Command cmd = SetCommand.create(getEditingDomain(), e, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression());
+ final MUIElement e = (MUIElement) getMaster().getValue();
+ final Command cmd = SetCommand.create(getEditingDomain(), e,
+ UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression());
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
@@ -161,12 +171,11 @@ public class MenuEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_Menu);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_Menu);
}
+ return createImage(ResourceProvider.IMG_Tbr_Menu);
}
return null;
@@ -191,7 +200,7 @@ public class MenuEditor extends AbstractComponentEditor {
createForm(composite, context, getMaster(), false, true);
}
}
- EObject o = (EObject) object;
+ final EObject o = (EObject) object;
Control topControl;
if (Util.isImport(o) && getEditor().isModelFragment()) {
topControl = composite.getChildren()[2];
@@ -207,12 +216,14 @@ public class MenuEditor extends AbstractComponentEditor {
}
getMaster().setValue(object);
- enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
+ enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
return composite;
}
- protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean rootMenu, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ protected Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master,
+ boolean rootMenu, boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -224,7 +235,7 @@ public class MenuEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -232,14 +243,19 @@ public class MenuEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
// ------------------------------------------------------------
if (!rootMenu) {
- ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_LabelLabel, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool,
+ project);
}
- ControlFactory.createTextField(parent, Messages.MenuEditor_Mnemonics, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS));
+ ControlFactory.createTextField(parent, Messages.MenuEditor_Mnemonics, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS));
{
@@ -251,41 +267,55 @@ public class MenuEditor extends AbstractComponentEditor {
// new Label(parent, SWT.NONE);
// new Label(parent, SWT.NONE);
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
pickList.setText(Messages.MenuEditor_Children);
pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
- Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem, MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
- pickList.setInput(new Struct[] { new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true), new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false), defaultStruct, new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false), new Struct(Messages.MenuEditor_DynamicMenuContribution, MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) });
+ final Struct defaultStruct = new Struct(Messages.MenuEditor_HandledMenuItem,
+ MenuPackageImpl.Literals.HANDLED_MENU_ITEM, false);
+ pickList.setInput(new Struct[] {
+ new Struct(Messages.MenuEditor_Separator, MenuPackageImpl.Literals.MENU_SEPARATOR, true),
+ new Struct(Messages.MenuEditor_Menu, MenuPackageImpl.Literals.MENU, false),
+ defaultStruct,
+ new Struct(Messages.MenuEditor_DirectMenuItem, MenuPackageImpl.Literals.DIRECT_MENU_ITEM, false),
+ new Struct(Messages.MenuEditor_DynamicMenuContribution,
+ MenuPackageImpl.Literals.DYNAMIC_MENU_CONTRIBUTION, false) });
pickList.setSelection(new StructuredSelection(defaultStruct));
- IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
pickList.getList().setInput(prop.observeDetail(master));
}
// ------------------------------------------------------------
if (!rootMenu) {
- ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.MenuEditor_Tooltip, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool,
+ project);
}
// ------------------------------------------------------------
if (!rootMenu) {
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuEditor_IconURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(
+ master));
new ImageTooltip(t, Messages) {
@Override
protected URI getImageURI() {
- MUILabel part = (MUILabel) getMaster().getValue();
- String uri = part.getIconURI();
+ final MUILabel part = (MUILabel) getMaster().getValue();
+ final String uri = part.getIconURI();
if (uri == null || uri.trim().length() == 0) {
return null;
}
@@ -300,41 +330,50 @@ public class MenuEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MMenu) getMaster().getValue(), Messages);
+ final MenuIconDialogEditor dialog = new MenuIconDialogEditor(b.getShell(), eclipseContext, project,
+ getEditingDomain(), (MMenu) getMaster().getValue(), Messages);
dialog.open();
}
});
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.ModelTooling_UIElement_VisibleWhen);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- ComboViewer combo = new ComboViewer(parent);
+ final ComboViewer combo = new ComboViewer(parent);
combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
combo.setContentProvider(new ArrayContentProvider());
combo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof EClass) {
- EClass eClass = (EClass) element;
+ final EClass eClass = (EClass) element;
return eClass.getName();
}
return super.getText(element);
}
});
- List<Object> list = new ArrayList<Object>();
+ final List<Object> list = new ArrayList<Object>();
list.add(Messages.MenuItemEditor_NoExpression);
list.add(UiPackageImpl.Literals.CORE_EXPRESSION);
- list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN));
+ list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION,
+ UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN));
combo.setInput(list);
- context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages)));
+ context.bindValue(ViewerProperties.singleSelection().observe(combo),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)
+ .observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)),
+ new UpdateValueStrategy().setConverter(new EObject2EClass(Messages)));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -342,9 +381,13 @@ public class MenuEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -358,14 +401,15 @@ public class MenuEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -391,7 +435,7 @@ public class MenuEditor extends AbstractComponentEditor {
}
});
- IObservableList l = ELEMENT_CONTAINER__CHILDREN.observe(element);
+ final IObservableList l = ELEMENT_CONTAINER__CHILDREN.observe(element);
l.addListChangeListener(new IListChangeListener() {
@Override
@@ -426,9 +470,9 @@ public class MenuEditor extends AbstractComponentEditor {
@Override
public String getLabel(Object element) {
- MMenu menu = (MMenu) element;
+ final MMenu menu = (MMenu) element;
if (menu.getParent() == null) {
- EObject o = (EObject) element;
+ final EObject o = (EObject) element;
if (o.eContainer() instanceof MWindow) {
return Messages.MenuEditor_MainMenu;
} else if (menu.getTags().contains(VMenuEditor.VIEW_MENU_TAG)) {
@@ -451,9 +495,10 @@ public class MenuEditor extends AbstractComponentEditor {
}
protected void handleAdd(EClass eClass, boolean separator) {
- MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
+ final MMenuElement eObject = (MMenuElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -465,7 +510,7 @@ public class MenuEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) {
l.add(addExpression);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java
index 2cadfd34..8c455a26 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/MenuItemEditor.java
@@ -6,16 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.conversion.Converter;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -95,11 +97,13 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- addExpression = new Action(Messages.MenuItemEditor_AddCoreExpression, createImageDescriptor(ResourceProvider.IMG_CoreExpression)) {
+ addExpression = new Action(Messages.MenuItemEditor_AddCoreExpression,
+ createImageDescriptor(ResourceProvider.IMG_CoreExpression)) {
@Override
public void run() {
- MUIElement e = (MUIElement) getMaster().getValue();
- Command cmd = SetCommand.create(getEditingDomain(), e, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression());
+ final MUIElement e = (MUIElement) getMaster().getValue();
+ final Command cmd = SetCommand.create(getEditingDomain(), e,
+ UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN, MUiFactory.INSTANCE.createCoreExpression());
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
@@ -112,9 +116,8 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
if (element instanceof MUIElement) {
if (((MUIElement) element).isToBeRendered()) {
return createImage(ResourceProvider.IMG_MenuItem);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_MenuItem);
}
+ return createImage(ResourceProvider.IMG_Tbr_MenuItem);
}
return null;
@@ -150,12 +153,14 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
}
getMaster().setValue(object);
- enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
+ enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
return composite;
}
- protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ protected CTabFolder createForm(Composite parent, EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -163,9 +168,9 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
- IWidgetValueProperty checkProp = WidgetProperties.selection();
- IWidgetValueProperty enabled = WidgetProperties.enabled();
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty checkProp = WidgetProperties.selection();
+ final IWidgetValueProperty enabled = WidgetProperties.enabled();
if (getEditor().isShowXMIId() || getEditor().isLiveModel()) {
ControlFactory.createXMIId(parent, this);
@@ -177,47 +182,57 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
if (this.getClass() != MenuItemEditor.class) {
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuItemEditor_Type);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- ComboViewer viewer = new ComboViewer(parent);
+ final ComboViewer viewer = new ComboViewer(parent);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setInput(new ItemType[] { ItemType.CHECK, ItemType.PUSH, ItemType.RADIO });
- GridData gd = new GridData();
+ final GridData gd = new GridData();
gd.horizontalSpan = 2;
viewer.getControl().setLayoutData(gd);
- IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master);
+ final IObservableValue itemTypeObs = EMFEditProperties.value(getEditingDomain(),
+ MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(master);
context.bindValue(ViewerProperties.singleSelection().observe(viewer), itemTypeObs);
}
}
- ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
- ControlFactory.createTextField(parent, Messages.MenuItemEditor_Mnemonics, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS));
- ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Label, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
+ ControlFactory.createTextField(parent, Messages.MenuItemEditor_Mnemonics, getMaster(), context, textProp,
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_ELEMENT__MNEMONICS));
+ ControlFactory.createTranslatedTextField(parent, Messages.MenuItemEditor_Tooltip, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool,
+ project);
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuItemEditor_IconURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(
+ master));
new ImageTooltip(t, Messages) {
@Override
protected URI getImageURI() {
- MUILabel part = (MUILabel) getMaster().getValue();
- String uri = part.getIconURI();
+ final MUILabel part = (MUILabel) getMaster().getValue();
+ final String uri = part.getIconURI();
if (uri == null || uri.trim().length() == 0) {
return null;
}
@@ -232,32 +247,39 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MMenuItem) getMaster().getValue(), Messages);
+ final MenuItemIconDialogEditor dialog = new MenuItemIconDialogEditor(b.getShell(), eclipseContext,
+ project, getEditingDomain(), (MMenuItem) getMaster().getValue(), Messages);
dialog.open();
}
});
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuItemEditor_Enabled);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Button b = new Button(parent, SWT.CHECK);
+ final Button b = new Button(parent, SWT.CHECK);
b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
- context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(getMaster()));
+ context.bindValue(
+ checkProp.observe(b),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__ENABLED).observeDetail(
+ getMaster()));
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuItemEditor_Selected);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Button b = new Button(parent, SWT.CHECK);
+ final Button b = new Button(parent, SWT.CHECK);
b.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
- context.bindValue(checkProp.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(getMaster()));
+ context.bindValue(
+ checkProp.observe(b),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__SELECTED).observeDetail(
+ getMaster()));
- UpdateValueStrategy t2m = new UpdateValueStrategy();
+ final UpdateValueStrategy t2m = new UpdateValueStrategy();
t2m.setConverter(new Converter(boolean.class, ItemType.class) {
@Override
@@ -265,7 +287,7 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
return null;
}
});
- UpdateValueStrategy m2t = new UpdateValueStrategy();
+ final UpdateValueStrategy m2t = new UpdateValueStrategy();
m2t.setConverter(new Converter(ItemType.class, boolean.class) {
@Override
@@ -274,41 +296,52 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
}
});
- context.bindValue(enabled.observe(b), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(getMaster()), t2m, m2t);
+ context.bindValue(
+ enabled.observe(b),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.ITEM__TYPE).observeDetail(
+ getMaster()), t2m, m2t);
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.ModelTooling_UIElement_VisibleWhen);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- ComboViewer combo = new ComboViewer(parent);
+ final ComboViewer combo = new ComboViewer(parent);
combo.getControl().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
combo.setContentProvider(new ArrayContentProvider());
combo.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof EClass) {
- EClass eClass = (EClass) element;
+ final EClass eClass = (EClass) element;
return eClass.getName();
}
return super.getText(element);
}
});
- List<Object> list = new ArrayList<Object>();
+ final List<Object> list = new ArrayList<Object>();
list.add(Messages.MenuItemEditor_NoExpression);
list.add(UiPackageImpl.Literals.CORE_EXPRESSION);
- list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION, UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN));
+ list.addAll(getEditor().getFeatureClasses(UiPackageImpl.Literals.EXPRESSION,
+ UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN));
combo.setInput(list);
- context.bindValue(ViewerProperties.singleSelection().observe(combo), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN).observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)), new UpdateValueStrategy().setConverter(new EObject2EClass(Messages)));
+ context.bindValue(ViewerProperties.singleSelection().observe(combo),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE_WHEN)
+ .observeDetail(getMaster()), new UpdateValueStrategy().setConverter(new EClass2EObject(Messages)),
+ new UpdateValueStrategy().setConverter(new EObject2EClass(Messages)));
}
createFormSubTypeForm(parent, context, master);
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -316,10 +349,14 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -335,14 +372,15 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
protected abstract void createFormSubTypeForm(Composite parent, EMFDataBindingContext context, WritableValue master);
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -358,12 +396,13 @@ public abstract class MenuItemEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
if (((MUIElement) getMaster().getValue()).getVisibleWhen() == null) {
l.add(addExpression);
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java
index 3a5ee857..413f698a 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ModelFragmentsEditor.java
@@ -6,15 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance, Bug 443945
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance, Bug 443945
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -58,8 +60,10 @@ import org.eclipse.swt.widgets.Display;
public class ModelFragmentsEditor extends AbstractComponentEditor {
- private IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS);
- private IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS);
+ private final IListProperty MODEL_FRAGMENTS__FRAGMENTS = EMFProperties
+ .list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS);
+ private final IListProperty MODEL_FRAGMENTS__IMPORTS = EMFProperties
+ .list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS);
private Composite composite;
@@ -96,7 +100,7 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
createFragmentsTab(folder);
createImportsTab(folder);
folder.setSelection(0);
@@ -105,20 +109,23 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
private void createFragmentsTab(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelFragmentsEditor_ModelFragments);
- Composite parent = createScrollableContainer(folder);
+ final Composite parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
{
- AbstractPickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS) {
+ final AbstractPickList pickList = new E4PickList(parent, SWT.NONE,
+ Arrays.asList(PickListFeatures.NO_PICKER), Messages, this,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS) {
@Override
protected void addPressed() {
- MModelFragment component = MFragmentFactory.INSTANCE.createStringModelFragment();
+ final MModelFragment component = MFragmentFactory.INSTANCE.createStringModelFragment();
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, component);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS, component);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -130,15 +137,14 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
protected List<?> getContainerChildren(Object container) {
if (container instanceof MModelFragments) {
return ((MModelFragments) container).getFragments();
- } else {
- return null;
}
+ return null;
}
};
pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
- TableViewer viewer = pickList.getList();
+ final TableViewer viewer = pickList.getList();
- IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS);
+ final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__FRAGMENTS);
viewer.setInput(prop.observeDetail(getMaster()));
}
@@ -146,23 +152,25 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
private void createImportsTab(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelFragmentsEditor_Imports);
- Composite parent = createScrollableContainer(folder);
+ final Composite parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
if (getEditor().isShowXMIId() || getEditor().isLiveModel()) {
ControlFactory.createXMIId(parent, this);
}
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS) {
@Override
protected void addPressed() {
- EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
- EObject eObject = EcoreUtil.create(eClass);
+ final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
+ final EObject eObject = EcoreUtil.create(eClass);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -180,12 +188,12 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
pickList.setText(Messages.PartSashContainerEditor_Controls);
- TableViewer viewer = pickList.getList();
+ final TableViewer viewer = pickList.getList();
pickList.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
- FeatureClass eclass = (FeatureClass) element;
+ final FeatureClass eclass = (FeatureClass) element;
return eclass.label;
}
});
@@ -193,50 +201,55 @@ public class ModelFragmentsEditor extends AbstractComponentEditor {
pickList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- FeatureClass eClass1 = (FeatureClass) e1;
- FeatureClass eClass2 = (FeatureClass) e2;
+ final FeatureClass eClass1 = (FeatureClass) e1;
+ final FeatureClass eClass2 = (FeatureClass) e2;
return eClass1.label.compareTo(eClass2.label);
}
});
- List<FeatureClass> list = new ArrayList<FeatureClass>();
+ final List<FeatureClass> list = new ArrayList<FeatureClass>();
Util.addClasses(ApplicationPackageImpl.eINSTANCE, list);
- list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS));
+ list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS));
pickList.setInput(list);
if (list.size() > 0) {
pickList.setSelection(new StructuredSelection(list.get(0)));
}
- IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS);
+ final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENTS__IMPORTS);
viewer.setInput(prop.observeDetail(getMaster()));
}
public void addClasses(EPackage ePackage, List<FeatureClass> list) {
- for (EClassifier c : ePackage.getEClassifiers()) {
+ for (final EClassifier c : ePackage.getEClassifiers()) {
if (c instanceof EClass) {
- EClass eclass = (EClass) c;
- if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract() && !eclass.isInterface() && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) {
+ final EClass eclass = (EClass) c;
+ if (eclass != ApplicationPackageImpl.Literals.APPLICATION && !eclass.isAbstract()
+ && !eclass.isInterface()
+ && eclass.getEAllSuperTypes().contains(ApplicationPackageImpl.Literals.APPLICATION_ELEMENT)) {
list.add(new FeatureClass(eclass.getName(), eclass));
}
}
}
- for (EPackage eSubPackage : ePackage.getESubpackages()) {
+ for (final EPackage eSubPackage : ePackage.getESubpackages()) {
addClasses(eSubPackage, list);
}
}
@Override
public IObservableList getChildList(Object element) {
- WritableList list = new WritableList();
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element, Messages.ModelFragmentsEditor_Imports) {
+ final WritableList list = new WritableList();
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_IMPORTS, MODEL_FRAGMENTS__IMPORTS, element,
+ Messages.ModelFragmentsEditor_Imports) {
@Override
protected boolean accepted(Object o) {
return true;
}
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element, Messages.ModelFragmentsEditor_ModelFragments) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_MODEL_FRAGEMENTS, MODEL_FRAGMENTS__FRAGMENTS, element,
+ Messages.ModelFragmentsEditor_ModelFragments) {
@Override
protected boolean accepted(Object o) {
return true;
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
index 72bf31ed..609304a3 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartEditor.java
@@ -6,12 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951, Ongoing Maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951, Ongoing Maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.Binding;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.observable.list.IObservableList;
@@ -82,9 +83,10 @@ public class PartEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS);
- private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS);
- private IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR);
+ private final IListProperty PART__MENUS = EMFProperties.list(BasicPackageImpl.Literals.PART__MENUS);
+ private final IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties
+ .list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS);
+ private final IValueProperty PART__TOOLBAR = EMFProperties.value(BasicPackageImpl.Literals.PART__TOOLBAR);
private Button createRemoveToolBar;
private StackLayout stackLayout;
@@ -105,9 +107,8 @@ public class PartEditor extends AbstractComponentEditor {
if (element instanceof MUIElement) {
if (((MUIElement) element).isToBeRendered()) {
return createImage(ResourceProvider.IMG_Part);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_Part);
}
+ return createImage(ResourceProvider.IMG_Tbr_Part);
}
return null;
@@ -160,13 +161,15 @@ public class PartEditor extends AbstractComponentEditor {
}
getMaster().setValue(object);
- enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
+ enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
return composite;
}
- protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ protected Composite createForm(Composite parent, EMFDataBindingContext context, IObservableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.BORDER);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -178,7 +181,7 @@ public class PartEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -186,14 +189,20 @@ public class PartEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.PartEditor_LabelLabel, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
- ControlFactory.createTextField(parent, Messages.PartEditor_Tooltip, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.PartEditor_LabelLabel, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, master, context,
+ textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.PartEditor_Tooltip, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP));
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PartEditor_IconURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
l.setToolTipText(Messages.PartEditor_IconURI_Tooltip);
@@ -201,14 +210,17 @@ public class PartEditor extends AbstractComponentEditor {
final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(
+ master));
new ImageTooltip(t, Messages) {
@Override
protected URI getImageURI() {
- MUILabel part = (MUILabel) getMaster().getValue();
- String uri = part.getIconURI();
+ final MUILabel part = (MUILabel) getMaster().getValue();
+ final String uri = part.getIconURI();
if (uri == null || uri.trim().length() == 0) {
return null;
}
@@ -223,7 +235,8 @@ public class PartEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MPart) getMaster().getValue(), Messages);
+ final PartIconDialogEditor dialog = new PartIconDialogEditor(b.getShell(), eclipseContext, project,
+ getEditingDomain(), (MPart) getMaster().getValue(), Messages);
dialog.open();
}
});
@@ -240,7 +253,8 @@ public class PartEditor extends AbstractComponentEditor {
lnk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, lnk.getShell());
+ c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project,
+ lnk.getShell());
}
});
} else {
@@ -248,12 +262,12 @@ public class PartEditor extends AbstractComponentEditor {
// and screws up the layout: see https://bugs.eclipse.org/421369
lnk = null;
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PartEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
t.addModifyListener(new ModifyListener() {
@@ -262,11 +276,16 @@ public class PartEditor extends AbstractComponentEditor {
public void modifyText(ModifyEvent e) {
// lnk might be disposed if else branch above taken
if (lnk != null) {
- lnk.setToolTipText(((Text) (e.getSource())).getText());
+ lnk.setToolTipText(((Text) e.getSource()).getText());
}
}
});
- Binding binding = context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master), new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()), new UpdateValueStrategy());
+ final Binding binding = context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master),
+ new UpdateValueStrategy().setAfterConvertValidator(new ContributionURIValidator()),
+ new UpdateValueStrategy());
Util.addDecoration(t, binding);
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
@@ -276,19 +295,22 @@ public class PartEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
+ final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext,
+ getEditingDomain(), (MContribution) getMaster().getValue(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
dialog.open();
}
});
}
// ------------------------------------------------------------
- ControlFactory.createTextField(parent, Messages.PartEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
+ ControlFactory.createTextField(parent, Messages.PartEditor_ContainerData, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
createSubformElements(parent, context, master);
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PartEditor_ToolBar);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -296,7 +318,7 @@ public class PartEditor extends AbstractComponentEditor {
createRemoveToolBar.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MPart window = (MPart) getMaster().getValue();
+ final MPart window = (MPart) getMaster().getValue();
if (window.getToolbar() == null) {
addToolBar();
} else {
@@ -307,15 +329,23 @@ public class PartEditor extends AbstractComponentEditor {
createRemoveToolBar.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
}
- ControlFactory.createCheckBox(parent, Messages.PartEditor_Closeable, Messages.PartEditor_Closeable_Tooltip, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE));
+ ControlFactory.createCheckBox(parent, Messages.PartEditor_Closeable, Messages.PartEditor_Closeable_Tooltip,
+ getMaster(), context, WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.PART__CLOSEABLE));
// ------------------------------------------------------------
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.PartEditor_BindingContexts);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties,
+ UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -323,8 +353,11 @@ public class PartEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, Messages.ModelTooling_Context_Variables_Tooltip, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables,
+ Messages.ModelTooling_Context_Variables_Tooltip, UiPackageImpl.Literals.CONTEXT__VARIABLES,
+ VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createInstanceInspection(folder);
@@ -339,41 +372,45 @@ public class PartEditor extends AbstractComponentEditor {
}
private void createInstanceInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- ObjectViewer objectViewer = new ObjectViewer();
- TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages);
+ final ObjectViewer objectViewer = new ObjectViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container,
+ ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
private void addToolBar() {
- MToolBar menu = MMenuFactory.INSTANCE.createToolBar();
+ final MToolBar menu = MMenuFactory.INSTANCE.createToolBar();
setElementId(menu);
- Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, menu);
+ final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(),
+ BasicPackageImpl.Literals.PART__TOOLBAR, menu);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
}
private void removeToolBar() {
- Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.PART__TOOLBAR, null);
+ final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(),
+ BasicPackageImpl.Literals.PART__TOOLBAR, null);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
@@ -391,7 +428,8 @@ public class PartEditor extends AbstractComponentEditor {
return list;
}
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element, Messages.PartEditor_Menus) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PART_MENU, PART__MENUS, element,
+ Messages.PartEditor_Menus) {
@Override
protected boolean accepted(Object o) {
@@ -400,7 +438,8 @@ public class PartEditor extends AbstractComponentEditor {
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.PartEditor_Handlers) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element,
+ Messages.PartEditor_Handlers) {
@Override
protected boolean accepted(Object o) {
@@ -409,7 +448,7 @@ public class PartEditor extends AbstractComponentEditor {
});
- MPart window = (MPart) element;
+ final MPart window = (MPart) element;
if (window.getToolbar() != null) {
list.add(0, window.getToolbar());
}
@@ -445,6 +484,7 @@ public class PartEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
} \ 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/PartSashContainerEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java
index a027ca46..275dc823 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartSashContainerEditor.java
@@ -6,15 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -78,10 +80,11 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
- private List<Action> actionsImport = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actionsImport = new ArrayList<Action>();
@Inject
@Optional
@@ -97,38 +100,44 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) {
+ actions.add(new Action(Messages.PartSashContainerEditor_AddPartSashContainer,
+ createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER);
}
});
- actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) {
+ actions.add(new Action(Messages.PartSashContainerEditor_AddPartStack,
+ createImageDescriptor(ResourceProvider.IMG_PartStack)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.PART_STACK);
}
});
- actions.add(new Action(Messages.PartSashContainerEditor_AddPart, createImageDescriptor(ResourceProvider.IMG_Part)) {
+ actions.add(new Action(Messages.PartSashContainerEditor_AddPart,
+ createImageDescriptor(ResourceProvider.IMG_Part)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.PART);
}
});
- actions.add(new Action(Messages.PartSashContainerEditor_AddArea, createImageDescriptor(ResourceProvider.IMG_Area)) {
+ actions.add(new Action(Messages.PartSashContainerEditor_AddArea,
+ createImageDescriptor(ResourceProvider.IMG_Area)) {
@Override
public void run() {
handleAddChild(AdvancedPackageImpl.Literals.AREA);
}
});
- actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
+ actions.add(new Action(Messages.PartSashContainerEditor_AddPlaceholder,
+ createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
@Override
public void run() {
handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER);
}
});
- for (FeatureClass c : getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)) {
+ for (final FeatureClass c : getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN)) {
final EClass ec = c.eClass;
actions.add(new Action(c.label, createImageDescriptor(c.iconId)) {
@Override
@@ -156,24 +165,22 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
- boolean horizontal = ((MPartSashContainer) element).isHorizontal();
+ final boolean horizontal = ((MPartSashContainer) element).isHorizontal();
if (!horizontal) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_PartSashContainer_vertical);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_PartSashContainer_vertical);
}
+ return createImage(ResourceProvider.IMG_Tbr_PartSashContainer_vertical);
}
if (horizontal) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_PartSashContainer);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_PartSashContainer);
}
+ return createImage(ResourceProvider.IMG_Tbr_PartSashContainer);
}
return null;
}
@@ -221,8 +228,9 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
return composite;
}
- private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -234,7 +242,7 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -242,39 +250,48 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PartSashContainerEditor_Orientation);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- ComboViewer viewer = new ComboViewer(parent);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ final ComboViewer viewer = new ComboViewer(parent);
+ final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
viewer.getControl().setLayoutData(gd);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
- return ((Boolean) element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal : Messages.PartSashContainerEditor_Vertical;
+ return ((Boolean) element).booleanValue() ? Messages.PartSashContainerEditor_Horizontal
+ : Messages.PartSashContainerEditor_Vertical;
}
});
viewer.setInput(new Boolean[] { Boolean.TRUE, Boolean.FALSE });
- IViewerValueProperty vProp = ViewerProperties.singleSelection();
- context.bindValue(vProp.observe(viewer), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL).observeDetail(getMaster()));
+ final IViewerValueProperty vProp = ViewerProperties.singleSelection();
+ context.bindValue(vProp.observe(viewer),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL)
+ .observeDetail(getMaster()));
}
ControlFactory.createSelectedElement(parent, this, context, Messages.PartSashContainerEditor_SelectedElement);
- ControlFactory.createTextField(parent, Messages.PartSashContainerEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
+ ControlFactory.createTextField(parent, Messages.PartSashContainerEditor_ContainerData, master, context,
+ textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
+ final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
handleAddChild(eClass);
}
};
@@ -283,24 +300,29 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
pickList.setLabelProvider(new FeatureClassLabelProvider(getEditor()));
- List<FeatureClass> eClassList = new ArrayList<FeatureClass>();
+ final List<FeatureClass> eClassList = new ArrayList<FeatureClass>();
eClassList.add(new FeatureClass("PartSashContainer", BasicPackageImpl.Literals.PART_SASH_CONTAINER)); //$NON-NLS-1$
eClassList.add(new FeatureClass("PartStack", BasicPackageImpl.Literals.PART_STACK)); //$NON-NLS-1$
eClassList.add(new FeatureClass("Part", BasicPackageImpl.Literals.PART)); //$NON-NLS-1$
eClassList.add(new FeatureClass("InputPart", BasicPackageImpl.Literals.INPUT_PART)); //$NON-NLS-1$
eClassList.add(new FeatureClass("Area", AdvancedPackageImpl.Literals.AREA)); //$NON-NLS-1$
eClassList.add(new FeatureClass("Placeholder", AdvancedPackageImpl.Literals.PLACEHOLDER)); //$NON-NLS-1$
- eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_SASH_CONTAINER, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN));
+ eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_SASH_CONTAINER,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN));
pickList.setInput(eClassList);
pickList.setSelection(new StructuredSelection(eClassList.get(0)));
final TableViewer viewer = pickList.getList();
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -308,8 +330,10 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -323,14 +347,15 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -346,18 +371,20 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TILE__HORIZONTAL),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
protected void handleAddChild(EClass eClass) {
- EObject eObject = EcoreUtil.create(eClass);
+ final EObject eObject = EcoreUtil.create(eClass);
addToModel(eObject);
}
private void addToModel(EObject eObject) {
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -368,11 +395,11 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
protected void handleImportChild(EClass eClass, String hint) {
if (eClass == BasicPackageImpl.Literals.PART) {
- ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, hint, resourcePool);
- WizardDialog wizardDialog = new WizardDialog(shell, wizard);
+ final ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, hint, resourcePool);
+ final WizardDialog wizardDialog = new WizardDialog(shell, wizard);
if (wizardDialog.open() == Window.OK) {
- MPart[] parts = (MPart[]) wizard.getElements(MPart.class);
- for (MPart part : parts) {
+ final MPart[] parts = (MPart[]) wizard.getElements(MPart.class);
+ for (final MPart part : parts) {
addToModel((EObject) part);
}
}
@@ -381,14 +408,14 @@ public class PartSashContainerEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
return l;
}
@Override
public List<Action> getActionsImport(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
l.addAll(actionsImport);
return l;
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java
index c6d4f37b..aa35b8d0 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PartStackEditor.java
@@ -6,15 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -72,10 +74,11 @@ public class PartStackEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
- private List<Action> actionsImport = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actionsImport = new ArrayList<Action>();
@Inject
@Optional
@@ -95,23 +98,26 @@ public class PartStackEditor extends AbstractComponentEditor {
handleAddChild(BasicPackageImpl.Literals.PART);
}
});
- actions.add(new Action(Messages.PartStackEditor_AddCompositePart, createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) {
+ actions.add(new Action(Messages.PartStackEditor_AddCompositePart,
+ createImageDescriptor(ResourceProvider.IMG_PartSashContainer)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.COMPOSITE_PART);
}
});
- actions.add(new Action(Messages.PartStackEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
+ actions.add(new Action(Messages.PartStackEditor_AddPlaceholder,
+ createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
@Override
public void run() {
handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER);
}
});
- List<FeatureClass> list = getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final List<FeatureClass> list = getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
if (!list.isEmpty()) {
- for (FeatureClass c : list) {
+ for (final FeatureClass c : list) {
final EClass ec = c.eClass;
actions.add(new Action(c.label, createImageDescriptor(c.iconId)) {
@Override
@@ -129,12 +135,13 @@ public class PartStackEditor extends AbstractComponentEditor {
handleImportChild(BasicPackageImpl.Literals.PART);
}
});
- actionsImport.add(new Action(Messages.PartStackEditor_Editors, createImageDescriptor(ResourceProvider.IMG_Part)) {
- @Override
- public void run() {
- handleImportChild(BasicPackageImpl.Literals.INPUT_PART);
- }
- });
+ actionsImport
+ .add(new Action(Messages.PartStackEditor_Editors, createImageDescriptor(ResourceProvider.IMG_Part)) {
+ @Override
+ public void run() {
+ handleImportChild(BasicPackageImpl.Literals.INPUT_PART);
+ }
+ });
}
@@ -143,9 +150,8 @@ public class PartStackEditor extends AbstractComponentEditor {
if (element instanceof MUIElement) {
if (((MUIElement) element).isToBeRendered()) {
return createImage(ResourceProvider.IMG_Part);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_Part);
}
+ return createImage(ResourceProvider.IMG_Tbr_Part);
}
return null;
@@ -189,14 +195,15 @@ public class PartStackEditor extends AbstractComponentEditor {
composite.layout(true, true);
}
}
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
getMaster().setValue(object);
return composite;
}
- private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -208,7 +215,7 @@ public class PartStackEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -216,18 +223,24 @@ public class PartStackEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
ControlFactory.createSelectedElement(parent, this, context, Messages.PartStackEditor_SelectedElement);
- ControlFactory.createTextField(parent, Messages.PartStackEditor_ContainerData, master, context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
+ ControlFactory.createTextField(parent, Messages.PartStackEditor_ContainerData, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__CONTAINER_DATA));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
+ final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
handleAddChild(eClass);
}
};
@@ -235,23 +248,30 @@ public class PartStackEditor extends AbstractComponentEditor {
pickList.setText(Messages.PartStackEditor_Parts);
viewer = pickList.getList();
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
pickList.setLabelProvider(new FeatureClassLabelProvider(getEditor()));
- List<FeatureClass> eClassList = new ArrayList<FeatureClass>();
+ final List<FeatureClass> eClassList = new ArrayList<FeatureClass>();
eClassList.add(new FeatureClass(Messages.PartStackEditor_Part, BasicPackageImpl.Literals.PART));
- eClassList.add(new FeatureClass(Messages.PartStackEditor_CompositePart, BasicPackageImpl.Literals.COMPOSITE_PART));
- eClassList.add(new FeatureClass(Messages.PartStackEditor_Placeholder, AdvancedPackageImpl.Literals.PLACEHOLDER));
- eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN));
+ eClassList.add(new FeatureClass(Messages.PartStackEditor_CompositePart,
+ BasicPackageImpl.Literals.COMPOSITE_PART));
+ eClassList.add(new FeatureClass(Messages.PartStackEditor_Placeholder,
+ AdvancedPackageImpl.Literals.PLACEHOLDER));
+ eClassList.addAll(getEditor().getFeatureClasses(BasicPackageImpl.Literals.PART_STACK,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN));
pickList.setInput(eClassList);
pickList.setSelection(new StructuredSelection(eClassList.get(0)));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -259,8 +279,10 @@ public class PartStackEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -274,14 +296,15 @@ public class PartStackEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -301,14 +324,15 @@ public class PartStackEditor extends AbstractComponentEditor {
}
protected void handleAddChild(EClass eClass) {
- EObject eObject = EcoreUtil.create(eClass);
+ final EObject eObject = EcoreUtil.create(eClass);
addToModel(eObject);
}
private void addToModel(EObject eObject) {
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -319,22 +343,22 @@ public class PartStackEditor extends AbstractComponentEditor {
protected void handleImportChild(EClass eClass) {
if (eClass == BasicPackageImpl.Literals.PART) {
- ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, resourcePool);
- WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard);
+ final ModelImportWizard wizard = new ModelImportWizard(MPart.class, this, resourcePool);
+ final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard);
if (wizardDialog.open() == Window.OK) {
- MPart[] parts = (MPart[]) wizard.getElements(MPart.class);
- for (MPart part : parts) {
+ final MPart[] parts = (MPart[]) wizard.getElements(MPart.class);
+ for (final MPart part : parts) {
addToModel((EObject) part);
}
}
}
if (eClass == BasicPackageImpl.Literals.INPUT_PART) {
- ModelImportWizard wizard = new ModelImportWizard(MInputPart.class, this, resourcePool);
- WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard);
+ final ModelImportWizard wizard = new ModelImportWizard(MInputPart.class, this, resourcePool);
+ final WizardDialog wizardDialog = new WizardDialog(viewer.getControl().getShell(), wizard);
if (wizardDialog.open() == Window.OK) {
- MPart[] parts = (MPart[]) wizard.getElements(MInputPart.class);
- for (MPart part : parts) {
+ final MPart[] parts = (MPart[]) wizard.getElements(MInputPart.class);
+ for (final MPart part : parts) {
addToModel((EObject) part);
}
}
@@ -343,14 +367,14 @@ public class PartStackEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
return l;
}
@Override
public List<Action> getActionsImport(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
l.addAll(actionsImport);
return l;
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java
index 69b3780c..e19b6565 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveEditor.java
@@ -6,15 +6,17 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -72,10 +74,12 @@ public class PerspectiveEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
- private IListProperty PERSPECTIVE__WINDOWS = EMFProperties.list(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty PERSPECTIVE__WINDOWS = EMFProperties
+ .list(AdvancedPackageImpl.Literals.PERSPECTIVE__WINDOWS);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
@Optional
@@ -91,13 +95,15 @@ public class PerspectiveEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer, createImageDescriptor(ResourceProvider.IMG_Perspective)) {
+ actions.add(new Action(Messages.PerspectiveEditor_AddPartSashContainer,
+ createImageDescriptor(ResourceProvider.IMG_Perspective)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.PART_SASH_CONTAINER);
}
});
- actions.add(new Action(Messages.PerspectiveEditor_AddPartStack, createImageDescriptor(ResourceProvider.IMG_PartStack)) {
+ actions.add(new Action(Messages.PerspectiveEditor_AddPartStack,
+ createImageDescriptor(ResourceProvider.IMG_PartStack)) {
@Override
public void run() {
handleAddChild(BasicPackageImpl.Literals.PART_STACK);
@@ -115,7 +121,8 @@ public class PerspectiveEditor extends AbstractComponentEditor {
handleAddChild(AdvancedPackageImpl.Literals.AREA);
}
});
- actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder, createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
+ actions.add(new Action(Messages.PerspectiveEditor_AddPlaceholder,
+ createImageDescriptor(ResourceProvider.IMG_Placeholder)) {
@Override
public void run() {
handleAddChild(AdvancedPackageImpl.Literals.PLACEHOLDER);
@@ -126,12 +133,11 @@ public class PerspectiveEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_Perspective);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_Perspective);
}
+ return createImage(ResourceProvider.IMG_Tbr_Perspective);
}
return null;
@@ -149,7 +155,8 @@ public class PerspectiveEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
@Override
@@ -187,12 +194,14 @@ public class PerspectiveEditor extends AbstractComponentEditor {
}
getMaster().setValue(object);
- enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
+ enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
return composite;
}
- private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -204,7 +213,7 @@ public class PerspectiveEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -212,29 +221,40 @@ public class PerspectiveEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveEditor_SelectedElement);
- ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_LabelLabel, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
- ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_Tooltip, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_LabelLabel, getMaster(), context,
+ textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL),
+ resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.PerspectiveEditor_Tooltip, getMaster(), context,
+ textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP),
+ resourcePool, project);
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.PerspectiveEditor_IconURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(
+ master));
new ImageTooltip(t, Messages) {
@Override
protected URI getImageURI() {
- MUILabel part = (MUILabel) getMaster().getValue();
- String uri = part.getIconURI();
+ final MUILabel part = (MUILabel) getMaster().getValue();
+ final String uri = part.getIconURI();
if (uri == null || uri.trim().length() == 0) {
return null;
}
@@ -248,19 +268,28 @@ public class PerspectiveEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MPerspective) getMaster().getValue(), Messages);
+ final PerspectiveIconDialogEditor dialog = new PerspectiveIconDialogEditor(b.getShell(),
+ eclipseContext, project, getEditingDomain(), (MPerspective) getMaster().getValue(), Messages);
dialog.open();
}
});
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
- Composite comp0 = ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);
+ final Composite comp0 = ControlFactory.createMapProperties(parent, Messages, this,
+ Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES,
+ VERTICAL_LIST_WIDGET_INDENT);
comp0.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
- Composite comp = ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT);
+ final Composite comp = ControlFactory.createStringListWidget(parent, Messages, this,
+ Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES,
+ VERTICAL_LIST_WIDGET_INDENT);
comp.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
item = new CTabItem(folder, SWT.NONE);
@@ -269,8 +298,10 @@ public class PerspectiveEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -284,21 +315,23 @@ public class PerspectiveEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@Override
public IObservableList getChildList(Object element) {
final WritableList list = new WritableList();
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_WINDOWS, PERSPECTIVE__WINDOWS, element, Messages.WindowEditor_Windows) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_WINDOWS, PERSPECTIVE__WINDOWS, element,
+ Messages.WindowEditor_Windows) {
@Override
protected boolean accepted(Object o) {
@@ -306,7 +339,8 @@ public class PerspectiveEditor extends AbstractComponentEditor {
}
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, Messages.PerspectiveEditor_Controls) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_PERSPECTIVE_CONTROLS, ELEMENT_CONTAINER__CHILDREN,
+ element, Messages.PerspectiveEditor_Controls) {
@Override
protected boolean accepted(Object o) {
@@ -318,10 +352,11 @@ public class PerspectiveEditor extends AbstractComponentEditor {
}
protected void handleAddChild(EClass eClass) {
- EObject eObject = EcoreUtil.create(eClass);
+ final EObject eObject = EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -331,7 +366,7 @@ public class PerspectiveEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final 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/PerspectiveStackEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java
index 86c1fe9f..5c316be2 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/PerspectiveStackEditor.java
@@ -6,16 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -67,10 +69,11 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
- private List<Action> actionsImport = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actionsImport = new ArrayList<Action>();
@Inject
@Optional
@@ -86,7 +89,8 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, createImageDescriptor(ResourceProvider.IMG_Perspective)) {
+ actions.add(new Action(Messages.PerspectiveStackEditor_AddPerspective,
+ createImageDescriptor(ResourceProvider.IMG_Perspective)) {
@Override
public void run() {
handleAddPerspective();
@@ -94,7 +98,8 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
});
// --- import ---
- actionsImport.add(new Action(Messages.PerspectiveStackEditor_AddPerspective, createImageDescriptor(ResourceProvider.IMG_Perspective)) {
+ actionsImport.add(new Action(Messages.PerspectiveStackEditor_AddPerspective,
+ createImageDescriptor(ResourceProvider.IMG_Perspective)) {
@Override
public void run() {
handleImportPerspective();
@@ -105,12 +110,11 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_PerspectiveStack);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_PerspectiveStack);
}
+ return createImage(ResourceProvider.IMG_Tbr_PerspectiveStack);
}
return null;
@@ -164,8 +168,9 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
return composite;
}
- private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ private Composite createForm(Composite parent, final EMFDataBindingContext context, WritableValue master,
+ boolean isImport) {
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -177,7 +182,7 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -185,14 +190,19 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
ControlFactory.createSelectedElement(parent, this, context, Messages.PerspectiveStackEditor_SelectedElement);
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER),
+ Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
handleAddPerspective();
@@ -204,12 +214,16 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
final TableViewer viewer = pickList.getList();
viewer.setContentProvider(new ObservableListContentProvider());
viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages));
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -217,8 +231,10 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -232,14 +248,15 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -254,16 +271,16 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
}
protected void handleAddPerspective() {
- MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective();
+ final MPerspective eObject = MAdvancedFactory.INSTANCE.createPerspective();
addToModel(eObject);
}
protected void handleImportPerspective() {
- ModelImportWizard wizard = new ModelImportWizard(MPerspective.class, this, resourcePool);
- WizardDialog wizardDialog = new WizardDialog(shell, wizard);
+ final ModelImportWizard wizard = new ModelImportWizard(MPerspective.class, this, resourcePool);
+ final WizardDialog wizardDialog = new WizardDialog(shell, wizard);
if (wizardDialog.open() == Window.OK) {
- MPerspective[] elements = (MPerspective[]) wizard.getElements(MPerspective.class);
- for (MPerspective category : elements) {
+ final MPerspective[] elements = (MPerspective[]) wizard.getElements(MPerspective.class);
+ for (final MPerspective category : elements) {
addToModel(category);
}
}
@@ -271,7 +288,8 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
private void addToModel(MPerspective perspective) {
setElementId(perspective);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, perspective);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, perspective);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
getEditor().setSelection(perspective);
@@ -280,14 +298,14 @@ public class PerspectiveStackEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
return l;
}
@Override
public List<Action> getActionsImport(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActionsImport(element));
l.addAll(actionsImport);
return l;
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
index b6808947..fcfd9c0c 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/StringModelFragment.java
@@ -6,8 +6,8 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Steven Spungin <steve@spungin.tv> - Ongoing Maintenance, Bug 439532, Bug 443945
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Steven Spungin <steve@spungin.tv> - Ongoing Maintenance, Bug 439532, Bug 443945
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
@@ -15,8 +15,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.property.list.IListProperty;
import org.eclipse.e4.core.contexts.IEclipseContext;
@@ -69,9 +71,10 @@ public class StringModelFragment extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS);
+ private final IListProperty MODEL_FRAGMENT__ELEMENTS = EMFProperties
+ .list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS);
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
IEclipseContext eclipseContext;
@@ -83,9 +86,10 @@ public class StringModelFragment extends AbstractComponentEditor {
@PostConstruct
public void init() {
- List<FeatureClass> list = new ArrayList<FeatureClass>();
+ final List<FeatureClass> list = new ArrayList<FeatureClass>();
Util.addClasses(ApplicationPackageImpl.eINSTANCE, list);
- list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS));
+ list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS));
for (final FeatureClass featureClass : list) {
actions.add(new Action(featureClass.label) {
@@ -109,13 +113,15 @@ public class StringModelFragment extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME), FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID) };
+ return new FeaturePath[] {
+ FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME),
+ FeaturePath.fromList(FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID) };
}
@Override
public String getDetailLabel(Object element) {
if (element instanceof StringModelFragmentImpl) {
- StringModelFragmentImpl fragment = (StringModelFragmentImpl) element;
+ final StringModelFragmentImpl fragment = (StringModelFragmentImpl) element;
String ret = ""; //$NON-NLS-1$
if (E.notEmpty(fragment.getFeaturename())) {
ret += fragment.getFeaturename();
@@ -124,9 +130,8 @@ public class StringModelFragment extends AbstractComponentEditor {
ret += " (" + fragment.getParentElementId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
return ret;
- } else {
- return null;
}
+ return null;
}
@Override
@@ -145,9 +150,9 @@ public class StringModelFragment extends AbstractComponentEditor {
}
private Composite createForm(Composite parent) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
parent = createScrollableContainer(folder);
@@ -157,82 +162,93 @@ public class StringModelFragment extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.StringModelFragment_ParentId);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Composite comp = new Composite(parent, SWT.NONE);
+ final Composite comp = new Composite(parent, SWT.NONE);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
comp.setLayoutData(gd);
- GridLayout gl = new GridLayout(2, false);
+ final GridLayout gl = new GridLayout(2, false);
gl.marginWidth = gl.marginHeight = 0;
gl.verticalSpacing = 0;
gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0;
comp.setLayout(gl);
- Text t = new Text(comp, SWT.BORDER);
+ final Text t = new Text(comp, SWT.BORDER);
TextPasteHandler.createFor(t);
// t.setEditable(false);
gd = new GridData(GridData.FILL_HORIZONTAL);
t.setLayoutData(gd);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster()));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(),
+ FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__PARENT_ELEMENT_ID).observeDetail(getMaster()));
final Button b = new Button(comp, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(), StringModelFragment.this, (MStringModelFragment) getMaster().getValue(), Messages);
+ final FindParentReferenceElementDialog dialog = new FindParentReferenceElementDialog(b.getShell(),
+ StringModelFragment.this, (MStringModelFragment) getMaster().getValue(), Messages);
dialog.open();
}
});
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.StringModelFragment_Featurename);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Composite comp = new Composite(parent, SWT.NONE);
+ final Composite comp = new Composite(parent, SWT.NONE);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
comp.setLayoutData(gd);
- GridLayout gl = new GridLayout(2, false);
+ final GridLayout gl = new GridLayout(2, false);
gl.marginWidth = gl.marginHeight = 0;
gl.verticalSpacing = 0;
gl.marginLeft = gl.marginBottom = gl.marginRight = gl.marginTop = 0;
comp.setLayout(gl);
- Text t = new Text(comp, SWT.BORDER);
+ final Text t = new Text(comp, SWT.BORDER);
TextPasteHandler.createFor(t);
gd = new GridData(GridData.FILL_HORIZONTAL);
t.setLayoutData(gd);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster()));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(),
+ FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__FEATURENAME).observeDetail(getMaster()));
final Button button = new Button(comp, SWT.PUSH | SWT.FLAT);
button.setText(Messages.ModelTooling_Common_FindEllipsis);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(), getEditingDomain(), (MStringModelFragment) getMaster().getValue(), Messages);
+ final FeatureSelectionDialog dialog = new FeatureSelectionDialog(button.getShell(),
+ getEditingDomain(), (MStringModelFragment) getMaster().getValue(), Messages);
dialog.open();
}
});
}
- ControlFactory.createTextField(parent, Messages.StringModelFragment_PositionInList, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST));
+ ControlFactory.createTextField(parent, Messages.StringModelFragment_PositionInList, getMaster(), context,
+ textProp, EMFEditProperties.value(getEditingDomain(),
+ FragmentPackageImpl.Literals.STRING_MODEL_FRAGMENT__POSITION_IN_LIST));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS) {
@Override
protected void addPressed() {
- EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
+ final EClass eClass = ((FeatureClass) ((IStructuredSelection) getSelection()).getFirstElement()).eClass;
handleAdd(eClass, false);
}
@@ -248,7 +264,7 @@ public class StringModelFragment extends AbstractComponentEditor {
pickList.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
- FeatureClass eclass = (FeatureClass) element;
+ final FeatureClass eclass = (FeatureClass) element;
return eclass.label;
}
});
@@ -256,22 +272,23 @@ public class StringModelFragment extends AbstractComponentEditor {
pickList.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- FeatureClass eClass1 = (FeatureClass) e1;
- FeatureClass eClass2 = (FeatureClass) e2;
+ final FeatureClass eClass1 = (FeatureClass) e1;
+ final FeatureClass eClass2 = (FeatureClass) e2;
return eClass1.label.compareTo(eClass2.label);
}
});
- List<FeatureClass> list = new ArrayList<FeatureClass>();
+ final List<FeatureClass> list = new ArrayList<FeatureClass>();
Util.addClasses(ApplicationPackageImpl.eINSTANCE, list);
- list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT, FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS));
+ list.addAll(getEditor().getFeatureClasses(FragmentPackageImpl.Literals.MODEL_FRAGMENT,
+ FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS));
pickList.setInput(list);
if (list.size() > 0) {
pickList.setSelection(new StructuredSelection(list.get(0)));
}
- IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS);
+ final IEMFListProperty prop = EMFProperties.list(FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS);
pickList.getList().setInput(prop.observeDetail(getMaster()));
}
@@ -301,9 +318,10 @@ public class StringModelFragment extends AbstractComponentEditor {
}
protected void handleAdd(EClass eClass, boolean separator) {
- EObject eObject = EcoreUtil.create(eClass);
+ final EObject eObject = EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ FragmentPackageImpl.Literals.MODEL_FRAGMENT__ELEMENTS, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -313,7 +331,7 @@ public class StringModelFragment extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
Collections.sort(l, new Comparator<Action>() {
@Override
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java
index 9833a21f..57072d7c 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarContributionEditor.java
@@ -6,18 +6,20 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Marco Descher <marco@descher.at> - Bug 397650
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 397650
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -76,9 +78,10 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
@Optional
@@ -97,25 +100,29 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem,
+ createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem,
+ createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddToolControl,
+ createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator,
+ createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true);
@@ -126,12 +133,11 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_ToolBarContribution);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_ToolBarContribution);
}
+ return createImage(ResourceProvider.IMG_Tbr_ToolBarContribution);
}
return null;
@@ -186,7 +192,7 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -198,7 +204,7 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -206,46 +212,57 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuContributionEditor_ParentId);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
t.setLayoutData(gd);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID).observeDetail(getMaster()));
+ context.bindValue(textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__PARENT_ID)
+ .observeDetail(getMaster()));
- Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
+ final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom));
b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- ToolBarIdDialog dialog = new ToolBarIdDialog(t.getShell(), resource, (MToolBarContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
+ final ToolBarIdDialog dialog = new ToolBarIdDialog(t.getShell(), resource,
+ (MToolBarContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
dialog.open();
}
});
}
- ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT));
+ ControlFactory.createTextField(parent, Messages.MenuContributionEditor_Position, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(),
+ MenuPackageImpl.Literals.TOOL_BAR_CONTRIBUTION__POSITION_IN_PARENT));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
- EClass eClass = struct.eClass;
- MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
+ final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
+ final EClass eClass = struct.eClass;
+ final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -257,18 +274,27 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
};
pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
pickList.setText(Messages.ToolBarEditor_ToolbarItems);
- TableViewer viewer = pickList.getList();
+ final TableViewer viewer = pickList.getList();
- IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(master));
- Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
- pickList.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) });
+ final Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem,
+ MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
+ pickList.setInput(new Struct[] { defaultStruct,
+ new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false),
+ new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false),
+ new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) });
pickList.setSelection(new StructuredSelection(defaultStruct));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -276,8 +302,10 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -291,14 +319,15 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -314,16 +343,17 @@ public class ToolBarContributionEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
return l;
}
protected void handleAddChild(EClass eClass, boolean separator) {
- MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
+ final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
index 4d08fc72..82e887f7 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarEditor.java
@@ -6,16 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -61,9 +63,10 @@ public class ToolBarEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
public ToolBarEditor() {
@@ -72,25 +75,29 @@ public class ToolBarEditor extends AbstractComponentEditor {
@PostConstruct
void init() {
- actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem, createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddHandledToolItem,
+ createImageDescriptor(ResourceProvider.IMG_HandledToolItem)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem, createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddDirectToolItem,
+ createImageDescriptor(ResourceProvider.IMG_DirectToolItem)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddToolControl,
+ createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL, false);
}
});
- actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator, createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) {
+ actions.add(new Action(Messages.ToolBarEditor_AddToolBarSeparator,
+ createImageDescriptor(ResourceProvider.IMG_ToolBarSeparator)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true);
@@ -101,12 +108,11 @@ public class ToolBarEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_ToolBar);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_ToolBar);
}
+ return createImage(ResourceProvider.IMG_Tbr_ToolBar);
}
return null;
@@ -156,7 +162,7 @@ public class ToolBarEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -168,7 +174,7 @@ public class ToolBarEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -176,33 +182,49 @@ public class ToolBarEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
- EClass eClass = struct.eClass;
+ final Struct struct = (Struct) ((IStructuredSelection) getSelection()).getFirstElement();
+ final EClass eClass = struct.eClass;
handleAddChild(eClass, struct.separator);
}
};
pickList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
pickList.setText(Messages.ToolBarEditor_ToolbarItems);
- TableViewer viewer = pickList.getList();
- IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final TableViewer viewer = pickList.getList();
+ final IEMFListProperty prop = EMFEditProperties.list(getEditingDomain(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(master));
- Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem, MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
- pickList.setInput(new Struct[] { defaultStruct, new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false), new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false), new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) });
+ final Struct defaultStruct = new Struct(Messages.ToolBarEditor_HandledToolItem,
+ MenuPackageImpl.Literals.HANDLED_TOOL_ITEM, false);
+ pickList.setInput(new Struct[] { defaultStruct,
+ new Struct(Messages.ToolBarEditor_DirectToolItem, MenuPackageImpl.Literals.DIRECT_TOOL_ITEM, false),
+ new Struct(Messages.ToolBarEditor_ToolControl, MenuPackageImpl.Literals.TOOL_CONTROL, false),
+ new Struct(Messages.ToolBarEditor_Separator, MenuPackageImpl.Literals.TOOL_BAR_SEPARATOR, true) });
pickList.setSelection(new StructuredSelection(defaultStruct));
}
- ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
- ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -210,8 +232,10 @@ public class ToolBarEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
createContributedEditorTabs(folder, context, getMaster(), MToolBar.class);
@@ -237,16 +261,17 @@ public class ToolBarEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
l.addAll(actions);
return l;
}
protected void handleAddChild(EClass eClass, boolean separator) {
- MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
+ final MToolBarElement eObject = (MToolBarElement) EcoreUtil.create(eClass);
setElementId(eObject);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, eObject);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java
index 6604a305..7e91c337 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolBarSeparatorEditor.java
@@ -6,12 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.resources.IProject;
@@ -59,12 +60,11 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_ToolBarSeparator);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_ToolBarSeparator);
}
+ return createImage(ResourceProvider.IMG_Tbr_ToolBarSeparator);
}
return null;
@@ -119,7 +119,7 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -131,7 +131,7 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -139,10 +139,18 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -150,8 +158,10 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -165,14 +175,15 @@ public class ToolBarSeparatorEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java
index 75dd2dff..89bd7f14 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/ToolControlEditor.java
@@ -6,14 +6,15 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 412672
- * Steven Spungin <steven@spungin.tv> - Bug 424730
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Dmitry Spiridenok <d.spiridenok@gmail.com> - Bug 412672
+ * Steven Spungin <steven@spungin.tv> - Bug 424730
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.resources.IProject;
@@ -87,12 +88,11 @@ public class ToolControlEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_ToolControl);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_ToolControl);
}
+ return createImage(ResourceProvider.IMG_Tbr_ToolControl);
}
return null;
@@ -138,7 +138,7 @@ public class ToolControlEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -150,7 +150,7 @@ public class ToolControlEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -158,12 +158,17 @@ public class ToolControlEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
// ------------------------------------------------------------
{
- final IContributionClassCreator c = getEditor().getContributionCreator(MenuPackageImpl.Literals.TOOL_CONTROL);
+ final IContributionClassCreator c = getEditor().getContributionCreator(
+ MenuPackageImpl.Literals.TOOL_CONTROL);
if (project != null && c != null) {
final Link lnk = new Link(parent, SWT.NONE);
lnk.setText("<A>" + Messages.ToolControlEditor_ClassURI + "</A>"); //$NON-NLS-1$//$NON-NLS-2$
@@ -171,19 +176,23 @@ public class ToolControlEditor extends AbstractComponentEditor {
lnk.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project, lnk.getShell());
+ c.createOpen((MContribution) getMaster().getValue(), getEditingDomain(), project,
+ lnk.getShell());
}
});
} else {
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.ToolControlEditor_ClassURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI).observeDetail(master));
final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
@@ -192,16 +201,23 @@ public class ToolControlEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext, getEditingDomain(), (MContribution) getMaster().getValue(), ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
+ final ContributionClassDialog dialog = new ContributionClassDialog(b.getShell(), eclipseContext,
+ getEditingDomain(), (MContribution) getMaster().getValue(),
+ ApplicationPackageImpl.Literals.CONTRIBUTION__CONTRIBUTION_URI, Messages);
dialog.open();
}
});
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -209,8 +225,10 @@ public class ToolControlEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createInstanceInspection(folder);
@@ -225,27 +243,29 @@ public class ToolControlEditor extends AbstractComponentEditor {
}
private void createInstanceInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeContributionInstance);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- ObjectViewer objectViewer = new ObjectViewer();
- TreeViewer viewer = objectViewer.createViewer(container, ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages);
+ final ObjectViewer objectViewer = new ObjectViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container,
+ ApplicationPackageImpl.Literals.CONTRIBUTION__OBJECT, getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java
index ceb970a7..f1988b47 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimBarEditor.java
@@ -6,17 +6,19 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.WritableValue;
@@ -77,9 +79,10 @@ public class TrimBarEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
@Optional
@@ -105,7 +108,8 @@ public class TrimBarEditor extends AbstractComponentEditor {
handleAddChild(MenuPackageImpl.Literals.TOOL_BAR);
}
});
- actions.add(new Action(Messages.TrimBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
+ actions.add(new Action(Messages.TrimBarEditor_AddToolControl,
+ createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL);
@@ -116,12 +120,11 @@ public class TrimBarEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_WindowTrim);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_WindowTrim);
}
+ return createImage(ResourceProvider.IMG_Tbr_WindowTrim);
}
return null;
@@ -171,7 +174,7 @@ public class TrimBarEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -183,7 +186,7 @@ public class TrimBarEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -191,31 +194,37 @@ public class TrimBarEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.TrimBarEditor_Side);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- ComboViewer viewer = new ComboViewer(parent);
+ final ComboViewer viewer = new ComboViewer(parent);
viewer.setContentProvider(new ArrayContentProvider());
viewer.setInput(SideValue.values());
- GridData gd = new GridData();
+ final GridData gd = new GridData();
gd.horizontalSpan = 2;
viewer.getControl().setLayoutData(gd);
- IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE).observeDetail(master);
+ final IObservableValue sideValueObs = EMFEditProperties.value(getEditingDomain(),
+ UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE).observeDetail(master);
context.bindValue(ViewerProperties.singleSelection().observe(viewer), sideValueObs);
}
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER), Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, Arrays.asList(PickListFeatures.NO_PICKER),
+ Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement();
+ final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement();
handleAddChild(eClass);
}
};
@@ -225,15 +234,20 @@ public class TrimBarEditor extends AbstractComponentEditor {
final TableViewer viewer = pickList.getList();
pickList.setLabelProvider(new EClassLabelProvider(getEditor()));
- pickList.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
+ pickList
+ .setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
pickList.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR));
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -241,8 +255,10 @@ public class TrimBarEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -256,14 +272,15 @@ public class TrimBarEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -274,7 +291,7 @@ public class TrimBarEditor extends AbstractComponentEditor {
@Override
public String getDetailLabel(Object element) {
- MGenericTrimContainer<?> trim = (MGenericTrimContainer<?>) element;
+ final MGenericTrimContainer<?> trim = (MGenericTrimContainer<?>) element;
if (trim.getSide() != null) {
return trim.getSide().toString();
@@ -285,14 +302,16 @@ public class TrimBarEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.GENERIC_TRIM_CONTAINER__SIDE),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
protected void handleAddChild(EClass eClass) {
- EObject toolbar = EcoreUtil.create(eClass);
+ final EObject toolbar = EcoreUtil.create(eClass);
setElementId(toolbar);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -302,7 +321,7 @@ public class TrimBarEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final 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/TrimContributionEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java
index c4bebe9f..7c238752 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/TrimContributionEditor.java
@@ -6,18 +6,20 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Marco Descher <marco@descher.at> - Bug 397650
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Marco Descher <marco@descher.at> - Bug 397650
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Nicolaj Hoess <nicohoess@gmail.com> - Bug 396975
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.value.WritableValue;
import org.eclipse.core.databinding.property.list.IListProperty;
@@ -78,9 +80,10 @@ public class TrimContributionEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
private StackLayout stackLayout;
- private List<Action> actions = new ArrayList<Action>();
+ private final List<Action> actions = new ArrayList<Action>();
@Inject
@Optional
@@ -105,7 +108,8 @@ public class TrimContributionEditor extends AbstractComponentEditor {
handleAddChild(MenuPackageImpl.Literals.TOOL_BAR);
}
});
- actions.add(new Action(Messages.TrimBarEditor_AddToolControl, createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
+ actions.add(new Action(Messages.TrimBarEditor_AddToolControl,
+ createImageDescriptor(ResourceProvider.IMG_ToolControl)) {
@Override
public void run() {
handleAddChild(MenuPackageImpl.Literals.TOOL_CONTROL);
@@ -116,12 +120,11 @@ public class TrimContributionEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_TrimContribution);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_TrimContribution);
}
+ return createImage(ResourceProvider.IMG_Tbr_TrimContribution);
}
return null;
@@ -176,7 +179,7 @@ public class TrimContributionEditor extends AbstractComponentEditor {
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -188,7 +191,7 @@ public class TrimContributionEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -196,41 +199,52 @@ public class TrimContributionEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
- ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, master, context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(),
+ context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE));
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.MenuContributionEditor_ParentId);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
final Text t = new Text(parent, SWT.BORDER);
TextPasteHandler.createFor(t);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
t.setLayoutData(gd);
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID).observeDetail(getMaster()));
+ context.bindValue(textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.MENU_CONTRIBUTION__PARENT_ID)
+ .observeDetail(getMaster()));
- Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
+ final Button b = new Button(parent, SWT.PUSH | SWT.FLAT);
b.setText(Messages.ModelTooling_Common_FindEllipsis);
b.setImage(createImage(ResourceProvider.IMG_Obj16_zoom));
b.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, false, false));
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- TrimIdDialog dialog = new TrimIdDialog(t.getShell(), resource, (MTrimContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
+ final TrimIdDialog dialog = new TrimIdDialog(t.getShell(), resource,
+ (MTrimContribution) getMaster().getValue(), getEditingDomain(), modelService, Messages);
dialog.open();
}
});
}
- ControlFactory.createTextField(parent, Messages.TrimContributionEditor_Position, master, context, textProp, EMFEditProperties.value(getEditingDomain(), MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT));
+ ControlFactory
+ .createTextField(parent, Messages.TrimContributionEditor_Position, master, context, textProp,
+ EMFEditProperties.value(getEditingDomain(),
+ MenuPackageImpl.Literals.TRIM_CONTRIBUTION__POSITION_IN_PARENT));
// ------------------------------------------------------------
{
- E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this, UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
+ final E4PickList pickList = new E4PickList(parent, SWT.NONE, null, Messages, this,
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN) {
@Override
protected void addPressed() {
- EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement();
+ final EClass eClass = (EClass) ((IStructuredSelection) getSelection()).getFirstElement();
handleAddChild(eClass);
}
};
@@ -240,7 +254,7 @@ public class TrimContributionEditor extends AbstractComponentEditor {
final TableViewer viewer = pickList.getList();
viewer.setLabelProvider(new ComponentLabelProvider(getEditor(), Messages));
viewer.setContentProvider(new ObservableListContentProvider());
- IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ final IEMFListProperty prop = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
viewer.setInput(prop.observeDetail(getMaster()));
pickList.setContentProvider(new ArrayContentProvider());
@@ -250,12 +264,17 @@ public class TrimContributionEditor extends AbstractComponentEditor {
return ((EClass) element).getName();
}
});
- pickList.setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
+ pickList
+ .setInput(new Object[] { MenuPackageImpl.Literals.TOOL_BAR, MenuPackageImpl.Literals.TOOL_CONTROL });
pickList.setSelection(new StructuredSelection(MenuPackageImpl.Literals.TOOL_BAR));
}
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
- ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_ToBeRendered, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED));
+ ControlFactory.createCheckBox(parent, Messages.ModelTooling_UIElement_Visible, getMaster(), context,
+ WidgetProperties.selection(),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE));
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -263,8 +282,10 @@ public class TrimContributionEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -278,14 +299,15 @@ public class TrimContributionEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
@@ -300,10 +322,11 @@ public class TrimContributionEditor extends AbstractComponentEditor {
}
protected void handleAddChild(EClass eClass) {
- EObject toolbar = EcoreUtil.create(eClass);
+ final EObject toolbar = EcoreUtil.create(eClass);
setElementId(toolbar);
- Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(), UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar);
+ final Command cmd = AddCommand.create(getEditingDomain(), getMaster().getValue(),
+ UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN, toolbar);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
@@ -313,7 +336,7 @@ public class TrimContributionEditor extends AbstractComponentEditor {
@Override
public List<Action> getActions(Object element) {
- ArrayList<Action> l = new ArrayList<Action>(super.getActions(element));
+ final 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/UnsettableUpdateValueStrategy.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
index 8dba05f8..e942474d 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/UnsettableUpdateValueStrategy.java
@@ -1,11 +1,12 @@
/*******************************************************************************
- * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Ongoing maintenance
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.core.databinding.conversion.Converter;
import org.eclipse.core.databinding.conversion.IConverter;
import org.eclipse.core.databinding.observable.value.IObservableValue;
@@ -18,31 +19,25 @@ import org.eclipse.emf.ecore.EFactory;
import org.eclipse.emf.edit.command.SetCommand;
/**
- * An updater to deal with unsettable primitive attributes on EMF objects. EMF's
- * {@link EMFEditValueProperty}/{@link EMFValueProperty} does an eGet to
+ * An updater to deal with unsettable primitive attributes on EMF objects. EMF's {@link EMFEditValueProperty}/
+ * {@link EMFValueProperty} does an eGet to
* retrieve the attribute value, with no regard as to whether the attribute is
* unset. If the attribute is unset, then eGet() will return the default value.
*
* This implementation makes several assumptions:
* <ul>
- * <li>Assumes that these unsettable attributes have a nonsensical default value
- * that can be used to detect an eGet of an unset attribute.</li>
- * <li>Assumes that we are using EMFEditObservables so that changes are
- * described using {@link SetCommand}, such that we can provide
- * {@link SetCommand#UNSET_VALUE} to remove a value.</li>
+ * <li>Assumes that these unsettable attributes have a nonsensical default value that can be used to detect an eGet of
+ * an unset attribute.</li>
+ * <li>Assumes that we are using EMFEditObservables so that changes are described using {@link SetCommand}, such that we
+ * can provide {@link SetCommand#UNSET_VALUE} to remove a value.</li>
* </ul>
* See the following discussions for background details:
* <ul>
- * <li><a
- * href="http://www.eclipse.org/forums/index.php?t=msg&th=165026/">Dynamic eGet
- * for unsettable attributes</a></li>
- * <li><a
- * href="http://www.eclipsezone.com/eclipse/forums/t114431.html?start=15">
- * Creating a ComboViewer for an EReference</a> particularly the later postings
- * from Tom Schindl on handling null values</li>
- * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=174967/">
- * ObservableMapCellLabelProvider doesn't work well with unsettable features</a>
- * </li>
+ * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=165026/">Dynamic eGet for unsettable attributes</a></li>
+ * <li><a href="http://www.eclipsezone.com/eclipse/forums/t114431.html?start=15"> Creating a ComboViewer for an
+ * EReference</a> particularly the later postings from Tom Schindl on handling null values</li>
+ * <li><a href="http://www.eclipse.org/forums/index.php?t=msg&th=174967/"> ObservableMapCellLabelProvider doesn't work
+ * well with unsettable features</a></li>
* </ul>
*/
public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy {
@@ -56,21 +51,20 @@ public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy {
return new Converter(fromType, toType) {
@Override
public Object convert(Object fromObject) {
- String value = fromObject == null ? null : fromObject.toString();
+ final String value = fromObject == null ? null : fromObject.toString();
if (value == null || value.length() == 0) {
return SetCommand.UNSET_VALUE;
}
if (eAttribute.isMany()) {
- List<Object> result = new ArrayList<Object>();
- if (value != null) {
- for (String element : value.split(" ")) { //$NON-NLS-1$
- result.add(eFactory.createFromString(eDataType, element));
- }
+ final List<Object> result = new ArrayList<Object>();
+
+ for (final String element : value.split(" ")) { //$NON-NLS-1$
+ result.add(eFactory.createFromString(eDataType, element));
+
}
return result;
- } else {
- return eFactory.createFromString(eDataType, value);
}
+ return eFactory.createFromString(eDataType, value);
}
};
}
@@ -83,21 +77,21 @@ public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy {
@Override
public Object convert(Object fromObject) {
if (eAttribute.isMany()) {
- StringBuilder result = new StringBuilder();
- for (Object value : (List<?>) fromObject) {
+ final StringBuilder result = new StringBuilder();
+ for (final Object value : (List<?>) fromObject) {
if (result.length() == 0) {
result.append(' ');
}
result.append(eFactory.convertToString(eDataType, value));
}
return result.toString();
- } else {
- // If the value
- if (fromObject == SetCommand.UNSET_VALUE || fromObject == null || fromObject.equals(eAttribute.getDefaultValue())) {
- return ""; //$NON-NLS-1$
- }
- return eFactory.convertToString(eDataType, fromObject);
}
+ // If the value
+ if (fromObject == SetCommand.UNSET_VALUE || fromObject == null
+ || fromObject.equals(eAttribute.getDefaultValue())) {
+ return ""; //$NON-NLS-1$
+ }
+ return eFactory.convertToString(eDataType, fromObject);
}
};
}
@@ -107,7 +101,6 @@ public class UnsettableUpdateValueStrategy extends EMFUpdateValueStrategy {
/*
* (non-Javadoc)
- *
* @see
* org.eclipse.core.databinding.UpdateValueStrategy#doSet(org.eclipse.core
* .databinding.observable.value.IObservableValue, java.lang.Object)
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
index b6538652..b25ad1e5 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WindowEditor.java
@@ -6,16 +6,18 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
- * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
- * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Lars Vogel <Lars.Vogel@gmail.com> - Ongoing maintenance
+ * Steven Spungin <steven@spungin.tv> - Bug 424730, Bug 437951
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import javax.annotation.PostConstruct;
import javax.inject.Inject;
+
import org.eclipse.core.databinding.observable.list.IObservableList;
import org.eclipse.core.databinding.observable.list.WritableList;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
@@ -76,11 +78,13 @@ public class WindowEditor extends AbstractComponentEditor {
private Composite composite;
private EMFDataBindingContext context;
- private IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties.list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS);
- private IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS);
- private IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties.list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
- private IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS);
- private IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU);
+ private final IListProperty HANDLER_CONTAINER__HANDLERS = EMFProperties
+ .list(CommandsPackageImpl.Literals.HANDLER_CONTAINER__HANDLERS);
+ private final IListProperty WINDOW__WINDOWS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__WINDOWS);
+ private final IListProperty ELEMENT_CONTAINER__CHILDREN = EMFProperties
+ .list(UiPackageImpl.Literals.ELEMENT_CONTAINER__CHILDREN);
+ private final IListProperty SHARED_ELEMENTS = EMFProperties.list(BasicPackageImpl.Literals.WINDOW__SHARED_ELEMENTS);
+ private final IValueProperty WINDOW__MAIN_MENU = EMFProperties.value(BasicPackageImpl.Literals.WINDOW__MAIN_MENU);
private Action addMainMenu;
private Button createRemoveMainMenu;
@@ -111,12 +115,11 @@ public class WindowEditor extends AbstractComponentEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_Window);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_Window);
}
+ return createImage(ResourceProvider.IMG_Tbr_Window);
}
return null;
@@ -166,13 +169,14 @@ public class WindowEditor extends AbstractComponentEditor {
}
getMaster().setValue(object);
- enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
+ enableIdGenerator(UiPackageImpl.Literals.UI_LABEL__LABEL,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID, null);
return composite;
}
private Composite createForm(Composite parent, EMFDataBindingContext context, WritableValue master, boolean isImport) {
- CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
+ final CTabFolder folder = new CTabFolder(parent, SWT.BOTTOM);
CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabDefault);
@@ -184,7 +188,7 @@ public class WindowEditor extends AbstractComponentEditor {
ControlFactory.createXMIId(parent, this);
}
- IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
+ final IWidgetValueProperty textProp = WidgetProperties.text(SWT.Modify);
if (isImport) {
ControlFactory.createFindImport(parent, Messages, this, context);
@@ -192,59 +196,79 @@ public class WindowEditor extends AbstractComponentEditor {
return folder;
}
- ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
+ ControlFactory.createTextField(parent, Messages.ModelTooling_Common_Id, getMaster(), context, textProp,
+ EMFEditProperties
+ .value(getEditingDomain(), ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__ELEMENT_ID));
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.WindowEditor_Bounds);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout(4, true);
+ final Composite comp = new Composite(parent, SWT.NONE);
+ final GridLayout layout = new GridLayout(4, true);
layout.marginWidth = 0;
layout.marginHeight = 0;
comp.setLayout(layout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
comp.setLayoutData(gd);
Text t = new Text(comp, SWT.BORDER | SWT.TRAIL);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__X).observeDetail(
+ getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
t = new Text(comp, SWT.BORDER | SWT.TRAIL);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__Y).observeDetail(
+ getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
t = new Text(comp, SWT.BORDER | SWT.TRAIL);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__WIDTH).observeDetail(
+ getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
t = new Text(comp, SWT.BORDER | SWT.TRAIL);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), BasicPackageImpl.Literals.WINDOW__HEIGHT).observeDetail(
+ getMaster()), new UnsettableUpdateValueStrategy(), new UnsettableUpdateValueStrategy());
}
- ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
- ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Label, getMaster(), context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__LABEL), resourcePool, project);
+ ControlFactory.createTranslatedTextField(parent, Messages.WindowEditor_Tooltip, getMaster(), context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__TOOLTIP), resourcePool,
+ project);
// ------------------------------------------------------------
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.WindowEditor_IconURI);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
- Text t = new Text(parent, SWT.BORDER);
+ final Text t = new Text(parent, SWT.BORDER);
t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- context.bindValue(textProp.observeDelayed(200, t), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(master));
+ context.bindValue(
+ textProp.observeDelayed(200, t),
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_LABEL__ICON_URI).observeDetail(
+ master));
new ImageTooltip(t, Messages) {
@Override
protected URI getImageURI() {
- MUILabel part = (MUILabel) getMaster().getValue();
- String uri = part.getIconURI();
+ final MUILabel part = (MUILabel) getMaster().getValue();
+ final String uri = part.getIconURI();
if (uri == null || uri.trim().length() == 0) {
return null;
}
@@ -259,14 +283,15 @@ public class WindowEditor extends AbstractComponentEditor {
b.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), eclipseContext, project, getEditingDomain(), (MWindow) getMaster().getValue(), Messages);
+ final WindowIconDialogEditor dialog = new WindowIconDialogEditor(b.getShell(), eclipseContext,
+ project, getEditingDomain(), (MWindow) getMaster().getValue(), Messages);
dialog.open();
}
});
}
{
- Label l = new Label(parent, SWT.NONE);
+ final Label l = new Label(parent, SWT.NONE);
l.setText(Messages.WindowEditor_MainMenu);
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
@@ -274,7 +299,7 @@ public class WindowEditor extends AbstractComponentEditor {
createRemoveMainMenu.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- MWindow window = (MWindow) getMaster().getValue();
+ final MWindow window = (MWindow) getMaster().getValue();
if (window.getMainMenu() == null) {
addMenu();
} else {
@@ -285,12 +310,19 @@ public class WindowEditor extends AbstractComponentEditor {
createRemoveMainMenu.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1));
}
- ControlFactory.createCheckBox(parent, "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
- ControlFactory.createCheckBox(parent, "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "To Be Rendered", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED)); //$NON-NLS-1$
+ ControlFactory
+ .createCheckBox(
+ parent,
+ "Visible", getMaster(), context, WidgetProperties.selection(), EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__VISIBLE)); //$NON-NLS-1$
ControlFactory.createSelectedElement(parent, this, context, Messages.WindowEditor_SelectedElement);
ControlFactory.createBindingContextWiget(parent, Messages, this, Messages.WindowEditor_BindingContexts);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties, UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Context_Properties,
+ UiPackageImpl.Literals.CONTEXT__PROPERTIES, VERTICAL_LIST_WIDGET_INDENT);
item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_TabSupplementary);
@@ -298,10 +330,16 @@ public class WindowEditor extends AbstractComponentEditor {
parent = createScrollableContainer(folder);
item.setControl(parent.getParent());
- ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase, getMaster(), context, textProp, EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE), resourcePool, project);
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables, UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
- ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState, ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createTranslatedTextField(parent, Messages.ModelTooling_UIElement_AccessibilityPhrase,
+ getMaster(), context, textProp,
+ EMFEditProperties.value(getEditingDomain(), UiPackageImpl.Literals.UI_ELEMENT__ACCESSIBILITY_PHRASE),
+ resourcePool, project);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.ModelTooling_Context_Variables,
+ UiPackageImpl.Literals.CONTEXT__VARIABLES, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createStringListWidget(parent, Messages, this, Messages.CategoryEditor_Tags,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__TAGS, VERTICAL_LIST_WIDGET_INDENT);
+ ControlFactory.createMapProperties(parent, Messages, this, Messages.ModelTooling_Contribution_PersistedState,
+ ApplicationPackageImpl.Literals.APPLICATION_ELEMENT__PERSISTED_STATE, VERTICAL_LIST_WIDGET_INDENT);
if (project == null) {
createUITreeInspection(folder);
@@ -315,29 +353,32 @@ public class WindowEditor extends AbstractComponentEditor {
}
private void createUITreeInspection(CTabFolder folder) {
- CTabItem item = new CTabItem(folder, SWT.NONE);
+ final CTabItem item = new CTabItem(folder, SWT.NONE);
item.setText(Messages.ModelTooling_Common_RuntimeWidgetTree);
- Composite container = new Composite(folder, SWT.NONE);
+ final Composite container = new Composite(folder, SWT.NONE);
container.setLayout(new GridLayout());
item.setControl(container);
- UIViewer objectViewer = new UIViewer();
- TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET, getMaster(), resourcePool, Messages);
+ final UIViewer objectViewer = new UIViewer();
+ final TreeViewer viewer = objectViewer.createViewer(container, UiPackageImpl.Literals.UI_ELEMENT__WIDGET,
+ getMaster(), resourcePool, Messages);
viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
}
void removeMenu() {
- Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null);
+ final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(),
+ BasicPackageImpl.Literals.WINDOW__MAIN_MENU, null);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
}
void addMenu() {
- MMenu menu = MMenuFactory.INSTANCE.createMenu();
+ final MMenu menu = MMenuFactory.INSTANCE.createMenu();
setElementId(menu);
- Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(), BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu);
+ final Command cmd = SetCommand.create(getEditingDomain(), getMaster().getValue(),
+ BasicPackageImpl.Literals.WINDOW__MAIN_MENU, menu);
if (cmd.canExecute()) {
getEditingDomain().getCommandStack().execute(cmd);
}
@@ -350,7 +391,8 @@ public class WindowEditor extends AbstractComponentEditor {
return list;
}
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element, Messages.WindowEditor_Handlers) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_HANDLER, HANDLER_CONTAINER__HANDLERS, element,
+ Messages.WindowEditor_Handlers) {
@Override
protected boolean accepted(Object o) {
@@ -359,7 +401,8 @@ public class WindowEditor extends AbstractComponentEditor {
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_WINDOWS, WINDOW__WINDOWS, element, Messages.WindowEditor_Windows) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_WINDOWS, WINDOW__WINDOWS, element,
+ Messages.WindowEditor_Windows) {
@Override
protected boolean accepted(Object o) {
@@ -368,7 +411,8 @@ public class WindowEditor extends AbstractComponentEditor {
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element, Messages.WindowEditor_Controls) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_CONTROLS, ELEMENT_CONTAINER__CHILDREN, element,
+ Messages.WindowEditor_Controls) {
@Override
protected boolean accepted(Object o) {
@@ -377,14 +421,15 @@ public class WindowEditor extends AbstractComponentEditor {
});
- list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element, Messages.WindowEditor_SharedElements) {
+ list.add(new VirtualEntry<Object>(ModelEditor.VIRTUAL_WINDOW_SHARED_ELEMENTS, SHARED_ELEMENTS, element,
+ Messages.WindowEditor_SharedElements) {
@Override
protected boolean accepted(Object o) {
return true;
}
});
- MWindow window = (MWindow) element;
+ final MWindow window = (MWindow) element;
if (window.getMainMenu() != null) {
list.add(0, window.getMainMenu());
}
@@ -419,14 +464,15 @@ public class WindowEditor extends AbstractComponentEditor {
@Override
public FeaturePath[] getLabelProperties() {
- return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL), FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
+ return new FeaturePath[] { FeaturePath.fromList(UiPackageImpl.Literals.UI_LABEL__LABEL),
+ FeaturePath.fromList(UiPackageImpl.Literals.UI_ELEMENT__TO_BE_RENDERED) };
}
@Override
public List<Action> getActions(Object element) {
- List<Action> actions = new ArrayList<Action>();
+ final List<Action> actions = new ArrayList<Action>();
- MWindow window = (MWindow) element;
+ final MWindow window = (MWindow) element;
if (window.getMainMenu() == null) {
actions.add(getActionAddMainMenu());
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java
index 7389d7e1..ebabc7ae 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/WizardDialogEditor.java
@@ -6,12 +6,13 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component;
import java.util.ArrayList;
import java.util.List;
+
import org.eclipse.e4.tools.emf.ui.internal.ResourceProvider;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.model.application.ui.basic.MWizardDialog;
@@ -24,12 +25,11 @@ public class WizardDialogEditor extends WindowEditor {
@Override
public Image getImage(Object element, Display display) {
if (element instanceof MUIElement) {
- MUIElement uiElement = (MUIElement) element;
+ final MUIElement uiElement = (MUIElement) element;
if (uiElement.isToBeRendered() && uiElement.isVisible()) {
return createImage(ResourceProvider.IMG_WizardDialog);
- } else {
- return createImage(ResourceProvider.IMG_Tbr_WizardDialog);
}
+ return createImage(ResourceProvider.IMG_Tbr_WizardDialog);
}
return null;
@@ -42,9 +42,9 @@ public class WizardDialogEditor extends WindowEditor {
@Override
public List<Action> getActions(Object element) {
- List<Action> actions = new ArrayList<Action>();
+ final List<Action> actions = new ArrayList<Action>();
- MWizardDialog dialog = (MWizardDialog) element;
+ final MWizardDialog dialog = (MWizardDialog) element;
if (dialog.getMainMenu() == null) {
actions.add(getActionAddMainMenu());
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java
index 48c62637..44a2a074 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandledToolItemCommandSelectionDialog.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -20,10 +20,12 @@ import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.swt.widgets.Shell;
+@SuppressWarnings("restriction")
public class HandledToolItemCommandSelectionDialog extends AbstractCommandSelectionDialog {
- private MHandledItem handler;
+ private final MHandledItem handler;
- public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource, Messages Messages) {
+ public HandledToolItemCommandSelectionDialog(Shell parentShell, MHandledItem handler, IModelResource resource,
+ Messages Messages) {
super(parentShell, resource, Messages);
this.handler = handler;
}
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java
index afa6facb..2cda1c45 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/dialogs/HandlerCommandSelectionDialog.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
+ * Tom Schindl <tom.schindl@bestsolution.at> - initial API and implementation
******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.dialogs;
@@ -20,8 +20,9 @@ import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.swt.widgets.Shell;
+@SuppressWarnings("restriction")
public class HandlerCommandSelectionDialog extends AbstractCommandSelectionDialog {
- private MHandler handler;
+ private final MHandler handler;
public HandlerCommandSelectionDialog(Shell parentShell, MHandler handler, IModelResource resource, Messages Messages) {
super(parentShell, resource, Messages);
diff --git a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java
index 534fdde4..c409cfff 100644
--- a/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java
+++ b/bundles/org.eclipse.e4.tools.emf.ui/src/org/eclipse/e4/tools/emf/ui/internal/common/component/tabs/ContributionUriCellEditor.java
@@ -14,8 +14,8 @@ import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.Bundl
import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.IconDialog;
import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.UriDialog;
import org.eclipse.e4.tools.emf.ui.internal.common.resourcelocator.dialogs.UriDialogType;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.DialogCellEditor;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -46,10 +46,9 @@ public class ContributionUriCellEditor extends DialogCellEditor {
@Override
protected Object openDialogBox(Control cellEditorWindow) {
dlg.setUri((String) getValue());
- if (dlg.open() == Dialog.OK) {
+ if (dlg.open() == Window.OK) {
return dlg.getUri();
- } else {
- return getValue();
}
+ return getValue();
}
}

Back to the top