From fc442a158e6c6f088ebe04b3f713722e3b1f3269 Mon Sep 17 00:00:00 2001 From: vlorenzo Date: Wed, 29 Jan 2014 14:11:40 +0100 Subject: 426883: [Table 2][Xtext] Xtext editor in table aren't closed properly and break the selection in the table https://bugs.eclipse.org/bugs/show_bug.cgi?id=426883 --- .../nattable/celleditor/AbstractStyledTextCellEditor.java | 13 +++++++++++++ .../celleditor/AbstractNatTableXTextCellEditor.java | 7 ------- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'extraplugins') diff --git a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractStyledTextCellEditor.java b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractStyledTextCellEditor.java index 0f875521e60..ede16907a8f 100644 --- a/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractStyledTextCellEditor.java +++ b/extraplugins/table/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/AbstractStyledTextCellEditor.java @@ -29,8 +29,10 @@ import org.eclipse.nebula.widgets.nattable.style.IStyle; import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.custom.VerifyKeyListener; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.VerifyEvent; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -240,6 +242,17 @@ public abstract class AbstractStyledTextCellEditor extends AbstractCellEditor { //create the Text control based on the specified style final StyledText textControl = createStyledText(parent, style); + //to avoid widget is disposed exception during the closing of the cell editor + textControl.addVerifyKeyListener(new VerifyKeyListener() { + + @Override + public void verifyKey(VerifyEvent event) { + if(textControl.isDisposed()){ + event.doit = false; + } + } + }); + //set style information configured in the associated cell style textControl.setBackground(this.cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); textControl.setForeground(this.cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); diff --git a/extraplugins/table/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractNatTableXTextCellEditor.java b/extraplugins/table/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractNatTableXTextCellEditor.java index 963d85c3fa7..09f319b9023 100644 --- a/extraplugins/table/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractNatTableXTextCellEditor.java +++ b/extraplugins/table/org.eclipse.papyrus.uml.nattable.xtext.integration/src/org/eclipse/papyrus/uml/nattable/xtext/integration/celleditor/AbstractNatTableXTextCellEditor.java @@ -186,11 +186,4 @@ public abstract class AbstractNatTableXTextCellEditor extends AbstractPapyrusSty return new XTextEditorResultWrapper(typedString, parseCommand); } - @Override - public void close() { - //TODO requred? -// jfaceCellEditor.deactivate(); -// jfaceCellEditor.dispose(); - } - } -- cgit v1.2.3