Search in sources :

Example 1 with NewRouteResourceWizard

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

the class CreateRouteResourceAction method doRun.

@Override
protected void doRun() {
    IRepositoryNode node = null;
    NewRouteResourceWizard wizard = null;
    ISelection selection = getSelection();
    if (selection == null) {
        return;
    }
    Object obj = ((IStructuredSelection) selection).getFirstElement();
    node = (IRepositoryNode) obj;
    IRepositoryService service = DesignerPlugin.getDefault().getRepositoryService();
    IPath path = service.getRepositoryPath(node);
    if (RepositoryConstants.isSystemFolder(path.toString())) {
        // Not allowed to create in system folder.
        return;
    }
    wizard = new NewRouteResourceWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
    int open = dlg.open();
    if (open == Window.OK) {
        RouteResourceItem item = wizard.getItem();
        IWorkbenchPage page = getActivePage();
        RouteResourceEditorUtil.openEditor(page, null, item);
    }
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) RouteResourceItem(org.talend.camel.core.model.camelProperties.RouteResourceItem) ISelection(org.eclipse.jface.viewers.ISelection) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) NewRouteResourceWizard(org.talend.designer.camel.resource.ui.wizards.NewRouteResourceWizard) 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 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 RouteResourceItem (org.talend.camel.core.model.camelProperties.RouteResourceItem)1 NewRouteResourceWizard (org.talend.designer.camel.resource.ui.wizards.NewRouteResourceWizard)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 IRepositoryService (org.talend.repository.model.IRepositoryService)1