Search in sources :

Example 16 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class ValidationRulesUtil method chooseOneComponent.

private static IComponent chooseOneComponent(List<IComponent> neededComponents, EDatabaseComponentName name, boolean quickCreateInput, boolean quickCreateOutput) {
    if (neededComponents.isEmpty()) {
        return null;
    }
    if (neededComponents.size() == 1) {
        return neededComponents.get(0);
    }
    IComponent inputComponent = getComponentByName(name.getInputComponentName(), quickCreateInput, neededComponents);
    if (inputComponent != null) {
        return inputComponent;
    }
    IComponent outputComponent = getComponentByName(name.getOutPutComponentName(), quickCreateOutput, neededComponents);
    if (outputComponent != null) {
        return outputComponent;
    }
    IComponent defaultComponent = getComponentByName(name.getDefaultComponentName(), true, neededComponents);
    if (defaultComponent != null) {
        return defaultComponent;
    } else {
        return neededComponents.get(0);
    }
}
Also used : IComponent(org.talend.core.model.components.IComponent)

Example 17 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class OutputDataMapTableView method initTableFilters.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.designer.dbmap.ui.visualmap.table.DataMapTableView#initTableConstraints()
     */
@Override
protected void initTableFilters(Composite parent) {
    /**
         * create whereFiltersTable
         */
    // createFiltersTable(parent);
    //$NON-NLS-1$
    filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalWhereClauses");
    extendedTableViewerForFilters = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getWhereTableFiltersEntriesModel(), parent) {

        /*
             * (non-Javadoc)
             * 
             * @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
             * getTableConstraintSize()
             */
        @Override
        protected int getTableConstraintSize() {
            int retSize = 0;
            if (abstractDataMapTable instanceof OutputTable) {
                retSize = ((OutputTable) abstractDataMapTable).getWhereFilterEntries().size();
            }
            return retSize;
        }

        @Override
        protected void setTextCellEditor(TextCellEditor textEditor) {
            if (textEditor != null) {
                whereConstraintExpressionTextEditor = (Text) textEditor.getControl();
            }
        }
    };
    // correct partially layout problem with GTK when cell editor value is applied
    ((ExtendedTableViewerForFilters) extendedTableViewerForFilters).createFiltersTable();
    TableViewerCreator tableViewerCreatorForWhereClauses = extendedTableViewerForFilters.getTableViewerCreator();
    tableViewerCreatorForWhereClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
    List<FilterTableEntry> whereEntries = ((OutputTable) getDataMapTable()).getWhereFilterEntries();
    tableViewerCreatorForWhereClauses.init(whereEntries);
    /**
         * create otherFiltersTable
         */
    IComponent component = getMapperManager().getComponent().getComponent();
    if (component != null && "tELTOracleMap".equals(component.getName())) {
        //$NON-NLS-1$
        //$NON-NLS-1$
        filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses.oracle");
    } else {
        //$NON-NLS-1$
        filterColumnLabel = Messages.getString("OutputDataMapTableView.columnTitle.AdditionalOtherClauses");
    }
    entendedTableViewerForOtherClauses = new ExtendedTableViewerForFilters(((OutputTable) abstractDataMapTable).getOtherTableFiltersEntriesModel(), parent) {

        /*
             * (non-Javadoc)
             * 
             * @see org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView.ExtendedTableViewerForFilters#
             * getTableConstraintSize()
             */
        @Override
        public int getTableConstraintSize() {
            int retSize = 0;
            if (abstractDataMapTable instanceof OutputTable) {
                retSize = ((OutputTable) abstractDataMapTable).getOtherFilterEntries().size();
            }
            return retSize;
        }

        @Override
        protected void setTextCellEditor(TextCellEditor textEditor) {
            if (textEditor != null) {
                otherConstraintExpressionTextEditor = (Text) textEditor.getControl();
            }
        }
    };
    ((ExtendedTableViewerForFilters) entendedTableViewerForOtherClauses).createFiltersTable();
    TableViewerCreator tableViewerCreatorForOtherClauses = entendedTableViewerForOtherClauses.getTableViewerCreator();
    tableViewerCreatorForOtherClauses.setAdjustWidthValue(WindowSystem.isGTK() ? -20 : ADJUST_WIDTH_VALUE);
    List<FilterTableEntry> otherEntries = ((OutputTable) getDataMapTable()).getOtherFilterEntries();
    tableViewerCreatorForOtherClauses.init(otherEntries);
    // updateGridDataHeightForTableConstraints(entendedTableViewerForOtherClauses.getTable());
    updateGridDataHeightForTableConstraints();
    if (WindowSystem.isGTK()) {
        tableViewerCreatorForWhereClauses.layout();
        entendedTableViewerForOtherClauses.getTableViewerCreator().layout();
    }
}
Also used : TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) IComponent(org.talend.core.model.components.IComponent) FilterTableEntry(org.talend.designer.dbmap.model.tableentry.FilterTableEntry) Text(org.eclipse.swt.widgets.Text) TextCellEditor(org.eclipse.jface.viewers.TextCellEditor) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 18 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class ProcessComponentsHandler method filterComponents.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.core.model.components.TComponentsHandler#filterComponents(java.util.List)
     */
@Override
public List<IComponent> filterComponents(List<IComponent> allComponents) {
    if (allComponents != null && allComponents.size() > 0) {
        Iterator<IComponent> componentsIterator = allComponents.iterator();
        while (componentsIterator.hasNext()) {
            IComponent component = componentsIterator.next();
            String compType = component.getPaletteType();
            if (compType != null && !ComponentCategory.CATEGORY_4_DI.getName().equals(compType)) {
                componentsIterator.remove();
            }
        }
    }
    return allComponents;
}
Also used : IComponent(org.talend.core.model.components.IComponent)

