Search in sources :

Example 46 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class MapperManager method removeSelectedOutputTable.

public void removeSelectedOutputTable() {
    OutputDataMapTableView currentSelectedDataMapTableView = uiManager.getCurrentSelectedOutputTableView();
    if (currentSelectedDataMapTableView != null) {
        OutputTable outputTable = (OutputTable) currentSelectedDataMapTableView.getDataMapTable();
        String tableTitle = ((AbstractDataMapTable) currentSelectedDataMapTableView.getDataMapTable()).getTitle();
        if (MessageDialog.openConfirm(currentSelectedDataMapTableView.getShell(), //$NON-NLS-1$
        Messages.getString("MapperManager.removeOutputTableTitle"), Messages.getString("MapperManager.removeOutputTableTitleMessage", new Object[] { tableTitle }))) {
            //$NON-NLS-1$
            IProcess process = mapperComponent.getProcess();
            uiManager.removeOutputTableView(currentSelectedDataMapTableView);
            uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
            process.removeUniqueConnectionName(outputTable.getUniqueName());
            uiManager.refreshSqlExpression();
        }
    }
}
Also used : AbstractDataMapTable(org.talend.designer.dbmap.model.table.AbstractDataMapTable) IProcess(org.talend.core.model.process.IProcess) OutputDataMapTableView(org.talend.designer.dbmap.ui.visualmap.table.OutputDataMapTableView) OutputTable(org.talend.designer.dbmap.model.table.OutputTable)

Example 47 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class DesignerCoreService method refreshComponentView.

@Override
public void refreshComponentView(Item item) {
    try {
        IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        IEditorReference[] editors = activePage.getEditorReferences();
        for (IEditorReference er : editors) {
            IEditorPart part = er.getEditor(false);
            if (part instanceof AbstractMultiPageTalendEditor) {
                AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
                CommandStack stack = (CommandStack) editor.getTalendEditor().getAdapter(CommandStack.class);
                if (stack != null) {
                    IProcess process = editor.getProcess();
                    for (final INode processNode : process.getGraphicalNodes()) {
                        if (processNode instanceof Node) {
                            checkRepository((Node) processNode, item, stack);
                        }
                    }
                }
            }
        }
    } catch (Exception e) {
        ExceptionHandler.process(e);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CommandStack(org.eclipse.gef.commands.CommandStack) INode(org.talend.core.model.process.INode) IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) INode(org.talend.core.model.process.INode) DataNode(org.talend.designer.core.model.process.DataNode) ConvertRepositoryNodeToProcessNode(org.talend.designer.core.ui.editor.process.ConvertRepositoryNodeToProcessNode) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) IProcess(org.talend.core.model.process.IProcess) JavaModelException(org.eclipse.jdt.core.JavaModelException) ProcessorException(org.talend.designer.runprocess.ProcessorException)

Example 48 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class UpdateNodeParameterCommand method execute.

@Override
public void execute() {
    if (result == null) {
        return;
    }
    Object updateObject = result.getUpdateObject();
    if (updateObject == null || (!(updateObject instanceof Node)) || (!(result.getJob() instanceof IProcess))) {
        return;
    }
    // instance of node before might not be good (loaded while check updates needed)
    // so get the instance of the node of the current job in this object.
    IProcess process = (IProcess) result.getJob();
    for (INode node : process.getGraphicalNodes()) {
        if (node.getUniqueName().equals(((Node) updateObject).getUniqueName())) {
            updateObject = node;
            result.setUpdateObject(updateObject);
            break;
        }
    }
    IUpdateItemType updateType = result.getUpdateType();
    if (updateType instanceof EUpdateItemType) {
        switch((EUpdateItemType) updateType) {
            case NODE_PROPERTY:
                updateProperty();
                break;
            case NODE_SCHEMA:
                updateSchema();
                break;
            case NODE_QUERY:
                updateQuery();
                break;
            case NODE_SAP_FUNCTION:
                updateSAPParameters();
                break;
            case NODE_SAP_IDOC:
                updateSAPIDocParameters();
                break;
            case NODE_VALIDATION_RULE:
                updateValidationRule();
                break;
            default:
                return;
        }
    }
    // else { // for extension
    Node node = (Node) updateObject;
    if (node.getProcess() instanceof IProcess2) {
        PropertyChangeCommand pcc = new PropertyChangeCommand(node, EParameterName.UPDATE_COMPONENTS.getName(), Boolean.TRUE);
        boolean executed = false;
        if (process instanceof IGEFProcess) {
            IDesignerCoreUIService designerCoreUIService = CoreUIPlugin.getDefault().getDesignerCoreUIService();
            if (designerCoreUIService != null) {
                executed = designerCoreUIService.executeCommand((IGEFProcess) process, pcc);
            }
        }
        if (!executed) {
            pcc.execute();
        }
    }
}
Also used : INode(org.talend.core.model.process.INode) PropertyChangeCommand(org.talend.designer.core.ui.editor.cmd.PropertyChangeCommand) Node(org.talend.designer.core.ui.editor.nodes.Node) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IProcess2(org.talend.core.model.process.IProcess2) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IUpdateItemType(org.talend.core.model.update.IUpdateItemType) IDesignerCoreUIService(org.talend.core.ui.services.IDesignerCoreUIService) EUpdateItemType(org.talend.core.model.update.EUpdateItemType) IProcess(org.talend.core.model.process.IProcess) IGEFProcess(org.talend.core.ui.process.IGEFProcess)

