提交 43ea2e01 编写于 作者: S serge-rider

#3507 Grouping panel - configuration dialog on copy drop (with Control key)


Former-commit-id: a371d830
上级 5845caea
......@@ -4311,7 +4311,7 @@ public abstract class LightGrid extends Canvas {
private void addDragAndDropSupport()
{
final int operations = DND.DROP_MOVE;//DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT;
final int operations = DND.DROP_MOVE | DND.DROP_COPY;// | DND.DROP_MOVE | DND.DROP_LINK | DND.DROP_DEFAULT;
final DragSource source = new DragSource(this, operations);
source.setTransfer(GridColumnTransfer.INSTANCE, TextTransfer.getInstance());
......
......@@ -16,6 +16,7 @@
*/
package org.jkiss.dbeaver.ui.controls.resultset.panel.grouping;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.dnd.*;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.model.DBPEvaluationContext;
......@@ -61,7 +62,7 @@ public class GroupingResultsDecorator implements IResultSetDecorator {
if (oldDropTarget instanceof DropTarget) {
((DropTarget) oldDropTarget).dispose();
}
DropTarget dropTarget = new DropTarget(presentation.getControl(), DND.DROP_MOVE);
DropTarget dropTarget = new DropTarget(presentation.getControl(), DND.DROP_MOVE | DND.DROP_COPY);
dropTarget.setTransfer(LightGrid.GridColumnTransfer.INSTANCE, TextTransfer.getInstance());
dropTarget.addDropListener(new DropTargetAdapter() {
@Override
......@@ -87,7 +88,7 @@ public class GroupingResultsDecorator implements IResultSetDecorator {
@Override
public void drop(DropTargetEvent event) {
handleDragEvent(event);
if (event.detail == DND.DROP_MOVE) {
if (event.detail == DND.DROP_MOVE || event.detail == DND.DROP_COPY) {
dropColumns(event);
}
}
......@@ -101,7 +102,9 @@ public class GroupingResultsDecorator implements IResultSetDecorator {
if (!isDropSupported(event)) {
event.detail = DND.DROP_NONE;
} else {
event.detail = DND.DROP_MOVE;
if (event.detail == DND.DROP_NONE) {
event.detail = DND.DROP_MOVE;
}
}
event.feedback = DND.FEEDBACK_SELECT;
}
......@@ -127,6 +130,13 @@ public class GroupingResultsDecorator implements IResultSetDecorator {
if (!attributeBindings.isEmpty()) {
container.addGroupingAttributes(attributeBindings);
}
if (event.detail == DND.DROP_COPY) {
GroupingConfigDialog dialog = new GroupingConfigDialog(container.getResultSetController().getControl().getShell(), container);
if (dialog.open() != IDialogConstants.OK_ID) {
container.clearGrouping();
return;
}
}
try {
container.rebuildGrouping();
} catch (DBException e) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册