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);
}
}
}
Aggregations