Bug 510886 - TableControlRCPRenderer sometimes produces incomprehensible
paste behavior
* remove static instance code
Change-Id: Ife00b4c481f918254eeb91e559115791f8107b53
Signed-off-by: Johannes Faltermeier <jfaltermeier@eclipsesource.com>
diff --git a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailDialogRCPRenderer.java b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailDialogRCPRenderer.java
index c49c85a..12a4141 100644
--- a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailDialogRCPRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailDialogRCPRenderer.java
@@ -42,6 +42,9 @@
*
*/
public class TableControlDetailDialogRCPRenderer extends TableControlDetailDialogSWTRenderer {
+
+ private CutCopyPasteListener cutCopyPasteListener;
+
/**
* Default constructor.
*
@@ -89,7 +92,7 @@
final EditingDomain editingDomain = getEditingDomain(getViewModelContext().getDomainModel());
final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
getViewModelContext().getDomainModel());
- TableControlRCPRenderer.enableCutCopyPaste(tableViewer, editingDomain, setting);
+ cutCopyPasteListener = TableControlRCPRenderer.enableCutCopyPaste(tableViewer, editingDomain, setting);
} catch (final DatabindingFailedException ex) {
getReportService().report(new AbstractReport(ex, "Enabling Cut Copy Paste failed")); //$NON-NLS-1$
}
@@ -97,4 +100,12 @@
return control;
}
+ @Override
+ protected void rootDomainModelChanged() throws DatabindingFailedException {
+ super.rootDomainModelChanged();
+ final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
+ getViewModelContext().getDomainModel());
+ cutCopyPasteListener.rootDomainModelChanged(setting);
+ }
+
}
diff --git a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailPanelRCPRenderer.java b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailPanelRCPRenderer.java
index 4e4870d..9d8016d 100644
--- a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailPanelRCPRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlDetailPanelRCPRenderer.java
@@ -42,6 +42,9 @@
*
*/
public class TableControlDetailPanelRCPRenderer extends TableControlDetailPanelRenderer {
+
+ private CutCopyPasteListener cutCopyPasteListener;
+
/**
* Default constructor.
*
@@ -89,11 +92,19 @@
final EditingDomain editingDomain = getEditingDomain(getViewModelContext().getDomainModel());
final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
getViewModelContext().getDomainModel());
- TableControlRCPRenderer.enableCutCopyPaste(tableViewer, editingDomain, setting);
+ cutCopyPasteListener = TableControlRCPRenderer.enableCutCopyPaste(tableViewer, editingDomain, setting);
} catch (final DatabindingFailedException ex) {
getReportService().report(new AbstractReport(ex, "Enabling Cut Copy Paste failed")); //$NON-NLS-1$
}
}
return control;
}
+
+ @Override
+ protected void rootDomainModelChanged() throws DatabindingFailedException {
+ super.rootDomainModelChanged();
+ final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
+ getViewModelContext().getDomainModel());
+ cutCopyPasteListener.rootDomainModelChanged(setting);
+ }
}
diff --git a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlRCPRenderer.java b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlRCPRenderer.java
index 5163608..9b82a45 100644
--- a/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlRCPRenderer.java
+++ b/bundles/org.eclipse.emf.ecp.view.table.ui.rcp/src/org/eclipse/emf/ecp/view/spi/table/ui/rcp/TableControlRCPRenderer.java
@@ -44,7 +44,7 @@
*/
public class TableControlRCPRenderer extends TableControlSWTRenderer {
- private static CutCopyPasteListener cutCopyPasteListener;
+ private CutCopyPasteListener cutCopyPasteListener;
/**
* Default constructor.
@@ -93,7 +93,7 @@
final EditingDomain editingDomain = getEditingDomain(getViewModelContext().getDomainModel());
final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
getViewModelContext().getDomainModel());
- enableCutCopyPaste(tableViewer, editingDomain, setting);
+ cutCopyPasteListener = enableCutCopyPaste(tableViewer, editingDomain, setting);
} catch (final DatabindingFailedException ex) {
getReportService().report(new AbstractReport(ex, "Enabling Cut Copy Paste failed")); //$NON-NLS-1$
}
@@ -107,13 +107,14 @@
* @param tableViewer the {@link TableViewer}
* @param editingDomain the {@link EditingDomain}
* @param setting the {@link Setting} displayed in the table
+ * @return the {@link CutCopyPasteListener} or <code>null</code>
*/
- static void enableCutCopyPaste(AbstractTableViewer tableViewer, EditingDomain editingDomain,
+ static CutCopyPasteListener enableCutCopyPaste(AbstractTableViewer tableViewer, EditingDomain editingDomain,
Setting setting) {
if (!TableViewer.class.isInstance(tableViewer)) {
- return;
+ return null;
}
- cutCopyPasteListener = new CutCopyPasteListener((TableViewer) tableViewer, editingDomain, setting);
+ return new CutCopyPasteListener((TableViewer) tableViewer, editingDomain, setting);
}
@Override
@@ -122,7 +123,6 @@
final Setting setting = getEMFFormsDatabinding().getSetting(getDMRToMultiReference(),
getViewModelContext().getDomainModel());
cutCopyPasteListener.rootDomainModelChanged(setting);
-
}
}