Closed unknowIfGuestInDream closed 2 months ago
public class QeColorCellEditor extends ColorCellEditor {
private Composite composite;
private RGB value;
public QeColorCellEditor(Composite parent) {
super(parent);
}
@Override
protected Object openDialogBox(Control cellEditorWindow) {
final Display display = cellEditorWindow.getDisplay();
final Shell centerShell = new Shell(cellEditorWindow.getShell(), SWT.NO_TRIM);
centerShell.setLocation(display.getCursorLocation());
ColorDialog dialog = new ColorDialog(centerShell, SWT.NONE);
Object value = getValue();
if (value != null) {
dialog.setRGB((RGB) value);
}
dialog.open();
return dialog.getRGB();
}
@Override
protected Control createControl(Composite parent) {
this.composite = parent;
return null;
}
@Override
public void activate() {
RGB res = (RGB) openDialogBox(this.composite);
if (res != null && !Objects.equals(res, doGetValue())) {
doSetValue(res);
fireApplyEditorValue();
}
deactivate();
}
@Override
protected Object doGetValue() {
return value;
}
@Override
protected void doSetFocus() {
// Do nothing
}
@Override
protected void doSetValue(Object value) {
this.value = (RGB) value;
}
@Override
public void activate(ColumnViewerEditorActivationEvent activationEvent) {
if (activationEvent.eventType != ColumnViewerEditorActivationEvent.TRAVERSAL) {
super.activate(activationEvent);
}
}
}
Checklist
Describe the feature
https://github.com/aptana/studio2/blob/cbb2d6ab9176cc4078539f04d4bbd518b4aa6e86/plugins/com.aptana.ide.editors/src/com/aptana/ide/editors/preferences/ColorCellEditor.java#L46 很多color dialog https://github.com/yamcs/yamcs-studio/blob/ce2dd2578fbb1e6660b024c7f68b60ad7c476206/org.csstudio.opibuilder/src/main/java/org/csstudio/opibuilder/visualparts/AbstractDialogCellEditor.java 居中dialog https://github.com/Site-Command/Modelio/blob/75c39df29a1f30e43153df5f132e5d2cd858d703/modelio/platform/platform.model.ui/src/org/modelio/platform/model/ui/treetable/color/ColorCellEditor2.java#L54 https://github.com/daravi/modelio/blob/1787c8a836f7e708a5734d8bb5b8a4f1a6008691/app/diagram.styles/src/org/modelio/diagram/styles/editingsupport/color/ColorCellEditor3.java#L42
https://github.com/henrikor2/eclipsensis/blob/68026de79dbe397252ba5d208b2dbbf05429144c/net.sf.eclipsensis.installoptions/src/net/sf/eclipsensis/installoptions/properties/editors/CustomColorCellEditor.java#L20
cellEditor https://github.com/nightlabs/org.nightlabs.eclipse/blob/680b9079e9081174e730b4167be19468a0bcc545/org.nightlabs.base.ui/src/org/nightlabs/base/ui/celleditor/XCellEditor.java
https://github.com/Xiaoying/BIRT/blob/cb9a7f4233118d3d578e877d4f1bfff362bee463/org.eclipse.birt.report.designer.ui/src/org/eclipse/birt/report/designer/internal/ui/views/property/widgets/ComboBoxColorCellEditor.java
Additional context
No response