Search in sources :

Example 1 with CamelNewInnerBeanWizard

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

the class CreateCamelBean method doRun.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    // RepositoryNode codeNode = getViewPart().getRoot().getChildren().get(4);
    // RepositoryNode routineNode = codeNode.getChildren().get(0);
    RepositoryNode beanNode = getCurrentRepositoryNode();
    if (isToolbar()) {
        if (beanNode != null && beanNode.getContentType() != CamelRepositoryNodeType.repositoryBeansType) {
            beanNode = null;
        }
        if (beanNode == null) {
            beanNode = getRepositoryNodeForDefault(CamelRepositoryNodeType.repositoryBeansType);
        }
    }
    RepositoryNode node = null;
    IPath path = null;
    if (!isToolbar()) {
        ISelection selection = getSelection();
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        node = (RepositoryNode) obj;
        path = RepositoryNodeUtilities.getPath(node);
    }
    CamelNewBeanWizard beanWizard;
    if (ERepositoryObjectType.BEANSJAR == node.getParent().getContentType()) {
        beanWizard = new CamelNewInnerBeanWizard(node, path);
    } else {
        beanWizard = new CamelNewBeanWizard(path);
    }
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), beanWizard);
    if (dlg.open() == Window.OK) {
        try {
            BeanItem beanItem = beanWizard.getBean();
            openBeanEditor(beanItem, false);
            if (RoutinesUtil.isInnerCodes(beanItem.getProperty())) {
                IRunProcessService.get().getTalendCodesJarJavaProject(CodesJarResourceCache.getCodesJarByInnerCode(beanItem)).buildWholeCodeProject();
            } else {
                IRunProcessService.get().getTalendCodeJavaProject(ERepositoryObjectType.BEANS).buildWholeCodeProject();
            }
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (SystemException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : CamelNewInnerBeanWizard(org.talend.camel.designer.ui.wizards.CamelNewInnerBeanWizard) IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) ISelection(org.eclipse.jface.viewers.ISelection) BeanItem(org.talend.camel.core.model.camelProperties.BeanItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) CamelNewBeanWizard(org.talend.camel.designer.ui.wizards.CamelNewBeanWizard) PartInitException(org.eclipse.ui.PartInitException) ProjectRepositoryNode(org.talend.core.repository.model.ProjectRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

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 BeanItem (org.talend.camel.core.model.camelProperties.BeanItem)1 CamelNewBeanWizard (org.talend.camel.designer.ui.wizards.CamelNewBeanWizard)1 CamelNewInnerBeanWizard (org.talend.camel.designer.ui.wizards.CamelNewInnerBeanWizard)1 SystemException (org.talend.commons.exception.SystemException)1 ProjectRepositoryNode (org.talend.core.repository.model.ProjectRepositoryNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1