Search in sources :

Example 1 with NewRoutineWizard

use of org.talend.repository.ui.wizards.routines.NewRoutineWizard 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

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 SystemException (org.talend.commons.exception.SystemException)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1 NewRoutineWizard (org.talend.repository.ui.wizards.routines.NewRoutineWizard)1