Search in sources :

Example 16 with UIManager

use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method configurePopupInfos.

private void configurePopupInfos(DropContextAnalyzer analyzer) {
    UIManager 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.targetIsExpressionFilterText() || 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) UIManager(org.talend.designer.mapper.managers.UIManager)

Example 17 with UIManager

use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method dragOperationChanged.

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) UIManager(org.talend.designer.mapper.managers.UIManager) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData)

Example 18 with UIManager

use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method drop.

// private void showInfos(DropTargetEvent event) {
// System.out.println(event);
// System.out.println("event.feedback=" + event.feedback);
// System.out.println("event.detail=" + event.detail);
// System.out.println("event.operations=" + event.operations);
//
// System.out.println("DND.DROP_DEFAULT=" + DND.DROP_DEFAULT);
// System.out.println("DND.DROP_COPY=" + DND.DROP_COPY);
// System.out.println("DND.DROP_MOVE=" + DND.DROP_MOVE);
// System.out.println("DND.DROP_LINK=" + DND.DROP_LINK);
// System.out.println("DND.DROP_TARGET_MOVE=" + DND.DROP_TARGET_MOVE);
// }
//
public void drop(DropTargetEvent event) {
    super.drop(event);
    UIManager uiManager = getUiManager();
    DraggedData draggedData = TableEntriesTransfer.getInstance().getDraggedData();
    DropContextAnalyzer analyzer = analyzeDropTarget(event, draggedData);
    // System.out.println("\n>>drop");
    // System.out.println(event);
    ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
    DataMapTableView dataMapTableViewTarget = getMapperManager().retrieveDataMapTableView(draggableTargetControl);
    uiManager.selectDataMapTableView(dataMapTableViewTarget, true, false);
    List<TransferableEntry> transferableEntryList = draggedData.getTransferableEntryList();
    ITableEntry currentEntryTarget = ((AbstractInOutTable) dataMapTableViewTarget.getDataMapTable()).getExpressionFilter();
    boolean overwrite = false;
    if (analyzer.isOverwriteExpression()) {
        //$NON-NLS-1$
        currentEntryTarget.setExpression("");
    }
    for (TransferableEntry transferableEntry : transferableEntryList) {
        ITableEntry tableEntrySource = transferableEntry.getTableEntrySource();
        Zone zoneSourceEntry = (Zone) transferableEntry.getZoneSourceEntry();
        modifyExistingExpression(currentLanguage, currentEntryTarget, tableEntrySource, overwrite, zoneSourceEntry);
    }
    // for TransferableEntry transferableEntry : transferableEntryList
    uiManager.parseExpression(currentEntryTarget.getExpression(), currentEntryTarget, false, true, true);
    ControlUtils.setText(draggableTargetControl, currentEntryTarget.getExpression());
    uiManager.refreshBackground(true, false);
    uiManager.unselectAllInputMetaDataEntries();
    // uiManager.parseAllExpressionsForAllTables();
    getMapperManager().getProblemsManager().checkProblemsForTableEntry(currentEntryTarget, true);
    uiManager.selectLinks(dataMapTableViewTarget, Arrays.<ITableEntry>asList(currentEntryTarget), true, false);
    uiManager.setDragging(false);
}
Also used : ILanguage(org.talend.designer.mapper.language.ILanguage) ITableEntry(org.talend.designer.abstractmap.model.tableentry.ITableEntry) Zone(org.talend.designer.mapper.ui.visualmap.zone.Zone) AbstractInOutTable(org.talend.designer.mapper.model.table.AbstractInOutTable) UIManager(org.talend.designer.mapper.managers.UIManager) DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) DraggedData(org.talend.designer.abstractmap.ui.dnd.DraggedData) TransferableEntry(org.talend.designer.abstractmap.ui.dnd.TransferableEntry)

Example 19 with UIManager

use of org.talend.designer.mapper.managers.UIManager in project tdi-studio-se by Talend.

the class CompleteDropTargetStyledTextListener method dragLeave.

public void dragLeave(DropTargetEvent event) {
    // System.out.println("\n>>dragLeave");
    // System.out.println(event);
    super.dragLeave(event);
    UIManager uiManager = getUiManager();
    DraggingInfosPopup draggingInfosPopup = uiManager.getDraggingInfosPopup();
    draggingInfosPopup.setExpressionContext(false);
    draggingInfosPopup.setInsertionEntryContext(false);
    uiManager.setDragging(false);
}
Also used : DraggingInfosPopup(org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup) UIManager(org.talend.designer.mapper.managers.UIManager)

Aggregations

UIManager (org.talend.designer.mapper.managers.UIManager)19 DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)6 DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)6 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)6 Point (org.eclipse.swt.graphics.Point)4 GridData (org.eclipse.swt.layout.GridData)4 Event (org.eclipse.swt.widgets.Event)4 Listener (org.eclipse.swt.widgets.Listener)4 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)4 ISelection (org.eclipse.jface.viewers.ISelection)3 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)2 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 FocusEvent (org.eclipse.swt.events.FocusEvent)2 FocusListener (org.eclipse.swt.events.FocusListener)2 SelectionEvent (org.eclipse.swt.events.SelectionEvent)2 Color (org.eclipse.swt.graphics.Color)2 Rectangle (org.eclipse.swt.graphics.Rectangle)2 FormData (org.eclipse.swt.layout.FormData)2