diff options
author | Eugen Neufeld | 2016-06-06 13:41:48 +0000 |
---|---|---|
committer | Eugen Neufeld | 2016-06-06 13:41:48 +0000 |
commit | 6ba4626d1a209cccb4a0d503c9bb186a3d9cb3fc (patch) | |
tree | 983b98f50a74f784d0a57c1223a6c3909139355b | |
parent | dae69d8fae16a9ffb8597fc136a563f9a5dabcc3 (diff) | |
download | org.eclipse.emf.ecp.core-6ba4626d1a209cccb4a0d503c9bb186a3d9cb3fc.tar.gz org.eclipse.emf.ecp.core-6ba4626d1a209cccb4a0d503c9bb186a3d9cb3fc.tar.xz org.eclipse.emf.ecp.core-6ba4626d1a209cccb4a0d503c9bb186a3d9cb3fc.zip |
TCI - Fixed date cell editor; fixed localization of tablerelease_1.9.0
Change-Id: Ia36642e28db48e7fe02f2cd2f46667f9d3e9dd91
Signed-off-by: Eugen Neufeld <eneufeld@eclipsesource.com>
3 files changed, 23 insertions, 2 deletions
diff --git a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/DateCellEditor.java b/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/DateCellEditor.java index c0eb652b45..c02139f735 100644 --- a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/DateCellEditor.java +++ b/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/DateCellEditor.java @@ -190,6 +190,9 @@ public class DateCellEditor extends CellEditor implements ECPCellEditor { @Override
protected void doSetValue(Object value) {
+ if (value == null) {
+ return;
+ }
final Calendar cal = Calendar.getInstance();
cal.setTime((Date) value);
dateWidget.setDate(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH));
diff --git a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/XmlDateCellEditor.java b/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/XmlDateCellEditor.java index d91e05a2c3..17535a5393 100644 --- a/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/XmlDateCellEditor.java +++ b/bundles/org.eclipse.emf.ecp.edit.swt/src/org/eclipse/emf/ecp/edit/internal/swt/table/XmlDateCellEditor.java @@ -187,6 +187,9 @@ public class XmlDateCellEditor extends CellEditor implements ECPCellEditor { @Override
protected void doSetValue(Object value) {
+ if (value == null) {
+ return;
+ }
final XMLGregorianCalendar cal = (XMLGregorianCalendar) value;
final GregorianCalendar gregCal = cal.toGregorianCalendar();
dateWidget.setDate(gregCal.get(Calendar.YEAR), gregCal.get(Calendar.MONTH), gregCal.get(Calendar.DAY_OF_MONTH));
diff --git a/bundles/org.eclipse.emf.ecp.view.table.ui.swt/src/org/eclipse/emf/ecp/view/spi/table/swt/TableControlDetailPanelRenderer.java b/bundles/org.eclipse.emf.ecp.view.table.ui.swt/src/org/eclipse/emf/ecp/view/spi/table/swt/TableControlDetailPanelRenderer.java index e2ac42bfd5..ecb8f3ced0 100644 --- a/bundles/org.eclipse.emf.ecp.view.table.ui.swt/src/org/eclipse/emf/ecp/view/spi/table/swt/TableControlDetailPanelRenderer.java +++ b/bundles/org.eclipse.emf.ecp.view.table.ui.swt/src/org/eclipse/emf/ecp/view/spi/table/swt/TableControlDetailPanelRenderer.java @@ -18,6 +18,7 @@ import java.util.Set; import javax.inject.Inject; import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.emf.common.notify.Adapter; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.common.util.TreeIterator; import org.eclipse.emf.ecore.EObject; @@ -28,6 +29,7 @@ import org.eclipse.emf.ecp.ui.view.ECPRendererException; import org.eclipse.emf.ecp.ui.view.swt.ECPSWTView; import org.eclipse.emf.ecp.ui.view.swt.ECPSWTViewRenderer; import org.eclipse.emf.ecp.view.spi.context.ViewModelContext; +import org.eclipse.emf.ecp.view.spi.model.LocalizationAdapter; import org.eclipse.emf.ecp.view.spi.model.VElement; import org.eclipse.emf.ecp.view.spi.model.VView; import org.eclipse.emf.ecp.view.spi.model.VViewModelProperties; @@ -194,7 +196,20 @@ public class TableControlDetailPanelRenderer extends TableControlSWTRenderer { } view = detailView; } - return EcoreUtil.copy(view); + final VView copy = EcoreUtil.copy(view); + for (final Adapter adapter : view.eAdapters()) { + if (LocalizationAdapter.class.isInstance(adapter)) { + copy.eAdapters().add(new LocalizationAdapter() { + + @Override + public String localize(String key) { + return LocalizationAdapter.class.cast(adapter).localize(key); + } + }); + break; + } + } + return copy; } /** @@ -234,7 +249,7 @@ public class TableControlDetailPanelRenderer extends TableControlSWTRenderer { /** * Called in order to render the selectedObject onto the created detail pane. - * + * * @param composite The {@link Composite} to render on * @param eObject The selected {@link EObject} to render * @since 1.9 |