use of org.talend.repository.ui.wizards.sqlpattern.NewSqlpatternWizard in project tdi-studio-se by Talend.
the class CreateSqlpatternAction method doRun.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
protected void doRun() {
RepositoryNode sqlPatternNode = null;
if (!isFromSqlPatternComposite) {
sqlPatternNode = getCurrentRepositoryNode();
}
if (isToolbar()) {
if (sqlPatternNode != null && sqlPatternNode.getContentType() != ERepositoryObjectType.SQLPATTERNS) {
sqlPatternNode = null;
}
if (sqlPatternNode == null) {
sqlPatternNode = getRepositoryNodeForDefault(ERepositoryObjectType.SQLPATTERNS);
}
}
RepositoryNode node = null;
IPath path;
if (this.sqlPatternPath != null) {
path = new Path(this.sqlPatternPath);
} else if (isToolbar()) {
path = RepositoryNodeUtilities.getPath(sqlPatternNode);
} else {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
node = (RepositoryNode) obj;
path = RepositoryNodeUtilities.getPath(node);
}
NewSqlpatternWizard routineWizard = new NewSqlpatternWizard(path);
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), routineWizard);
if (dlg.open() == Window.OK) {
try {
openSQLPatternEditor(routineWizard.getSQLPattern(), false);
} catch (PartInitException e) {
MessageBoxExceptionHandler.process(e);
} catch (SystemException e) {
MessageBoxExceptionHandler.process(e);
}
}
}
Aggregations