Search in sources :

Example 1 with SaveAsProcessWizard

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

the class SaveAsProcessAction method run.

@Override
public void run() {
    SaveAsProcessWizard processWizard = new SaveAsProcessWizard(editorPart);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
    if (dlg.open() == Window.OK) {
        try {
            // Set readonly to false since created job will always be editable.
            JobEditorInput newJobEditorInput = new ProcessEditorInput(processWizard.getProcess(), true, true, false);
            IWorkbenchPage page = getActivePage();
            IRepositoryNode repositoryNode = RepositoryNodeUtilities.getRepositoryNode(newJobEditorInput.getItem().getProperty().getId(), false);
            newJobEditorInput.setRepositoryNode(repositoryNode);
            // close the old editor
            page.closeEditor(((AbstractTalendEditor) this.editorPart).getParent(), false);
            // open the new editor, because at the same time, there will update the jobSetting/componentSetting view
            page.openEditor(newJobEditorInput, MultiPageTalendEditor.ID, true);
        } catch (Exception e) {
            MessageDialog.openError(Display.getCurrent().getActiveShell(), "Error", "Job could not be saved" + " : " + e.getMessage());
            ExceptionHandler.process(e);
        }
    }
}
Also used : JobEditorInput(org.talend.core.ui.editor.JobEditorInput) IRepositoryNode(org.talend.repository.model.IRepositoryNode) SaveAsProcessWizard(org.talend.designer.core.ui.wizards.SaveAsProcessWizard) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog) ProcessEditorInput(org.talend.designer.core.ui.editor.ProcessEditorInput)

Aggregations

WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 JobEditorInput (org.talend.core.ui.editor.JobEditorInput)1 ProcessEditorInput (org.talend.designer.core.ui.editor.ProcessEditorInput)1 SaveAsProcessWizard (org.talend.designer.core.ui.wizards.SaveAsProcessWizard)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1