added isWebApplication to controlContext
Controls have to provide a help text now
when in a web application a help button appears instead of tooltips
added dialog wrapper extension
diff --git a/ECP2/org.eclipse.emf.ecp-feature/feature.xml b/ECP2/org.eclipse.emf.ecp-feature/feature.xml
index a0d6244..4ae2afc 100644
--- a/ECP2/org.eclipse.emf.ecp-feature/feature.xml
+++ b/ECP2/org.eclipse.emf.ecp-feature/feature.xml
@@ -77,11 +77,4 @@
version="0.0.0"
unpack="false"/>
- <plugin
- id="org.eclipse.emf.ecp.common"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
</feature>
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/icons/help.png b/ECP2/org.eclipse.emf.ecp.edit.swt/icons/help.png
new file mode 100644
index 0000000..5c87017
--- /dev/null
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/icons/help.png
Binary files differ
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/plugin.xml b/ECP2/org.eclipse.emf.ecp.edit.swt/plugin.xml
index b9595c4..547ed00 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/plugin.xml
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/plugin.xml
@@ -2,6 +2,7 @@
<?eclipse version="3.4"?>
<plugin>
<extension-point id="celleditor" name="ECP SWT Table CellEditor" schema="schema/celleditor.exsd"/>
+ <extension-point id="dialogWrapper" name="Dialog Wrapper" schema="schema/dialogWrapper.exsd"/>
<extension
point="org.eclipse.emf.ecp.edit.controls">
<control
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/schema/dialogWrapper.exsd b/ECP2/org.eclipse.emf.ecp.edit.swt/schema/dialogWrapper.exsd
new file mode 100644
index 0000000..3dc8845
--- /dev/null
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/schema/dialogWrapper.exsd
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.emf.ecp.edit.swt" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.emf.ecp.edit.swt" id="dialogWrapper" name="Dialog Wrapper"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="dialogWrapper"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="dialogWrapper">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.emf.ecp.edit.internal.swt.util.DialogWrapper"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/BooleanControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/BooleanControl.java
index 0380ee3..3f115e3 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/BooleanControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/BooleanControl.java
@@ -69,4 +69,13 @@
IObservableValue targetValue = SWTObservables.observeSelection(check);
getDataBindingContext().bindValue(targetValue, getModelValue());
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "This is a boolean field";
+ }
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/DateTimeControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/DateTimeControl.java
index 667df81..b48f3ea 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/DateTimeControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/DateTimeControl.java
@@ -166,4 +166,13 @@
getDataBindingContext().bindValue(target, getModelValue());
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "This is a date-time control. The date field is DD.MM.YYYY and the time field is mm:hh";
+ }
+
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/EEnumControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/EEnumControl.java
index fdbcb02..f212e44 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/EEnumControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/EEnumControl.java
@@ -79,4 +79,13 @@
getDataBindingContext().bindValue(target, getModelValue());
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "This is an enum field. You can select a value here.";
+ }
+
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/LinkControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/LinkControl.java
index 5b131ab..36f3fe1 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/LinkControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/LinkControl.java
@@ -294,4 +294,13 @@
hyperlink.dispose();
super.dispose();
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "A link control pointing to a referenced element.";
+ }
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalControl.java
index b418550..db2dd7d 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/NumericalControl.java
@@ -29,6 +29,8 @@
* @author Eugen Neufeld
*/
public class NumericalControl extends AbstractTextControl {
+ private String helpText;
+
/**
* Constructor for a String control.
*
@@ -41,6 +43,41 @@
public NumericalControl(boolean showLabel, IItemPropertyDescriptor itemPropertyDescriptor,
EStructuralFeature feature, ECPControlContext modelElementContext, boolean embedded) {
super(showLabel, itemPropertyDescriptor, feature, modelElementContext, embedded);
+
+ prepareHelpText();
+ }
+
+ /**
+ *
+ */
+ private void prepareHelpText() {
+ Class<?> instanceClass = getStructuralFeature().getEType().getInstanceClass();
+ if (instanceClass.isPrimitive()) {
+ try {
+ if (Integer.class.getField("TYPE").get(null).equals(instanceClass)) {
+ helpText = "This is an Integer Field. The format is '#'.";
+ } else if (Double.class.getField("TYPE").get(null).equals(instanceClass)) {
+ helpText = "This is an Float Field. The format is '#.#'.";
+ }
+ } catch (NoSuchFieldException e) {
+ Activator.logException(e);
+ } catch (IllegalArgumentException e) {
+ Activator.logException(e);
+ } catch (IllegalAccessException e) {
+ Activator.logException(e);
+ } catch (SecurityException e) {
+ Activator.logException(e);
+ }
+
+ } else if (BigInteger.class.isAssignableFrom(instanceClass)) {
+ helpText = "This is an Integer Field. The format is '#'.";
+ } else if (Integer.class.isAssignableFrom(instanceClass)) {
+ helpText = "This is an Integer Field. The format is '#'.";
+ } else if (BigDecimal.class.isAssignableFrom(instanceClass)) {
+ helpText = "This is an Float Field. The format is '#.#'.";
+ } else if (Double.class.isAssignableFrom(instanceClass)) {
+ helpText = "This is an Float Field. The format is '#.#'.";
+ }
}
@Override
@@ -59,32 +96,13 @@
@Override
protected void customizeText(Text text) {
- Class<?> instanceClass = getStructuralFeature().getEType().getInstanceClass();
- if (instanceClass.isPrimitive()) {
- try {
- if (Integer.class.getField("TYPE").get(null).equals(instanceClass)) {
- text.setToolTipText("This is an Integer Field. The format is '#'.");
- } else if (Double.class.getField("TYPE").get(null).equals(instanceClass)) {
- text.setToolTipText("This is an Float Field. The format is '#.#'.");
- }
- } catch (NoSuchFieldException e) {
- Activator.logException(e);
- } catch (IllegalArgumentException e) {
- Activator.logException(e);
- } catch (IllegalAccessException e) {
- Activator.logException(e);
- } catch (SecurityException e) {
- Activator.logException(e);
- }
-
- } else if (BigInteger.class.isAssignableFrom(instanceClass)) {
- text.setToolTipText("This is an Integer Field. The format is '#'.");
- } else if (Integer.class.isAssignableFrom(instanceClass)) {
- text.setToolTipText("This is an Integer Field. The format is '#'.");
- } else if (BigDecimal.class.isAssignableFrom(instanceClass)) {
- text.setToolTipText("This is an Float Field. The format is '#.#'.");
- } else if (Double.class.isAssignableFrom(instanceClass)) {
- text.setToolTipText("This is an Float Field. The format is '#.#'.");
+ if (!getModelElementContext().isRunningAsWebApplication()) {
+ text.setToolTipText(helpText);
}
}
+
+ @Override
+ protected String getHelpText() {
+ return helpText;
+ }
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/SingleControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/SingleControl.java
index 47cb14f..65b7738 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/SingleControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/SingleControl.java
@@ -15,14 +15,21 @@
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecp.edit.ECPControlContext;
import org.eclipse.emf.ecp.edit.internal.swt.Activator;
+import org.eclipse.emf.ecp.edit.internal.swt.util.ECPDialogExecutor;
import org.eclipse.emf.ecp.edit.internal.swt.util.SWTControl;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
+import org.eclipse.jface.dialogs.IDialogLabelKeys;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
@@ -59,12 +66,15 @@
* @see org.eclipse.emf.ecp.internal.edit.controls.AbstractControl#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
- public Composite createControl(Composite parent) {
+ public Composite createControl(final Composite parent) {
final Composite composite = new Composite(parent, SWT.NONE);
int numColumns = 2;
if (isEmbedded()) {
numColumns--;
}
+ if (getModelElementContext().isRunningAsWebApplication()) {
+ numColumns++;
+ }
GridLayoutFactory.fillDefaults().numColumns(numColumns).spacing(10, 0).applyTo(composite);
GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.BEGINNING).applyTo(composite);
if (!isEmbedded()) {
@@ -79,10 +89,39 @@
fillInnerComposite(innerComposite);
setEditable(isEditable());
bindValue();
+
+ if (getModelElementContext().isRunningAsWebApplication()) {
+ Button b = new Button(composite, SWT.PUSH);
+ b.setImage(Activator.getImage("icons/help.png"));
+ b.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ MessageDialog dialog = new MessageDialog(parent.getShell(), "Help", null, getHelpText(),
+ MessageDialog.INFORMATION, new String[] { JFaceResources
+ .getString(IDialogLabelKeys.OK_LABEL_KEY) }, 0);
+ new ECPDialogExecutor(dialog) {
+
+ @Override
+ public void handleResult(int codeResult) {
+
+ }
+ }.execute();
+ }
+
+ });
+ }
+
return composite;
}
/**
+ * @return
+ */
+ protected abstract String getHelpText();
+
+ /**
* This method must be overridden by concrete classes. Here the widget displaying the data is added to the
* composite.
*
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/StringControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/StringControl.java
index b313d6d..0c4f386 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/StringControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/StringControl.java
@@ -73,4 +73,13 @@
protected String getTextVariantID() {
return "org_eclipse_emf_ecp_control_swt_string";
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "This is a free text control.";
+ }
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/TableControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/TableControl.java
index fcdefd5..e266551 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/TableControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/TableControl.java
@@ -23,6 +23,7 @@
import org.eclipse.emf.ecp.edit.internal.swt.Activator;
import org.eclipse.emf.ecp.edit.internal.swt.util.CellEditorFactory;
import org.eclipse.emf.ecp.edit.internal.swt.util.ECPCellEditor;
+import org.eclipse.emf.ecp.edit.internal.swt.util.ECPDialogExecutor;
import org.eclipse.emf.ecp.edit.internal.swt.util.SWTControl;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
@@ -39,9 +40,13 @@
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
import org.eclipse.jface.databinding.viewers.ObservableMapCellLabelProvider;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogLabelKeys;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewerEditor;
import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent;
@@ -172,6 +177,12 @@
// create a new column
final TableViewerColumn column = new TableViewerColumn(tableViewer, cellEditor.getStyle());
+ if (ECPCellEditor.class.isInstance(cellEditor)) {
+ column.getColumn().setData("width", ((ECPCellEditor) cellEditor).getColumnWidthWeight());
+ } else {
+ column.getColumn().setData("width", 100);
+ }
+
// determine the attribute that should be observed
IObservableMap map = EMFProperties.value(feature).observeDetail(cp.getKnownElements());
column.setLabelProvider(new ObservableMapCellLabelProvider(map) {
@@ -184,10 +195,10 @@
ECPCellEditor ecpCellEditor = (ECPCellEditor) cellEditor;
String text = ecpCellEditor.getFormatedString(value);
cell.setText(text == null ? "" : text);
- column.getColumn().setData("width", ecpCellEditor.getColumnWidthWeight());
+
} else {
cell.setText(value == null ? "" : value.toString()); //$NON-NLS-1$
- column.getColumn().setData("width", 100);
+
}
}
});
@@ -392,18 +403,32 @@
return;
}
- List<EObject> deletionList = new ArrayList<EObject>();
+ final List<EObject> deletionList = new ArrayList<EObject>();
Iterator<?> iterator = selection.iterator();
while (iterator.hasNext()) {
deletionList.add((EObject) iterator.next());
}
- EObject modelElement = getModelElementContext().getModelElement();
- EditingDomain editingDomain = getModelElementContext().getEditingDomain();
- editingDomain.getCommandStack().execute(
- RemoveCommand.create(editingDomain, modelElement, getStructuralFeature(), deletionList));
+ MessageDialog dialog = new MessageDialog(tableViewer.getTable().getShell(), "Delete?", null,
+ "Are you sure you want to delete the selected Elements?", MessageDialog.CONFIRM, new String[] {
+ JFaceResources.getString(IDialogLabelKeys.YES_LABEL_KEY),
+ JFaceResources.getString(IDialogLabelKeys.NO_LABEL_KEY) }, 0);
+ new ECPDialogExecutor(dialog) {
+
+ @Override
+ public void handleResult(int codeResult) {
+ if (codeResult == IDialogConstants.CANCEL_ID) {
+ return;
+ }
+
+ EObject modelElement = getModelElementContext().getModelElement();
+ EditingDomain editingDomain = getModelElementContext().getEditingDomain();
+ editingDomain.getCommandStack().execute(
+ RemoveCommand.create(editingDomain, modelElement, getStructuralFeature(), deletionList));
+ }
+ }.execute();
}
});
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/XmlDateControl.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/XmlDateControl.java
index da4170e..9baa663 100644
--- a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/XmlDateControl.java
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/controls/XmlDateControl.java
@@ -141,4 +141,13 @@
});
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.internal.swt.controls.SingleControl#getHelpText()
+ */
+ @Override
+ protected String getHelpText() {
+ return "A XMLGregorianDate control showing a date. The format is DD.MM.YYYY";
+ }
+
}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogOpener.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogOpener.java
new file mode 100644
index 0000000..5db9bff
--- /dev/null
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogOpener.java
@@ -0,0 +1,36 @@
+/**
+ *
+ */
+package org.eclipse.emf.ecp.edit.internal.swt.util;
+
+import org.eclipse.emf.ecp.edit.internal.swt.Activator;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.dialogs.Dialog;
+
+/**
+ * @author Eugen Neufeld
+ *
+ */
+public class DialogOpener {
+
+ public static void openDialog(Dialog dialog, ECPDialogExecutor callBack) {
+ DialogWrapper wrapper = null;
+ IConfigurationElement[] controls = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ "org.eclipse.emf.ecp.edit.swt.dialogWrapper");
+ for (IConfigurationElement e : controls) {
+ try {
+ wrapper = (DialogWrapper) e.createExecutableExtension("class");
+ break;
+ } catch (CoreException e1) {
+ Activator.logException(e1);
+ }
+ }
+ if (wrapper == null) {
+ callBack.handleResult(dialog.open());
+ }
+ wrapper.openDialog(dialog, callBack);
+ }
+}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogWrapper.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogWrapper.java
new file mode 100644
index 0000000..afc41c2
--- /dev/null
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/DialogWrapper.java
@@ -0,0 +1,16 @@
+/**
+ *
+ */
+package org.eclipse.emf.ecp.edit.internal.swt.util;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+
+/**
+ * @author Eugen Neufeld
+ *
+ */
+public interface DialogWrapper {
+
+ void openDialog(final Dialog dialog, final ECPDialogExecutor callBack);
+}
diff --git a/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/ECPDialogExecutor.java b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/ECPDialogExecutor.java
new file mode 100644
index 0000000..d0a9e89
--- /dev/null
+++ b/ECP2/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/util/ECPDialogExecutor.java
@@ -0,0 +1,32 @@
+/**
+ *
+ */
+package org.eclipse.emf.ecp.edit.internal.swt.util;
+
+
+import org.eclipse.jface.dialogs.Dialog;
+
+/**
+ * @author Eugen Neufeld
+ *
+ */
+public abstract class ECPDialogExecutor {
+
+ private Dialog dialog;
+
+ /**
+ * @param dialog
+ */
+ public ECPDialogExecutor(Dialog dialog) {
+ this.dialog = dialog;
+ }
+
+ /**
+ * @param codeResult
+ */
+ public abstract void handleResult(int codeResult);
+
+ public void execute() {
+ DialogOpener.openDialog(dialog, this);
+ }
+}
diff --git a/ECP2/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/edit/ECPControlContext.java b/ECP2/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/edit/ECPControlContext.java
index ac81e73..aeca2c1 100644
--- a/ECP2/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/edit/ECPControlContext.java
+++ b/ECP2/org.eclipse.emf.ecp.edit/src/org/eclipse/emf/ecp/edit/ECPControlContext.java
@@ -68,4 +68,6 @@
EObject getNewElementFor(EReference eReference);
EObject getExistingElementFor(EReference eReference);
+
+ boolean isRunningAsWebApplication();
}
diff --git a/ECP2/org.eclipse.emf.ecp.explorereditorbridge/src/org/eclipse/emf/ecp/explorereditorbridge/internal/ECPControlContextImpl.java b/ECP2/org.eclipse.emf.ecp.explorereditorbridge/src/org/eclipse/emf/ecp/explorereditorbridge/internal/ECPControlContextImpl.java
index 3baa835..2875c5d 100644
--- a/ECP2/org.eclipse.emf.ecp.explorereditorbridge/src/org/eclipse/emf/ecp/explorereditorbridge/internal/ECPControlContextImpl.java
+++ b/ECP2/org.eclipse.emf.ecp.explorereditorbridge/src/org/eclipse/emf/ecp/explorereditorbridge/internal/ECPControlContextImpl.java
@@ -285,4 +285,13 @@
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.emf.ecp.edit.ECPControlContext#isRunningAsWebApplication()
+ */
+ public boolean isRunningAsWebApplication() {
+ // TODO IMPLEMENT to be generic
+ return false;
+ }
+
}