Search in sources :

Example 11 with ExplorerException

use of net.sourceforge.sqlexplorer.ExplorerException in project tdq-studio-se by Talend.

the class CreateAliasDlg method okPressed.

protected void okPressed() {
    try {
        User previousUser = alias.getDefaultUser();
        alias.setName(nameField.getText().trim());
        int selIndex = cboDriver.getSelectionIndex();
        ManagedDriver driver = comboDriverIndexes.get(selIndex);
        alias.setDriver(driver);
        alias.setUrl(urlField.getText().trim());
        if (noUsernameRequired.getSelection())
            alias.setHasNoUserName(true);
        else {
            alias.setHasNoUserName(false);
            if (userField.getText().trim().length() > 0)
                alias.setDefaultUser(new User(userField.getText().trim(), passwordField.getText().trim()));
        }
        alias.setName(this.nameField.getText().trim());
        alias.setSchemaFilterExpression("");
        alias.setNameFilterExpression("");
        alias.setFolderFilterExpression("");
        alias.setConnectAtStartup(logonAtStartupButton.getSelection());
        alias.setAutoLogon(autoLogonButton.getSelection());
        if (type != Type.CHANGE)
            SQLExplorerPlugin.getDefault().getAliasManager().addAlias(alias);
        else // objects even though we have explicitly created a new instance of User above)
        if (alias.getDefaultUser() != previousUser) {
            if (!previousUser.isInUse())
                alias.removeUser(previousUser);
        }
        User user = alias.getDefaultUser();
        if (user != null) {
            user.setAutoCommit(autoCommitButton.getSelection());
            user.setCommitOnClose(commitOnCloseButton.getSelection());
        }
    } catch (ExplorerException excp) {
        // $NON-NLS-1$
        SQLExplorerPlugin.error("Validation Exception", excp);
    // System.out.println(Messages.getString("Error_Validation_Exception_4"));//$NON-NLS-1$
    }
    // Notify that ther has been changes
    SQLExplorerPlugin.getDefault().getAliasManager().modelChanged();
    close();
}
Also used : User(net.sourceforge.sqlexplorer.dbproduct.User) ExplorerException(net.sourceforge.sqlexplorer.ExplorerException) ManagedDriver(net.sourceforge.sqlexplorer.dbproduct.ManagedDriver)

Example 12 with ExplorerException

use of net.sourceforge.sqlexplorer.ExplorerException in project tdq-studio-se by Talend.

the class DataPreviewView method createPartControl.

/* (non-JavaDoc)
	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
	 */
@Override
public void createPartControl(Composite parent) {
    // this.parent = new Composite(parent, SWT.NULL);
    this.parent = parent;
    this.parent.setLayout(new FillLayout());
    try {
        displayPreviewer();
    } catch (ExplorerException e) {
        SQLExplorerPlugin.error(e.getMessage(), e);
    // Control[] children = parent.getChildren();
    // for (Control control : children)
    // control.dispose();
    // parent.setLayout(new FillLayout());
    // Text text = new Text(parent, SWT.NONE);
    // text.setEditable(false);
    // text.setText(e.getMessage());
    // parent.layout();
    }
}
Also used : ExplorerException(net.sourceforge.sqlexplorer.ExplorerException) FillLayout(org.eclipse.swt.layout.FillLayout)

Aggregations

ExplorerException (net.sourceforge.sqlexplorer.ExplorerException)12 IOException (java.io.IOException)5 File (java.io.File)4 DefaultElement (org.dom4j.tree.DefaultElement)4 Element (org.dom4j.Element)3 SAXReader (org.dom4j.io.SAXReader)3 FileWriter (java.io.FileWriter)2 SQLException (java.sql.SQLException)2 ManagedDriver (net.sourceforge.sqlexplorer.dbproduct.ManagedDriver)2 DocumentException (org.dom4j.DocumentException)2 OutputFormat (org.dom4j.io.OutputFormat)2 XMLWriter (org.dom4j.io.XMLWriter)2 FileInputStream (java.io.FileInputStream)1 StringReader (java.io.StringReader)1 URL (java.net.URL)1 Connection (java.sql.Connection)1 Properties (java.util.Properties)1 SQLCannotConnectException (net.sourceforge.sqlexplorer.SQLCannotConnectException)1 DataSet (net.sourceforge.sqlexplorer.dataset.DataSet)1 XmlDataType (net.sourceforge.sqlexplorer.dataset.XmlDataType)1