Search in sources :

Example 1 with NewSqlpatternWizard

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);
        }
    }
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) SystemException(org.talend.commons.exception.SystemException) NewSqlpatternWizard(org.talend.repository.ui.wizards.sqlpattern.NewSqlpatternWizard) ISelection(org.eclipse.jface.viewers.ISelection) 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 Path (org.eclipse.core.runtime.Path)1 ISelection (org.eclipse.jface.viewers.ISelection)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 NewSqlpatternWizard (org.talend.repository.ui.wizards.sqlpattern.NewSqlpatternWizard)1