Search in sources :

Example 6 with DraggingInfosPopup

use of org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup in project tdi-studio-se by Talend.

the class CompleteDropTargetListener method configurePopupInfos.

private void configurePopupInfos(DropContextAnalyzer analyzer) {
    AbstractUIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    if (analyzer.isDropValid()) {
        draggingInfosPopup.setOutputToOutputMode(analyzer.isOutputToOutput());
        if (uiManager.isCtrlPressed()) {
            draggingInfosPopup.setOverwriteMode(true);
        } else {
            draggingInfosPopup.setOverwriteMode(false);
        }
        if (uiManager.isShiftPressed() && analyzer.isMapOneToOneAuthorized()) {
            draggingInfosPopup.setMapOneToOneMode(true, true);
        } else {
            draggingInfosPopup.setMapOneToOneMode(false, analyzer.isMapOneToOneAuthorized());
        }
        if (analyzer.isInputToInput()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(false);
        } else if (analyzer.isCursorOverExpressionCell()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(analyzer.isInsertionEntryMode());
        } else if (analyzer.targetTableIsFiltersTable()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(false);
        } else {
            draggingInfosPopup.setExpressionContext(false);
            draggingInfosPopup.setInsertionEntryContext(true);
        }
        draggingInfosPopup.setDropInvalid(false, false);
    } else {
        draggingInfosPopup.setExpressionContext(false);
        draggingInfosPopup.setMapOneToOneMode(false, false);
        draggingInfosPopup.setInsertionEntryContext(false);
        draggingInfosPopup.setDropInvalid(true, analyzer.isInvalidKeyPressed());
    }
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager)

Example 7 with DraggingInfosPopup

use of org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup in project tdi-studio-se by Talend.

the class DefaultDropTargetListener method dragOperationChanged.

public void dragOperationChanged(DropTargetEvent event) {
    updatePopupPosition(event);
    detectPressedKeys(event);
    AbstractUIManager uiManager = mapperManager.getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    if (uiManager.isCtrlPressed()) {
        draggingInfosPopup.setOverwriteMode(true);
    } else {
        draggingInfosPopup.setOverwriteMode(false);
    }
    if (uiManager.isShiftPressed()) {
        draggingInfosPopup.setMapOneToOneMode(true, true);
    } else {
        draggingInfosPopup.setMapOneToOneMode(false, true);
    }
    int detail = DND.DROP_NONE;
    if (uiManager.isCtrlPressed() && uiManager.isShiftPressed()) {
        detail |= DND.DROP_COPY;
    } else if (uiManager.isCtrlPressed()) {
        detail |= DND.DROP_LINK;
    } else if (uiManager.isShiftPressed()) {
        detail |= DND.DROP_COPY;
    } else {
        detail |= DND.DROP_COPY;
    }
    uiManager.setCurrentDragDetail(detail);
    event.detail = DND.DROP_NONE;
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) Point(org.eclipse.swt.graphics.Point)

Example 8 with DraggingInfosPopup

use of org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup in project tdi-studio-se by Talend.

the class DefaultDropTargetListener method updatePopupPosition.

private void updatePopupPosition(DropTargetEvent event) {
    Point cursorPosition = new Point(event.x, event.y);
    if (!cursorPosition.equals(lastCursorPosition)) {
        AbstractUIManager uiManager = mapperManager.getUiManager();
        DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
        draggingInfosPopup.setCursorPosition(event.x, event.y);
    }
    // System.out.println("updatePopupPosition:" + lastCursorPosition + "-->" + cursorPosition);
    lastCursorPosition = cursorPosition;
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) Point(org.eclipse.swt.graphics.Point) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager)

Example 9 with DraggingInfosPopup

use of org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup in project tdi-studio-se by Talend.

the class DefaultDropTargetListener method setPopupVisible.

private void setPopupVisible(boolean visible) {
    AbstractUIManager uiManager = mapperManager.getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.setVisible(visible);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager)

Example 10 with DraggingInfosPopup

