Search in sources :

Example 6 with ILanguage

use of org.talend.designer.mapper.language.ILanguage 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 7 with ILanguage

use of org.talend.designer.mapper.language.ILanguage in project tdi-studio-se by Talend.

the class ProblemsAnalyser method checkExpressionSyntaxProblems.

/**
     * DOC amaumont Comment method "checkExpressionSyntaxProblems".
     * 
     * @param tables
     * @param codeChecker
     */
private void checkExpressionSyntaxProblems(List<ExternalMapperTable> tables, ICodeProblemsChecker codeChecker) {
    ILanguage currentLanguage = LanguageProvider.getCurrentLanguage();
    boolean keyLanguageCheckerIsUsed = currentLanguage.getCodeLanguage() == ECodeLanguage.JAVA;
    for (ExternalMapperTable table : tables) {
        List<ExternalMapperTableEntry> metadataTableEntries = table.getMetadataTableEntries();
        // loop on all entries of current table
        if (metadataTableEntries != null) {
            checkExpressionSyntaxProblems(codeChecker, currentLanguage, keyLanguageCheckerIsUsed, table, metadataTableEntries, JavaGenerationManager.PROBLEM_KEY_FIELD.METADATA_COLUMN);
        }
        List<ExternalMapperTableEntry> globalMapKeysValues = table.getGlobalMapKeysValues();
        // loop on all entries of current table
        if (globalMapKeysValues != null) {
            checkExpressionSyntaxProblems(codeChecker, currentLanguage, keyLanguageCheckerIsUsed, table, globalMapKeysValues, JavaGenerationManager.PROBLEM_KEY_FIELD.GLOBAL_MAP);
        }
        if (table.getConstraintTableEntries() != null || table.isActivateExpressionFilter() && table.getExpressionFilter() != null && !table.getExpressionFilter().trim().equals("")) {
            //$NON-NLS-1$
            //$NON-NLS-1$ //$NON-NLS-2$
            String prefix = "Filter invalid in table " + table.getName() + " : ";
            if (table.getConstraintTableEntries() != null) {
                for (ExternalMapperTableEntry entry : table.getConstraintTableEntries()) {
                    checkFilterEntry(codeChecker, keyLanguageCheckerIsUsed, table, prefix, entry.getExpression());
                }
            }
            if (table.isActivateExpressionFilter() && table.getExpressionFilter() != null && !table.getExpressionFilter().trim().equals("")) {
                //$NON-NLS-1$
                checkFilterEntry(codeChecker, keyLanguageCheckerIsUsed, table, prefix, table.getExpressionFilter());
            }
        }
    }
// for (ExternalMapperTable table : tables) {
}
Also used : ILanguage(org.talend.designer.mapper.language.ILanguage) ExternalMapperTableEntry(org.talend.designer.mapper.external.data.ExternalMapperTableEntry) ExternalMapperTable(org.talend.designer.mapper.external.data.ExternalMapperTable)

Aggregations

ILanguage (org.talend.designer.mapper.language.ILanguage)7 ITableEntry (org.talend.designer.abstractmap.model.tableentry.ITableEntry)3 DataMapTableView (org.talend.designer.mapper.ui.visualmap.table.DataMapTableView)3 TableViewerCreator (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)2 IColumnEntry (org.talend.designer.abstractmap.model.tableentry.IColumnEntry)2 DraggedData (org.talend.designer.abstractmap.ui.dnd.DraggedData)2 TransferableEntry (org.talend.designer.abstractmap.ui.dnd.TransferableEntry)2 ExternalMapperTableEntry (org.talend.designer.mapper.external.data.ExternalMapperTableEntry)2 UIManager (org.talend.designer.mapper.managers.UIManager)2 InputTable (org.talend.designer.mapper.model.table.InputTable)2 InputColumnTableEntry (org.talend.designer.mapper.model.tableentry.InputColumnTableEntry)2 Zone (org.talend.designer.mapper.ui.visualmap.zone.Zone)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 SelectionListener (org.eclipse.swt.events.SelectionListener)1 Point (org.eclipse.swt.graphics.Point)1