Search in sources :

Example 36 with AbstractMultiPageTalendEditor

use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.

the class EditProcess method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    IRepositoryNode node = getSelectedObject();
    if (node == null) {
        return;
    }
    Property property = node.getObject().getProperty();
    if (property != null) {
        Assert.isTrue(property.getItem() instanceof ProcessItem);
        ProcessItem processItem = (ProcessItem) property.getItem();
        IWorkbenchPage page = getActivePage();
        try {
            final JobEditorInput fileEditorInput = getEditorInput(processItem);
            checkUnLoadedNodeForProcess(fileEditorInput);
            final IEditorPart editorPart = page.findEditor(fileEditorInput);
            if (editorPart == null) {
                fileEditorInput.setRepositoryNode(node);
                page.openEditor(fileEditorInput, getEditorId(), true);
            } else {
                ((AbstractMultiPageTalendEditor) editorPart).setReadOnly(fileEditorInput.setForceReadOnly(false));
                page.activate(editorPart);
            }
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (PersistenceException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : JobEditorInput(org.talend.core.ui.editor.JobEditorInput) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ProcessItem(org.talend.core.model.properties.ProcessItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) PersistenceException(org.talend.commons.exception.PersistenceException) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) Property(org.talend.core.model.properties.Property)

Example 37 with AbstractMultiPageTalendEditor

use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tesb-studio-se by Talend.

the class ESBService method repositoryChange.

private void repositoryChange(RepositoryNode repNode, INode node, IProcess2 process) {
    IElementParameter param = node.getElementParameterFromField(EParameterFieldType.PROPERTY_TYPE);
    ConnectionItem connectionItem = (ConnectionItem) repNode.getObject().getProperty().getItem();
    if (param != null) {
        param.getChildParameters().get(EParameterName.PROPERTY_TYPE.getName()).setValue(EmfComponent.REPOSITORY);
        param.getChildParameters().get(EParameterName.REPOSITORY_PROPERTY_TYPE.getName()).setValue("");
        connectionItem.getProperty().getId();
        ((PortRepositoryObject) repNode.getParent().getObject()).getId();
        ((OperationRepositoryObject) repNode.getObject()).getId();
        ChangeValuesFromRepository command2 = new ChangeValuesFromRepository(node, null, param.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
        "BUILT_IN");
        IEditorPart editor = process.getEditor();
        if (editor == null) {
            command2.execute();
        } else {
            ((AbstractMultiPageTalendEditor) editor).getTalendEditor().getCommandStack().execute(command2);
        }
    }
}
Also used : ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IElementParameter(org.talend.core.model.process.IElementParameter) PortRepositoryObject(org.talend.repository.services.utils.PortRepositoryObject) IEditorPart(org.eclipse.ui.IEditorPart) OperationRepositoryObject(org.talend.repository.services.utils.OperationRepositoryObject)

Example 38 with AbstractMultiPageTalendEditor

use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.

the class SQLBuilderService method openSQLBuilderDialog.

public void openSQLBuilderDialog(ConnectionParameters connParameters, Composite composite, IElement elem, String propertyName, CommandStack commandStack, Object abstractElementPropertySectionController, Object abstractMultiPageTalendEditor) {
    OpenSQLBuilderDialogJob openDialogJob = new OpenSQLBuilderDialogJob(connParameters, composite, elem, propertyName, commandStack, (AbstractElementPropertySectionController) abstractElementPropertySectionController);
    IWorkbenchSiteProgressService siteps = (IWorkbenchSiteProgressService) ((AbstractMultiPageTalendEditor) abstractMultiPageTalendEditor).getSite().getAdapter(IWorkbenchSiteProgressService.class);
    siteps.showInDialog(composite.getShell(), openDialogJob);
    openDialogJob.schedule();
}
Also used : IWorkbenchSiteProgressService(org.eclipse.ui.progress.IWorkbenchSiteProgressService) OpenSQLBuilderDialogJob(org.talend.sqlbuilder.ui.OpenSQLBuilderDialogJob) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor)

Example 39 with AbstractMultiPageTalendEditor

use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.

the class MapperUI method closeMapperDialog.

public void closeMapperDialog(int response) {
    mapperResponse = response;
    if (response == SWT.OK || response == SWT.APPLICATION_MODAL) {
        prepareClosing(response);
        mapperComponent.setExternalEmfData(copyOfMapData);
        if (response == SWT.APPLICATION_MODAL) {
            IExternalNode externalNode = mapperComponent;
            IWorkbenchPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
            if (externalNode != null && (part instanceof AbstractMultiPageTalendEditor)) {
                INode node = externalNode.getOriginalNode();
                if (node != null && node instanceof Node) {
                    Command cmd = new ExternalNodeChangeCommand((Node) node, externalNode);
                    CommandStack cmdStack = (CommandStack) part.getAdapter(CommandStack.class);
                    cmdStack.execute(cmd);
                }
            }
        }
        IElementParameter elementParameter = mapperComponent.getElementParameter("DIE_ON_ERROR");
        if (elementParameter != null) {
            elementParameter.setValue(mapperManager.isDieOnError());
        }
    }
    if (response == SWT.OK) {
        closeWithoutPrompt = true;
    }
    if (response == SWT.OK || response == SWT.CANCEL) {
        mapperShell.close();
    }
}
Also used : ExternalNodeChangeCommand(org.talend.designer.core.ui.editor.cmd.ExternalNodeChangeCommand) CommandStack(org.eclipse.gef.commands.CommandStack) INode(org.talend.core.model.process.INode) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) ExternalNodeChangeCommand(org.talend.designer.core.ui.editor.cmd.ExternalNodeChangeCommand) Command(org.eclipse.gef.commands.Command) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Node(org.talend.designer.core.ui.editor.nodes.Node) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) IExternalNode(org.talend.core.model.process.IExternalNode) INode(org.talend.core.model.process.INode) IElementParameter(org.talend.core.model.process.IElementParameter) IExternalNode(org.talend.core.model.process.IExternalNode)