Example 49 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class DbGenerationManager method getContextList.

protected List<String> getContextList(DbMapComponent component) {
    List<String> contextList = new ArrayList<String>();
    IProcess process = component.getProcess();
    IContext context = process.getContextManager().getDefaultContext();
    List<IContextParameter> paraList = context.getContextParameterList();
    for (IContextParameter para : paraList) {
        contextList.add(ContextParameterUtils.JAVA_NEW_CONTEXT_PREFIX + para.getName());
    }
    return contextList;
}
Also used : IContext(org.talend.core.model.process.IContext) ArrayList(java.util.ArrayList) IProcess(org.talend.core.model.process.IProcess) IContextParameter(org.talend.core.model.process.IContextParameter)

Example 50 with IProcess

use of org.talend.core.model.process.IProcess in project tdi-studio-se by Talend.

the class MapperManager method removeRejectOutput.

public void removeRejectOutput() {
    List<DataMapTableView> outputsTablesView = uiManager.getOutputsTablesView();
    Iterator<DataMapTableView> iterator = outputsTablesView.iterator();
    DataMapTableView outputTable = null;
    DataMapTableView toRemove = null;
    while (iterator.hasNext()) {
        outputTable = iterator.next();
        if (outputTable.getDataMapTable() instanceof OutputTable && ((OutputTable) outputTable.getDataMapTable()).isErrorRejectTable()) {
            toRemove = outputTable;
            iterator.remove();
            break;
        }
    }
    if (toRemove != null) {
        uiManager.removeOutputTableView(toRemove);
        uiManager.updateToolbarButtonsStates(Zone.OUTPUTS);
        IProcess process = getAbstractMapComponent().getProcess();
        process.removeUniqueConnectionName(toRemove.getDataMapTable().getName());
    }
}
Also used : DataMapTableView(org.talend.designer.mapper.ui.visualmap.table.DataMapTableView) IProcess(org.talend.core.model.process.IProcess) OutputTable(org.talend.designer.mapper.model.table.OutputTable)

Aggregations

IProcess (org.talend.core.model.process.IProcess)102 INode (org.talend.core.model.process.INode)33 ArrayList (java.util.ArrayList)28 IDesignerCoreService (org.talend.designer.core.IDesignerCoreService)24 IProcess2 (org.talend.core.model.process.IProcess2)22 ProcessItem (org.talend.core.model.properties.ProcessItem)21 Node (org.talend.designer.core.ui.editor.nodes.Node)20 List (java.util.List)17 Item (org.talend.core.model.properties.Item)16 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)16 IOException (java.io.IOException)15 PersistenceException (org.talend.commons.exception.PersistenceException)14 IElementParameter (org.talend.core.model.process.IElementParameter)14 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)13 IEditorPart (org.eclipse.ui.IEditorPart)11 ProcessorException (org.talend.designer.runprocess.ProcessorException)10 File (java.io.File)9 Element (org.talend.core.model.process.Element)9 IConnection (org.talend.core.model.process.IConnection)9 IContext (org.talend.core.model.process.IContext)9