Search in sources :

Example 6 with BeanItem

use of org.talend.camel.core.model.camelProperties.BeanItem in project tesb-studio-se by Talend.

the class EditCamelBean method doRun.

/*
     * (non-Javadoc)
     *
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
protected void doRun() {
    if (repositoryNode == null) {
        repositoryNode = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    }
    BeanItem beanItem = (BeanItem) repositoryNode.getObject().getProperty().getItem();
    try {
        openBeanEditor(beanItem, false);
        refresh(repositoryNode);
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : SystemException(org.talend.commons.exception.SystemException) BeanItem(org.talend.camel.core.model.camelProperties.BeanItem) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException)

Example 7 with BeanItem

use of org.talend.camel.core.model.camelProperties.BeanItem in project tesb-studio-se by Talend.

the class RemoveBeansDuplicateLibrariesMigrationTask method execute.

@Override
public ExecutionResult execute(Item item) {
    if (item instanceof BeanItem) {
        BeanItem beanItem = (BeanItem) item;
        removeDuplicateModulesInBeanImport(beanItem);
        try {
            ProxyRepositoryFactory.getInstance().save(beanItem);
        } catch (PersistenceException e) {
            ExceptionHandler.process(e);
            return ExecutionResult.FAILURE;
        }
        return ExecutionResult.SUCCESS_NO_ALERT;
    } else {
        return ExecutionResult.NOTHING_TO_DO;
    }
}
Also used : PersistenceException(org.talend.commons.exception.PersistenceException) BeanItem(org.talend.camel.core.model.camelProperties.BeanItem)

Example 8 with BeanItem

use of org.talend.camel.core.model.camelProperties.BeanItem 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

BeanItem (org.talend.camel.core.model.camelProperties.BeanItem)8 PersistenceException (org.talend.commons.exception.PersistenceException)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 PartInitException (org.eclipse.ui.PartInitException)2 SystemException (org.talend.commons.exception.SystemException)2 IComponent (org.talend.core.model.components.IComponent)2 ModuleNeeded (org.talend.core.model.general.ModuleNeeded)2 IOException (java.io.IOException)1 Entry (java.util.Map.Entry)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 IPath (org.eclipse.core.runtime.IPath)1 ISelection (org.eclipse.jface.viewers.ISelection)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Test (org.junit.Test)1 CamelProcessItem (org.talend.camel.core.model.camelProperties.CamelProcessItem)1 RouteDocumentItem (org.talend.camel.core.model.camelProperties.RouteDocumentItem)1 RouteResourceItem (org.talend.camel.core.model.camelProperties.RouteResourceItem)1 CamelRepositoryContentHandler (org.talend.camel.designer.CamelRepositoryContentHandler)1 CamelNewBeanWizard (org.talend.camel.designer.ui.wizards.CamelNewBeanWizard)1