Example 19 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class TalendEditorPaletteFactory method createEntryFrom.

public static TalendCombinedTemplateCreationEntry createEntryFrom(CombinedTemplateCreationEntry entry) {
    String name = entry.getLabel();
    IComponent component = ((PaletteComponentFactory) entry.getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY)).getComponent();
    TalendCombinedTemplateCreationEntry newEntry = new TalendCombinedTemplateCreationEntry(name, name, Node.class, component, entry.getSmallIcon(), entry.getLargeIcon());
    newEntry.setDescription(entry.getDescription());
    return newEntry;
}
Also used : IComponent(org.talend.core.model.components.IComponent) TalendCombinedTemplateCreationEntry(org.talend.designer.core.ui.editor.palette.TalendCombinedTemplateCreationEntry)

Example 20 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class TalendPaletteContextMenuProvider method buildContextMenu.

@SuppressWarnings("rawtypes")
@Override
public void buildContextMenu(IMenuManager menu) {
    super.buildContextMenu(menu);
    boolean hasSearchComponentAction = true;
    List editParts = getPaletteViewer().getSelectedEditParts();
    if (!editParts.isEmpty()) {
        PaletteEntry element = (PaletteEntry) ((EditPart) editParts.get(0)).getModel();
        if (editParts.size() > 1) {
            // search component only process one .
            hasSearchComponentAction = false;
        } else {
            // check the entry is component or folder
            if (element instanceof CombinedTemplateCreationEntry) {
                Object template = ((CombinedTemplateCreationEntry) element).getTemplate();
                if (template == null || !Node.class.equals(template)) {
                    hasSearchComponentAction = false;
                }
            } else {
                // not component entry
                hasSearchComponentAction = false;
            }
        }
        // don't work for camel.
        if (hasSearchComponentAction && isComponentsTypePalette(ComponentCategory.CATEGORY_4_CAMEL)) {
            hasSearchComponentAction = false;
        }
        // note
        //$NON-NLS-1$
        boolean note = element.getLabel().equals(Messages.getString("TalendEditorPaletteFactory.Note"));
        if (!note) {
            if (hasSearchComponentAction) {
                menu.appendToGroup(GEFActionConstants.MB_ADDITIONS, new SearchComponentAction(getPaletteViewer()));
            }
            boolean showFavorAction = true;
            boolean showAddFavorAction = true;
            PaletteContainer pContainer = element.getParent();
            if (pContainer != null) {
                // Favorites Folder or components in Favorites Folder
                if ((pContainer instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(element.getLabel())) || (pContainer.getParent() instanceof PaletteRoot && TalendEditorPaletteFactory.FAVORITES.equals(pContainer.getLabel()))) {
                    showAddFavorAction = false;
                }
            }
            // for INPUT/OUTPUT/TRIGGER, needn't to add to Favorites
            if (element instanceof CreationToolEntry) {
                Object obj = ((CreationToolEntry) element).getToolProperty(CreationTool.PROPERTY_CREATION_FACTORY);
                if (obj instanceof PaletteComponentFactory) {
                    IComponent component = ((PaletteComponentFactory) obj).getComponent();
                    EComponentType componentType = component.getComponentType();
                    if (componentType == EComponentType.JOBLET_INPUT_OUTPUT || componentType == EComponentType.JOBLET_TRIGGER) {
                        showFavorAction = false;
                    }
                }
            }
            if (showFavorAction) {
                // if (ShowFavoriteAction.state == true) {
                if (showAddFavorAction) {
                    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new FavoriteComponentAction(getPaletteViewer()));
                } else {
                    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new RemoveFavoriteComponentAction(getPaletteViewer()));
                }
            }
        }
    }
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new HiddenFloderAction(getPaletteViewer()));
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, new DisplayFloderAction(getPaletteViewer()));
}
Also used : PaletteRoot(org.eclipse.gef.palette.PaletteRoot) PaletteComponentFactory(org.talend.designer.core.ui.editor.PaletteComponentFactory) IComponent(org.talend.core.model.components.IComponent) PaletteEntry(org.eclipse.gef.palette.PaletteEntry) PaletteContainer(org.eclipse.gef.palette.PaletteContainer) EComponentType(org.talend.core.model.components.EComponentType) CreationToolEntry(org.eclipse.gef.palette.CreationToolEntry) ArrayList(java.util.ArrayList) List(java.util.List) CombinedTemplateCreationEntry(org.eclipse.gef.palette.CombinedTemplateCreationEntry)

Aggregations

IComponent (org.talend.core.model.components.IComponent)146 Node (org.talend.designer.core.ui.editor.nodes.Node)54 ArrayList (java.util.ArrayList)47 IElementParameter (org.talend.core.model.process.IElementParameter)36 Process (org.talend.designer.core.ui.editor.process.Process)36 Test (org.junit.Test)35 INode (org.talend.core.model.process.INode)33 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)22 List (java.util.List)15 Property (org.talend.core.model.properties.Property)15 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)13 IComponentsFactory (org.talend.core.model.components.IComponentsFactory)12 Connection (org.talend.designer.core.ui.editor.connections.Connection)12 HashMap (java.util.HashMap)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 DataNode (org.talend.designer.core.model.process.DataNode)10 HashSet (java.util.HashSet)9 IConnection (org.talend.core.model.process.IConnection)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8