use of org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup in project tdi-studio-se by Talend.

the class CompleteDropTargetTableListener method dragOver.

@Override
public void dragOver(DropTargetEvent event) {
    super.dragOver(event);
    AbstractUIManager uiManager = mapperManager.getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    // System.out.println("\n>>dragOver");
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    fillEvent(event, analyzer);
    InsertionIndicator insertionIndicator = retrieveInsertionIndicator();
    if (analyzer.isDropValid()) {
        draggingInfosPopup.setOutputToOutputMode(analyzer.isOutputToOutput());
        if (analyzer.isInputToInput() && !analyzer.isInsertionEntryMode()) {
            draggingInfosPopup.setExpressionContext(true);
            draggingInfosPopup.setInsertionEntryContext(false);
        } else if (analyzer.isCursorOverExpressionCell()) {
            draggingInfosPopup.setExpressionContext(true);
        } else if (analyzer.targetIsExpressionFilterText() || analyzer.targetTableIsFiltersTable()) {
            draggingInfosPopup.setExpressionContext(true);
        } else {
            draggingInfosPopup.setExpressionContext(false);
        }
        draggingInfosPopup.setMapOneToOneMode(analyzer.isMapOneToOneMode(), analyzer.isMapOneToOneAuthorized());
        Point cursorPosition = new Point(event.x, event.y);
        Integer itemIndexWhereInsertFromPosition = getItemIndexFromPosition(cursorPosition);
        if (analyzer.isMapOneToOneMode() && analyzer.isMapOneToOneAuthorized()) {
            int size = draggedData.getTransferableEntryList().size();
            if (itemIndexWhereInsertFromPosition != null) {
                draggableTargetControl.setSelection(itemIndexWhereInsertFromPosition, itemIndexWhereInsertFromPosition + size - 1);
                if (!analyzer.targetIsExpressionFilterText() && !analyzer.targetTableIsFiltersTable() && itemIndexWhereInsertFromPosition + size - 1 >= draggableTargetControl.getItemCount()) {
                    insertionIndicator.updatePosition(draggableTargetControl, draggableTargetControl.getItemCount());
                    insertionIndicator.setVisible(true);
                    draggingInfosPopup.setInsertionEntryContext(true);
                } else {
                    insertionIndicator.setVisible(false);
                    draggingInfosPopup.setInsertionEntryContext(false);
                }
            } else {
                draggableTargetControl.deselectAll();
                insertionIndicator.setVisible(false);
                draggingInfosPopup.setInsertionEntryContext(false);
            }
        } else {
            if (!analyzer.isTableSourceAndTargetAreSame()) {
                draggableTargetControl.deselectAll();
            }
            if (itemIndexWhereInsertFromPosition != null && !analyzer.isInsertionEntryMode()) {
                draggableTargetControl.setSelection(itemIndexWhereInsertFromPosition);
            }
            if (!analyzer.targetIsExpressionFilterText() && !analyzer.targetTableIsFiltersTable()) {
                updateInsertionIndicator(event);
                insertionIndicator.setVisible(analyzer.isInsertionEntryMode());
            }
            draggingInfosPopup.setInsertionEntryContext(analyzer.isInsertionEntryMode());
        }
        draggingInfosPopup.setDropInvalid(false, false);
    } else {
        draggingInfosPopup.setMapOneToOneMode(false, false);
        draggingInfosPopup.setExpressionContext(false);
        draggingInfosPopup.setInsertionEntryContext(false);
        draggingInfosPopup.setDropInvalid(true, analyzer.isInvalidKeyPressed());
    }
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData) Point(org.eclipse.swt.graphics.Point) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) Point(org.eclipse.swt.graphics.Point)

Aggregations

DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)17 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)13 DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)8 Point (org.eclipse.swt.graphics.Point)6 UIManager (org.talend.designer.mapper.managers.UIManager)6 UIManager (org.talend.designer.dbmap.managers.UIManager)4 Rectangle (org.eclipse.swt.graphics.Rectangle)2