Example 40 with AbstractMultiPageTalendEditor

use of org.talend.designer.core.ui.AbstractMultiPageTalendEditor in project tdi-studio-se by Talend.

the class StatsAndLogsViewHelper method reloadValuesFromPreferencePage.

/**
     * ftang Comment method "reloadValuesFromPreferencePage".
     * 
     * @param preferenceStore
     * @param element
     */
public static void reloadValuesFromPreferencePage(Element element, IDynamicProperty propertyComposite) {
    List<? extends IElementParameter> elementParameters = element.getElementParameters();
    for (IElementParameter elementParameter : elementParameters) {
        String name = elementParameter.getName();
        if (name.equals(EParameterName.ON_STATCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_STATCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_LOGCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_LOGCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_METERCATCHER_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_METERCATCHER_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.ON_FILES_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_FILES_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.FILE_PATH.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILE_PATH.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_STATS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_STATS.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_LOGS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_LOGS.getName())));
            continue;
        }
        if (name.equals(EParameterName.FILENAME_METTER.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.FILENAME_METTER.getName())));
            continue;
        }
        if (name.equals(EParameterName.ON_DATABASE_FLAG.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.ON_DATABASE_FLAG.getName()));
            continue;
        }
        if (name.equals(EParameterName.PROPERTY_TYPE.getName())) {
            String propertyType = PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName());
            String id = PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.REPOSITORY_PROPERTY_TYPE.getName());
            /* 16969 */
            Connection repositoryConnection = null;
            IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
            Item item = null;
            try {
                IRepositoryViewObject repobj = factory.getLastVersion(id);
                if (repobj != null) {
                    Property tmpproperty = repobj.getProperty();
                    if (tmpproperty != null) {
                        item = tmpproperty.getItem();
                    }
                }
            } catch (PersistenceException e) {
                ExceptionHandler.process(e);
            }
            if (item != null && item instanceof ConnectionItem) {
                repositoryConnection = ((ConnectionItem) item).getConnection();
            } else {
                repositoryConnection = null;
            }
            // Map<String, ConnectionItem> repositoryConnectionItemMap =
            // propertyComposite.getRepositoryConnectionItemMap();
            //
            // if (repositoryConnectionItemMap.containsKey(id)) {
            // repositoryConnection = repositoryConnectionItemMap.get(id).getConnection();
            // } else {
            // repositoryConnection = null;
            // }
            ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(element, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
            propertyType);
            ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(element, repositoryConnection, EParameterName.PROPERTY_TYPE.getName() + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
            id);
            AbstractMultiPageTalendEditor part = (AbstractMultiPageTalendEditor) ((IProcess2) element).getEditor();
            if (part instanceof AbstractMultiPageTalendEditor) {
                Object adapter = part.getTalendEditor().getAdapter(CommandStack.class);
                if (adapter != null) {
                    CommandStack commandStack = ((CommandStack) adapter);
                    commandStack.execute(cmd1);
                    commandStack.execute(cmd2);
                }
            }
            continue;
        }
        if (PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTY_TYPE.getName()).equals(EmfComponent.BUILTIN)) {
            if (name.equals(EParameterName.DB_TYPE.getName())) {
                elementParameter.setValue(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DB_TYPE.getName()));
                continue;
            }
            if (name.equals(EParameterName.HOST.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.HOST.getName())));
                continue;
            }
            if (name.equals(EParameterName.PORT.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PORT.getName())));
                continue;
            }
            if (name.equals(EParameterName.DBNAME.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DBNAME.getName())));
                continue;
            }
            if (name.equals(EParameterName.PROPERTIES.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PROPERTIES.getName())));
                continue;
            }
            if (name.equals(EParameterName.DBFILE.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.DBFILE.getName())));
                continue;
            }
            if (name.equals(EParameterName.SCHEMA_DB.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.SCHEMA_DB.getName())));
                continue;
            }
            if (name.equals(EParameterName.USER.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.USER.getName())));
                continue;
            }
            if (name.equals(EParameterName.PASS.getName())) {
                elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.PASS.getName())));
                continue;
            }
        }
        if (name.equals(EParameterName.TABLE_STATS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_STATS.getName())));
            continue;
        }
        if (name.equals(EParameterName.TABLE_LOGS.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_LOGS.getName())));
            continue;
        }
        if (name.equals(EParameterName.TABLE_METER.getName())) {
            elementParameter.setValue(checkAndAddQuote(PREFERENCE_STORE.getString(LANGUAGE_PREFIX + EParameterName.TABLE_METER.getName())));
            continue;
        }
        if (name.equals(EParameterName.CATCH_RUNTIME_ERRORS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_RUNTIME_ERRORS.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_USER_ERRORS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_USER_ERRORS.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_USER_WARNING.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_USER_WARNING.getName()));
            continue;
        }
        if (name.equals(EParameterName.CATCH_REALTIME_STATS.getName())) {
            elementParameter.setValue(PREFERENCE_STORE.getBoolean(LANGUAGE_PREFIX + EParameterName.CATCH_REALTIME_STATS.getName()));
            continue;
        }
    }
}
Also used : CommandStack(org.eclipse.gef.commands.CommandStack) ChangeValuesFromRepository(org.talend.designer.core.ui.editor.cmd.ChangeValuesFromRepository) ConnectionItem(org.talend.core.model.properties.ConnectionItem) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Connection(org.talend.core.model.metadata.builder.connection.Connection) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IElementParameter(org.talend.core.model.process.IElementParameter) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDynamicProperty(org.talend.core.ui.properties.tab.IDynamicProperty) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Aggregations

AbstractMultiPageTalendEditor (org.talend.designer.core.ui.AbstractMultiPageTalendEditor)53 IEditorPart (org.eclipse.ui.IEditorPart)26 INode (org.talend.core.model.process.INode)16 Node (org.talend.designer.core.ui.editor.nodes.Node)15 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)14 CommandStack (org.eclipse.gef.commands.CommandStack)13 AbstractTalendEditor (org.talend.designer.core.ui.editor.AbstractTalendEditor)12 GraphicalViewer (org.eclipse.gef.GraphicalViewer)10 IExternalNode (org.talend.core.model.process.IExternalNode)10 IProcess (org.talend.core.model.process.IProcess)10 ArrayList (java.util.ArrayList)9 List (java.util.List)8 EditPart (org.eclipse.gef.EditPart)8 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)8 IEditorReference (org.eclipse.ui.IEditorReference)7 PersistenceException (org.talend.commons.exception.PersistenceException)7 IProcess2 (org.talend.core.model.process.IProcess2)7 Property (org.talend.core.model.properties.Property)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 Process (org.talend.designer.core.ui.editor.process.Process)7