Search in sources :

Example 11 with DraggedData

use of org.talend.designer.abstractmap.ui.dnd.DraggedData 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)

Aggregations

DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)11 AbstractUIManager (org.talend.designer.abstractmap.managers.AbstractUIManager)8 DraggingInfosPopup (org.talend.designer.abstractmap.ui.dnd.DraggingInfosPopup)8 UIManager (org.talend.designer.mapper.managers.UIManager)6 Point (org.eclipse.swt.graphics.Point)4 UIManager (org.talend.designer.dbmap.managers.UIManager)4 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 TransferableEntry (org.talend.designer.abstractmap.ui.dnd.TransferableEntry)3 ArrayList (java.util.ArrayList)2 ISelection (org.eclipse.jface.viewers.ISelection)2 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)2 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)2 MetadataTableEditorView (org.talend.core.ui.metadata.editor.MetadataTableEditorView)2 ILanguage (org.talend.designer.mapper.language.ILanguage)2 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)2 Zone (org.talend.designer.mapper.ui.visualmap.zone.Zone)2 IDbLanguage (org.talend.designer.dbmap.language.IDbLanguage)1 TableEntryLocation (org.talend.designer.dbmap.model.tableentry.TableEntryLocation)1 DataMapTableView (org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView)1 Zone (org.talend.designer.dbmap.ui.visualmap.zone.Zone)1