Search in sources :

Example 1 with CamelProcessEditorInput

use of org.talend.camel.designer.ui.editor.CamelProcessEditorInput 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)

Example 2 with CamelProcessEditorInput

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

the class ReadCamelProcess method doRun.

@Override
protected void doRun() {
    final IRepositoryNode node = (IRepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    CamelProcessItem processItem = (CamelProcessItem) node.getObject().getProperty().getItem();
    IWorkbenchPage page = getActivePage();
    try {
        CamelProcessEditorInput fileEditorInput = new CamelProcessEditorInput(processItem, true, null, true);
        checkUnLoadedNodeForProcess(fileEditorInput);
        IEditorPart editorPart = page.findEditor(fileEditorInput);
        if (editorPart == null) {
            fileEditorInput.setRepositoryNode(node);
            page.openEditor(fileEditorInput, CamelMultiPageTalendEditor.ID, true);
        } else {
            page.activate(editorPart);
        }
    } catch (PartInitException | PersistenceException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) CamelProcessItem(org.talend.camel.core.model.camelProperties.CamelProcessItem) CamelProcessEditorInput(org.talend.camel.designer.ui.editor.CamelProcessEditorInput) PersistenceException(org.talend.commons.exception.PersistenceException) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Example 3 with CamelProcessEditorInput

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

the class CreateCamelProcess method openEditor.

protected final void openEditor(ProcessItem processItem) throws PersistenceException, PartInitException {
    // Set readonly to false since created job will always be editable.
    CamelProcessEditorInput fileEditorInput = new CamelProcessEditorInput(processItem, false, true, false);
    IRepositoryNode repositoryNode = RepositorySeekerManager.getInstance().searchRepoViewNode(fileEditorInput.getItem().getProperty().getId(), false);
    fileEditorInput.setRepositoryNode(repositoryNode);
    IWorkbenchPage page = getActivePage();
    page.openEditor(fileEditorInput, getEditorId(), true);
// // use project setting true
// ProjectSettingManager.defaultUseProjectSetting(fileEditorInput.getLoadedProcess());
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) CamelProcessEditorInput(org.talend.camel.designer.ui.editor.CamelProcessEditorInput) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Aggregations

IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)3 CamelProcessEditorInput (org.talend.camel.designer.ui.editor.CamelProcessEditorInput)3 IRepositoryNode (org.talend.repository.model.IRepositoryNode)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 IEditorPart (org.eclipse.ui.IEditorPart)1 PartInitException (org.eclipse.ui.PartInitException)1 CamelProcessItem (org.talend.camel.core.model.camelProperties.CamelProcessItem)1 SaveAsRoutesWizard (org.talend.camel.designer.ui.wizards.SaveAsRoutesWizard)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 JobEditorInput (org.talend.core.ui.editor.JobEditorInput)1