Search in sources :

Example 1 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 2 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 3 with DraggingInfosPopup

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

the class CompleteDropTargetTableListener method updateInsertionIndicator.

/**
     * 
     * DOC amaumont Comment method "updateInsertionIndicator".
     * 
     * @param event
     * @return true if droppable
     */
private void updateInsertionIndicator(DropTargetEvent event) {
    AbstractUIManager uiManager = mapperManager.getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    // ////////////////////////////////
    // to resolve graphical bug between popupInfos and InsertionIndicator
    InsertionIndicator insertionIndicator = retrieveInsertionIndicator();
    Rectangle popupBounds = draggingInfosPopup.getBounds();
    Point positionPopupFromMapperShellOrigin = draggingInfosPopup.getPositionFromMapperShellOrigin();
    Rectangle boundsPopupFromMapperShellOrigin = new Rectangle(positionPopupFromMapperShellOrigin.x, positionPopupFromMapperShellOrigin.y, popupBounds.width, popupBounds.height);
    boolean intersect = insertionIndicator.isLeftArrowMustBeRefreshed(boundsPopupFromMapperShellOrigin);
    Point eventPosition = new Point(event.x, event.y);
    // int itemIndexTarget = getItemIndexWhereInsertFromPosition(eventPosition);
    int itemIndexTarget = TableUtils.getItemIndexWhereInsertFromPosition(draggableTargetControl, eventPosition);
    insertionIndicator.updatePosition(draggableTargetControl, itemIndexTarget);
    if (WindowSystem.isGTK()) {
        if (insertionIndicator.isRightArrowVisible() && !eventPosition.equals(lastDragPosition)) {
            insertionIndicator.setRightArrowVisible(false);
            insertionIndicator.setLefArrowVisible(false);
        } else {
            insertionIndicator.setRightArrowVisible(insertionIndicator.isVisible());
            insertionIndicator.setLefArrowVisible(insertionIndicator.isVisible());
        }
    } else {
        if (isIntersectAtPreviousDragOver || intersect) {
            insertionIndicator.setLefArrowVisible(false);
            isIntersectAtPreviousDragOver = false;
        } else {
            insertionIndicator.setLefArrowVisible(insertionIndicator.isVisible());
        }
    }
    isIntersectAtPreviousDragOver = intersect;
    lastDragPosition = eventPosition;
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) Point(org.eclipse.swt.graphics.Point)

Example 4 with DraggingInfosPopup

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

the class CompleteDropTargetListener method dragLeave.

@Override
public void dragLeave(DropTargetEvent event) {
    // System.out.println("\n>>dragLeave");
    // System.out.println(event);
    super.dragLeave(event);
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    UIManager uiManager = getUiManager();
    if (!analyzer.isTableSourceAndTargetAreSame()) {
        draggableTable.deselectAll();
    }
    retrieveInsertionIndicator().setVisible(false);
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.setExpressionContext(false);
    draggingInfosPopup.setInsertionEntryContext(false);
    uiManager.setDragging(false);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.dbmap.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Example 5 with DraggingInfosPopup

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

the class CompleteDropTargetListener method dragOperationChanged.

@Override
public void dragOperationChanged(DropTargetEvent event) {
    // System.out.println("\n>>dragOperationChanged");
    // showInfos(event);
    // super.dragOperationChanged(event);
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    detectPressedKeys(event);
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    configurePopupInfos(analyzer);
    UIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.updateVisibleLabels();
    fillEvent(event, analyzer);
    getUiManager().setCurrentDragDetail(event.detail);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) AbstractUIManager(org.talend.designer.abstractmap.managers.AbstractUIManager) UIManager(org.talend.designer.dbmap.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

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