Search in sources :

Example 1 with CamelNewProcessWizard

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

the class CreateCamelProcess method doRun.

@Override
protected void doRun() {
    final CamelNewProcessWizard processWizard;
    if (isToolbar()) {
        processWizard = new CamelNewProcessWizard(null);
    } else {
        ISelection selection = getSelection();
        if (selection == null) {
            return;
        }
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
        IPath path = service.getRepositoryPath((IRepositoryNode) obj);
        if (RepositoryConstants.isSystemFolder(path.toString())) {
            // Not allowed to create in system folder.
            return;
        }
        processWizard = new CamelNewProcessWizard(path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), processWizard);
    if (dlg.open() == Window.OK) {
        if (processWizard.getProcess() == null) {
            return;
        }
        try {
            openEditor(processWizard.getProcess());
        } catch (PartInitException e) {
            ExceptionHandler.process(e);
        } catch (PersistenceException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : CamelNewProcessWizard(org.talend.camel.designer.ui.wizards.CamelNewProcessWizard) IPath(org.eclipse.core.runtime.IPath) ISelection(org.eclipse.jface.viewers.ISelection) PersistenceException(org.talend.commons.exception.PersistenceException) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IRepositoryService(org.talend.repository.model.IRepositoryService)

Aggregations

IPath (org.eclipse.core.runtime.IPath)1 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 PartInitException (org.eclipse.ui.PartInitException)1 CamelNewProcessWizard (org.talend.camel.designer.ui.wizards.CamelNewProcessWizard)1 PersistenceException (org.talend.commons.exception.PersistenceException)1 IRepositoryService (org.talend.repository.model.IRepositoryService)1