Search in sources :

Example 1 with SaveAsRoutesWizard

use of org.talend.camel.designer.ui.wizards.SaveAsRoutesWizard in project tesb-studio-se by Talend.

the class SaveAsRoutesAction method run.

@Override
public void run() {
    SaveAsRoutesWizard processWizard = new SaveAsRoutesWizard((JobEditorInput) editorPart.getEditorInput());
    WizardDialog dlg = new WizardDialog(editorPart.getSite().getShell(), processWizard);
    if (dlg.open() == Window.OK) {
        try {
            // Set readonly to false since created routes will always be editable.
            JobEditorInput newRoutesEditorInput = new CamelProcessEditorInput(processWizard.getProcess(), true, true, false);
            IWorkbenchPage page = editorPart.getSite().getPage();
            IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(newRoutesEditorInput.getItem().getProperty().getId(), false);
            newRoutesEditorInput.setRepositoryNode(repositoryNode);
            // close the old editor
            page.closeEditor(editorPart, false);
            // open the new editor, because at the same time, there will update the routes view
            page.openEditor(newRoutesEditorInput, CamelMultiPageTalendEditor.ID, true);
        } catch (Exception e) {
            MessageDialog.openError(editorPart.getSite().getShell(), "Error", "Routes could not be saved" + " : " + e.getMessage());
            ExceptionHandler.process(e);
        }
    }
}
Also used : JobEditorInput(org.talend.core.ui.editor.JobEditorInput) IRepositoryNode(org.talend.repository.model.IRepositoryNode) CamelProcessEditorInput(org.talend.camel.designer.ui.editor.CamelProcessEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) SaveAsRoutesWizard(org.talend.camel.designer.ui.wizards.SaveAsRoutesWizard) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

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