Search in sources :

Example 11 with AbstractMultiPageTalendEditor

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

the class StatsAndLogsView method getCurrentJob.

/**
     * Gets current opened job.
     */
private void getCurrentJob() {
    final IEditorPart activeEditor = getSite().getPage().getActiveEditor();
    if (activeEditor != null && activeEditor instanceof AbstractMultiPageTalendEditor) {
        AbstractTalendEditor talendEditor = ((AbstractMultiPageTalendEditor) activeEditor).getTalendEditor();
        Process process = (Process) talendEditor.getProcess();
        if (process != null) {
            this.process = process;
            this.title = talendEditor.getTitle();
        }
    }
}
Also used : AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) AbstractTalendEditor(org.talend.designer.core.ui.editor.AbstractTalendEditor) Process(org.talend.designer.core.ui.editor.process.Process) IEditorPart(org.eclipse.ui.IEditorPart)

Example 12 with AbstractMultiPageTalendEditor

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

the class ProblemsView method selectInDesigner.

private void selectInDesigner(BasicJobInfo jobInfo, String nodeName) {
    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
    IEditorReference[] editorParts = page.getEditorReferences();
    for (IEditorReference reference : editorParts) {
        IEditorPart editor = reference.getEditor(false);
        if (editor instanceof AbstractMultiPageTalendEditor) {
            AbstractMultiPageTalendEditor mpte = (AbstractMultiPageTalendEditor) editor;
            if (mpte.getTalendEditor().getProcess().getId().equals(jobInfo.getJobId()) && mpte.getTalendEditor().getProcess().getVersion().equals(jobInfo.getJobVersion())) {
                page.bringToTop(mpte);
                mpte.selectNode(nodeName);
            }
        }
    }
}
Also used : IEditorReference(org.eclipse.ui.IEditorReference) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

Example 13 with AbstractMultiPageTalendEditor

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

the class NotesPasteCommand method undo.

@SuppressWarnings("unchecked")
@Override
public void undo() {
    // remove the current selection
    AbstractMultiPageTalendEditor multiPageTalendEditor = (AbstractMultiPageTalendEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    GraphicalViewer viewer = multiPageTalendEditor.getTalendEditor().getViewer();
    if (!multipleCommand) {
        viewer.deselectAll();
    }
    for (Note note : noteList) {
        process.removeNote(note);
    }
    // set the old selection active
    if (!multipleCommand) {
        StructuredSelection s = new StructuredSelection(oldSelection);
        viewer.setSelection(s);
    }
    process.checkStartNodes();
    process.checkProcess();
}
Also used : GraphicalViewer(org.eclipse.gef.GraphicalViewer) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) Note(org.talend.designer.core.ui.editor.notes.Note) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection)

Example 14 with AbstractMultiPageTalendEditor

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

the class StatsAndLogsHelper method changeRepositoryConnection.

static void changeRepositoryConnection(Element process, StatsAndLogsComposite statsComposite) {
    String propertyType = (String) ElementParameter2ParameterType.getParameterValue(process, EParameterName.PROPERTY_TYPE.getName());
    String id = (String) (ElementParameter2ParameterType.getParameterValue(process, EParameterName.PROPERTY_TYPE.getName()));
    Connection repositoryConnection = null;
    /* 16969 */
    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;
    }
    ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(process, repositoryConnection, ImplicitContextLoadHelper.getExtraParameterName(EParameterName.PROPERTY_TYPE) + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
    propertyType);
    ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(process, repositoryConnection, ImplicitContextLoadHelper.getExtraParameterName(EParameterName.PROPERTY_TYPE) + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
    id);
    AbstractMultiPageTalendEditor part = (AbstractMultiPageTalendEditor) ((IProcess2) process).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);
        }
    }
}
Also used : ConnectionItem(org.talend.core.model.properties.ConnectionItem) Item(org.talend.core.model.properties.Item) 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) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Property(org.talend.core.model.properties.Property) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 15 with AbstractMultiPageTalendEditor

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

the class ProjectSettingManager method changeImplicitContextRepositoryItem.

static void changeImplicitContextRepositoryItem(Element process, ExtraComposite extraComposite) {
    // change repository item
    String propertyType = (String) ElementParameter2ParameterType.getParameterValue(process, JobSettingsConstants.getExtraParameterName(EParameterName.PROPERTY_TYPE.getName()));
    String id = (String) (ElementParameter2ParameterType.getParameterValue(process, EParameterName.PROPERTY_TYPE.getName()));
    Connection repositoryConnection = null;
    /* 16969 */
    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;
    }
    ChangeValuesFromRepository cmd1 = new ChangeValuesFromRepository(process, repositoryConnection, ImplicitContextLoadHelper.getExtraParameterName(EParameterName.PROPERTY_TYPE) + ":" + EParameterName.PROPERTY_TYPE.getName(), //$NON-NLS-1$
    propertyType);
    ChangeValuesFromRepository cmd2 = new ChangeValuesFromRepository(process, repositoryConnection, ImplicitContextLoadHelper.getExtraParameterName(EParameterName.PROPERTY_TYPE) + ":" + EParameterName.REPOSITORY_PROPERTY_TYPE.getName(), //$NON-NLS-1$
    id);
    AbstractMultiPageTalendEditor part = (AbstractMultiPageTalendEditor) ((IProcess2) process).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);
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) ConnectionItem(org.talend.core.model.properties.ConnectionItem) 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) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) PersistenceException(org.talend.commons.exception.PersistenceException) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) 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