Search in sources :

Example 21 with SystemException

use of org.talend.commons.exception.SystemException 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 = new CamelNewBeanWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), beanWizard);
    if (dlg.open() == Window.OK) {
        try {
            openBeanEditor(beanWizard.getBean(), false);
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (SystemException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) ISelection(org.eclipse.jface.viewers.ISelection) 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)

Example 22 with SystemException

use of org.talend.commons.exception.SystemException 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);
        CorePlugin.getDefault().getLibrariesService().resetModulesNeeded();
        CorePlugin.getDefault().getRunProcessService().updateLibraries(new HashSet<ModuleNeeded>(), null);
    } 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) ModuleNeeded(org.talend.core.model.general.ModuleNeeded)

Example 23 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class ReadSqlpatternAction method doRun.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
protected void doRun() {
    RepositoryNode node = (RepositoryNode) ((IStructuredSelection) getSelection()).getFirstElement();
    Property property = (Property) node.getObject().getProperty();
    Property updatedProperty = null;
    try {
        updatedProperty = ProxyRepositoryFactory.getInstance().getLastVersion(new Project(ProjectManager.getInstance().getProject(property.getItem())), property.getId()).getProperty();
    } catch (PersistenceException e) {
        ExceptionHandler.process(e);
    }
    // update the property of the node repository object
    // node.getObject().setProperty(updatedProperty);
    SQLPatternItem sqlpatternItem = (SQLPatternItem) node.getObject().getProperty().getItem();
    try {
        openSQLPatternEditor(sqlpatternItem, true);
    } catch (PartInitException e) {
        MessageBoxExceptionHandler.process(e);
    } catch (SystemException e) {
        MessageBoxExceptionHandler.process(e);
    }
}
Also used : Project(org.talend.core.model.general.Project) SystemException(org.talend.commons.exception.SystemException) PersistenceException(org.talend.commons.exception.PersistenceException) SQLPatternItem(org.talend.core.model.properties.SQLPatternItem) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) Property(org.talend.core.model.properties.Property)

Example 24 with SystemException

use of org.talend.commons.exception.SystemException in project tdi-studio-se by Talend.

the class CreateRoutineAction 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 routineNode = getCurrentRepositoryNode();
    if (isToolbar()) {
        if (routineNode != null && routineNode.getContentType() != ERepositoryObjectType.ROUTINES) {
            routineNode = null;
        }
        if (routineNode == null) {
            routineNode = getRepositoryNodeForDefault(ERepositoryObjectType.ROUTINES);
        }
    }
    RepositoryNode node = null;
    IPath path = null;
    if (!isToolbar()) {
        ISelection selection = getSelection();
        Object obj = ((IStructuredSelection) selection).getFirstElement();
        node = (RepositoryNode) obj;
        path = RepositoryNodeUtilities.getPath(node);
    }
    NewRoutineWizard routineWizard = new NewRoutineWizard(path);
    WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
    if (dlg.open() == Window.OK) {
        try {
            openRoutineEditor(routineWizard.getRoutine(), false);
        } catch (PartInitException e) {
            MessageBoxExceptionHandler.process(e);
        } catch (SystemException e) {
            MessageBoxExceptionHandler.process(e);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) ISelection(org.eclipse.jface.viewers.ISelection) NewRoutineWizard(org.talend.repository.ui.wizards.routines.NewRoutineWizard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) PartInitException(org.eclipse.ui.PartInitException) RepositoryNode(org.talend.repository.model.RepositoryNode) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

SystemException (org.talend.commons.exception.SystemException)24 IFile (org.eclipse.core.resources.IFile)10 PartInitException (org.eclipse.ui.PartInitException)9 CoreException (org.eclipse.core.runtime.CoreException)6 PersistenceException (org.talend.commons.exception.PersistenceException)6 IOException (java.io.IOException)5 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)5 Property (org.talend.core.model.properties.Property)5 ICodeGeneratorService (org.talend.designer.codegen.ICodeGeneratorService)5 RepositoryNode (org.talend.repository.model.RepositoryNode)5 File (java.io.File)4 RoutineItem (org.talend.core.model.properties.RoutineItem)4 FileOutputStream (java.io.FileOutputStream)3 IPath (org.eclipse.core.runtime.IPath)3 ISelection (org.eclipse.jface.viewers.ISelection)3 WizardDialog (org.eclipse.jface.wizard.WizardDialog)3 Project (org.talend.core.model.general.Project)3 Item (org.talend.core.model.properties.Item)3 SQLPatternItem (org.talend.core.model.properties.SQLPatternItem)3 BufferedInputStream (java.io.BufferedInputStream)2