diff options
| author | Dirk Fauth | 2022-07-25 14:37:33 +0000 |
|---|---|---|
| committer | Dirk Fauth | 2022-07-25 14:37:33 +0000 |
| commit | f79df117305b62b4b9fbf1c3ba7171b5c58aee72 (patch) | |
| tree | ab4e84f0b03ccd051e6a3addb14459e798ab0399 | |
| parent | 8d27827b225dade8b3ed7f4edc03509fb9d78eb2 (diff) | |
| download | org.eclipse.nebula.widgets.nattable-f79df117305b62b4b9fbf1c3ba7171b5c58aee72.tar.gz org.eclipse.nebula.widgets.nattable-f79df117305b62b4b9fbf1c3ba7171b5c58aee72.tar.xz org.eclipse.nebula.widgets.nattable-f79df117305b62b4b9fbf1c3ba7171b5c58aee72.zip | |
Bug 580447 - TextCellEditor creates Cursor without disposing it
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
Change-Id: Ibea6917fa0c5d870875d61dea012e67bfcd76efb
3 files changed, 14 insertions, 9 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java index fcf43d74..a750e569 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/ComboBoxCellEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -36,7 +36,6 @@ import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.ShellAdapter; import org.eclipse.swt.events.ShellEvent; -import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -452,7 +451,11 @@ public class ComboBoxCellEditor extends AbstractCellEditor { ? new NatCombo(parent, this.cellStyle, this.maxVisibleItems, style, this.showDropdownFilter) : new NatCombo(parent, this.cellStyle, this.maxVisibleItems, style, this.iconImage, this.showDropdownFilter); - combo.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM)); + if (this.freeEdit) { + combo.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM)); + } else { + combo.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_ARROW)); + } if (this.multiselect) { combo.setMultiselectValueSeparator(this.multiselectValueSeparator); diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/TextCellEditor.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/TextCellEditor.java index 546f0fd6..cd1ec57f 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/TextCellEditor.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/edit/editor/TextCellEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2022 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -33,7 +33,6 @@ import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -352,7 +351,7 @@ public class TextCellEditor extends AbstractCellEditor { textControl.setForeground(this.cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); textControl.setFont(this.cellStyle.getAttributeValue(CellStyleAttributes.FONT)); - textControl.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM)); + textControl.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM)); // add a key listener that will commit or close the editor for special // key strokes and executes conversion/validation on input to the editor diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxCellEditor.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxCellEditor.java index c7ed3c89..3a91b67a 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxCellEditor.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterRowComboBoxCellEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2020 Dirk Fauth and others. + * Copyright (c) 2013, 2022 Dirk Fauth and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -21,7 +21,6 @@ import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer.MoveDirectio import org.eclipse.nebula.widgets.nattable.widget.EditModeEnum; import org.eclipse.nebula.widgets.nattable.widget.NatCombo; import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.slf4j.Logger; @@ -86,7 +85,11 @@ public class FilterRowComboBoxCellEditor extends ComboBoxCellEditor { ? new FilterNatCombo(parent, this.cellStyle, this.maxVisibleItems, style, this.showDropdownFilter) : new FilterNatCombo(parent, this.cellStyle, this.maxVisibleItems, style, this.iconImage, this.showDropdownFilter); - combo.setCursor(new Cursor(Display.getDefault(), SWT.CURSOR_IBEAM)); + if (this.freeEdit) { + combo.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM)); + } else { + combo.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_ARROW)); + } combo.setMultiselectValueSeparator(this.multiselectValueSeparator); combo.setMultiselectTextBracket(this.multiselectTextPrefix, this.multiselectTextSuffix); |
