-
Notifications
You must be signed in to change notification settings - Fork 4
/
GTextCellEditor.java
42 lines (34 loc) · 1 KB
/
GTextCellEditor.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.xored.quality.mockups.jface.celleditors;
import org.eclipse.jface.viewers.TextCellEditor;
import org.eclipse.swt.widgets.Composite;
public class GTextCellEditor extends TextCellEditor {
private Object original;
public GTextCellEditor() {
super();
}
public GTextCellEditor(Composite parent, int style) {
super(parent, style);
}
public GTextCellEditor(Composite parent) {
super(parent);
}
@Override
protected void doSetValue(Object value) {
if (value instanceof Integer)
value = value.toString();
if (value instanceof Double)
value = value.toString();
if (value == null)
value = "";
original = value;
super.doSetValue(value.toString());
}
@Override
protected void fireApplyEditorValue() {
Object value = getValue();
if (!value.equals(original))
super.fireApplyEditorValue();
else
super.fireCancelEditor();
}
}