From a4bb2c6e0ffff2c80928ca04bb4879ad00610667 Mon Sep 17 00:00:00 2001 From: vlorenzo Date: Mon, 4 Feb 2013 09:58:19 +0000 Subject: 399737: [Table Editor] Cell can no more be edited if previous edition was cancelled before validation https://bugs.eclipse.org/bugs/show_bug.cgi?id=399737 --- .../celleditors/editors/BooleanCellEditor.java | 2 -- .../widget/celleditors/editors/IntCellEditor.java | 28 ++++++++++------------ .../celleditors/editors/StringMultiCellEditor.java | 10 ++++---- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/BooleanCellEditor.java b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/BooleanCellEditor.java index 3306b5ead52..3731a1921a8 100644 --- a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/BooleanCellEditor.java +++ b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/BooleanCellEditor.java @@ -44,7 +44,6 @@ public class BooleanCellEditor implements IModelCellEditor { * {@inheritDoc} */ public Control activateCell(final Composite parent, final Object originalValue, final IModelCellEditHandler editHandler, final EStructuralFeature feature, final EObject source) { - if(this.composite == null) { ICompositeEditorFactory compositeEditorFactory = ICompositeEditorFactoriesRegistry.INSTANCE.getCompositeEditorFactory(Boolean.class); this.composite = compositeEditorFactory.createCompositeEditor(parent, SWT.NONE); if(originalValue != null) { @@ -60,7 +59,6 @@ public class BooleanCellEditor implements IModelCellEditor { editHandler.commit(); } }); - } return this.composite; } diff --git a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/IntCellEditor.java b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/IntCellEditor.java index 519275af887..93579c68e73 100644 --- a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/IntCellEditor.java +++ b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/IntCellEditor.java @@ -30,23 +30,21 @@ public class IntCellEditor implements IModelCellEditor { * {@inheritDoc} */ public Control activateCell(final Composite parent, final Object originalValue, final IModelCellEditHandler editHandler, final EStructuralFeature feature, final EObject source) { - if(this.composite == null) { - ICompositeEditorFactory compositeEditorFactory = ICompositeEditorFactoriesRegistry.INSTANCE.getCompositeEditorFactory(Integer.class); - this.composite = compositeEditorFactory.createCompositeEditor(parent, SWT.NONE); - if(originalValue != null) { - if(originalValue instanceof Integer) { - this.composite.setValue((Integer)originalValue); - } else { - Activator.log.info("An instance of Integer was expected"); //$NON-NLS-1$ - } + ICompositeEditorFactory compositeEditorFactory = ICompositeEditorFactoriesRegistry.INSTANCE.getCompositeEditorFactory(Integer.class); + this.composite = compositeEditorFactory.createCompositeEditor(parent, SWT.NONE); + if(originalValue != null) { + if(originalValue instanceof Integer) { + this.composite.setValue((Integer)originalValue); + } else { + Activator.log.info("An instance of Integer was expected"); //$NON-NLS-1$ } - this.composite.addCommitListener(new IListener() { - - public void handleEvent() { - editHandler.commit(); - } - }); } + this.composite.addCommitListener(new IListener() { + + public void handleEvent() { + editHandler.commit(); + } + }); return this.composite; } diff --git a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/StringMultiCellEditor.java b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/StringMultiCellEditor.java index 63624e01ffd..2653a9766d6 100644 --- a/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/StringMultiCellEditor.java +++ b/plugins/uml/table/org.eclipse.papyrus.uml.table.widgets.celleditors/src/org/eclipse/papyrus/uml/table/widget/celleditors/editors/StringMultiCellEditor.java @@ -44,7 +44,6 @@ public class StringMultiCellEditor implements IModelCellEditor { * {@inheritDoc} */ public Control activateCell(final Composite parent, final Object originalValue, final IModelCellEditHandler editHandler, final EStructuralFeature feature, final EObject source) { - if(this.composite == null) { ICompositeEditorFactory compositeEditorFactory = ICompositeEditorFactoriesRegistry.INSTANCE.getCompositeEditorFactory(String.class); this.composite = compositeEditorFactory.createCompositeEditor(parent, SWT.NONE); if(originalValue != null) { @@ -56,11 +55,10 @@ public class StringMultiCellEditor implements IModelCellEditor { } this.composite.addCommitListener(new IListener() { - public void handleEvent() { - editHandler.commit(); - } - }); - } + public void handleEvent() { + editHandler.commit(); + } + }); return this.composite; } -- cgit v1.2.3