use of org.pentaho.di.ui.core.database.wizard.CreateDatabaseWizard in project pentaho-kettle by pentaho.
the class BaseStepDialog method addConnectionLine.
/**
* Adds the connection line.
*
* @param parent the parent UI component
* @param previous the previous UI component
* @param middle the middle
* @param margin the margin
* @param wlConnection the connection label
* @param wbnConnection the "new connection" button
* @param wbeConnection the "edit connection" button
* @param databaseType the database type
* @return the Combo Box component for the given parameters
*/
public CCombo addConnectionLine(Composite parent, Control previous, int middle, int margin, final Label wlConnection, final Button wbwConnection, final Button wbnConnection, final Button wbeConnection, final Class<? extends DatabaseInterface> databaseType) {
final CCombo wConnection;
final FormData fdlConnection, fdbConnection, fdeConnection, fdConnection, fdbwConnection;
wConnection = new CCombo(parent, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wConnection);
addDatabases(wConnection);
wlConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.Connection.Label"));
props.setLook(wlConnection);
fdlConnection = new FormData();
fdlConnection.left = new FormAttachment(0, 0);
fdlConnection.right = new FormAttachment(middle, -margin);
if (previous != null) {
fdlConnection.top = new FormAttachment(previous, margin);
} else {
fdlConnection.top = new FormAttachment(0, 0);
}
wlConnection.setLayoutData(fdlConnection);
//
// Wizard button
//
wbwConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.WizardConnectionButton.Label"));
wbwConnection.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CreateDatabaseWizard cdw = new CreateDatabaseWizard();
DatabaseMeta newDBInfo = cdw.createAndRunDatabaseWizard(shell, props, transMeta.getDatabases());
if (newDBInfo != null) {
transMeta.addDatabase(newDBInfo);
reinitConnectionDropDown(wConnection, newDBInfo.getName());
}
}
});
fdbwConnection = new FormData();
fdbwConnection.right = new FormAttachment(100, 0);
if (previous != null) {
fdbwConnection.top = new FormAttachment(previous, margin);
} else {
fdbwConnection.top = new FormAttachment(0, 0);
}
wbwConnection.setLayoutData(fdbwConnection);
//
// NEW button
//
wbnConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.NewConnectionButton.Label"));
wbnConnection.addSelectionListener(new AddConnectionListener(wConnection));
fdbConnection = new FormData();
fdbConnection.right = new FormAttachment(wbwConnection, -margin);
if (previous != null) {
fdbConnection.top = new FormAttachment(previous, margin);
} else {
fdbConnection.top = new FormAttachment(0, 0);
}
wbnConnection.setLayoutData(fdbConnection);
//
// Edit button
//
wbeConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.EditConnectionButton.Label"));
wbeConnection.addSelectionListener(new EditConnectionListener(wConnection));
fdeConnection = new FormData();
fdeConnection.right = new FormAttachment(wbnConnection, -margin);
if (previous != null) {
fdeConnection.top = new FormAttachment(previous, margin);
} else {
fdeConnection.top = new FormAttachment(0, 0);
}
wbeConnection.setLayoutData(fdeConnection);
//
// what's left of the line: combo box
//
fdConnection = new FormData();
fdConnection.left = new FormAttachment(middle, 0);
if (previous != null) {
fdConnection.top = new FormAttachment(previous, margin);
} else {
fdConnection.top = new FormAttachment(0, 0);
}
fdConnection.right = new FormAttachment(wbeConnection, -margin);
wConnection.setLayoutData(fdConnection);
return wConnection;
}
use of org.pentaho.di.ui.core.database.wizard.CreateDatabaseWizard in project pentaho-kettle by pentaho.
the class Spoon method createDatabaseWizard.
/**
* Shows a wizard that creates a new database connection...
*/
public void createDatabaseWizard() {
HasDatabasesInterface hasDatabasesInterface = getActiveHasDatabasesInterface();
if (hasDatabasesInterface == null) {
// nowhere to put the new database
return;
}
CreateDatabaseWizard cdw = new CreateDatabaseWizard();
DatabaseMeta newDBInfo = cdw.createAndRunDatabaseWizard(shell, props, hasDatabasesInterface.getDatabases());
if (newDBInfo != null) {
// finished
hasDatabasesInterface.addDatabase(newDBInfo);
refreshTree();
refreshGraph();
}
}
use of org.pentaho.di.ui.core.database.wizard.CreateDatabaseWizard in project pentaho-kettle by pentaho.
the class JobEntryDialog method addConnectionLine.
/**
* Adds the connection line for the given parent and previous control, and returns a combo box UI component
*
* @param parent
* the parent composite object
* @param previous
* the previous control
* @param middle
* the middle
* @param margin
* the margin
* @param wlConnection
* the connection label
* @param wbnConnection
* the "new connection" button
* @param wbeConnection
* the "edit connection" button
* @return the combo box UI component
*/
public CCombo addConnectionLine(Composite parent, Control previous, int middle, int margin, final Label wlConnection, final Button wbwConnection, final Button wbnConnection, final Button wbeConnection) {
final CCombo wConnection;
final FormData fdlConnection, fdbConnection, fdeConnection, fdConnection, fdbwConnection;
wConnection = new CCombo(parent, SWT.BORDER | SWT.READ_ONLY);
props.setLook(wConnection);
addDatabases(wConnection);
wlConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.Connection.Label"));
props.setLook(wlConnection);
fdlConnection = new FormData();
fdlConnection.left = new FormAttachment(0, 0);
fdlConnection.right = new FormAttachment(middle, -margin);
if (previous != null) {
fdlConnection.top = new FormAttachment(previous, margin);
} else {
fdlConnection.top = new FormAttachment(0, 0);
}
wlConnection.setLayoutData(fdlConnection);
//
// Wizard button
//
wbwConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.WizardConnectionButton.Label"));
wbwConnection.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CreateDatabaseWizard cdw = new CreateDatabaseWizard();
DatabaseMeta newDBInfo = cdw.createAndRunDatabaseWizard(shell, props, jobMeta.getDatabases());
if (newDBInfo != null) {
jobMeta.addDatabase(newDBInfo);
reinitConnectionDropDown(wConnection, newDBInfo.getName());
}
}
});
fdbwConnection = new FormData();
fdbwConnection.right = new FormAttachment(100, 0);
if (previous != null) {
fdbwConnection.top = new FormAttachment(previous, margin);
} else {
fdbwConnection.top = new FormAttachment(0, 0);
}
wbwConnection.setLayoutData(fdbwConnection);
//
// NEW button
//
wbnConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.NewConnectionButton.Label"));
wbnConnection.addSelectionListener(new AddConnectionListener(wConnection));
fdbConnection = new FormData();
fdbConnection.right = new FormAttachment(wbwConnection, -margin);
if (previous != null) {
fdbConnection.top = new FormAttachment(previous, margin);
} else {
fdbConnection.top = new FormAttachment(0, 0);
}
wbnConnection.setLayoutData(fdbConnection);
//
// Edit button
//
wbeConnection.setText(BaseMessages.getString(PKG, "BaseStepDialog.EditConnectionButton.Label"));
wbeConnection.addSelectionListener(new EditConnectionListener(wConnection));
fdeConnection = new FormData();
fdeConnection.right = new FormAttachment(wbnConnection, -margin);
if (previous != null) {
fdeConnection.top = new FormAttachment(previous, margin);
} else {
fdeConnection.top = new FormAttachment(0, 0);
}
wbeConnection.setLayoutData(fdeConnection);
//
// what's left of the line: combo box
//
fdConnection = new FormData();
fdConnection.left = new FormAttachment(middle, 0);
if (previous != null) {
fdConnection.top = new FormAttachment(previous, margin);
} else {
fdConnection.top = new FormAttachment(0, 0);
}
fdConnection.right = new FormAttachment(wbeConnection, -margin);
wConnection.setLayoutData(fdConnection);
return wConnection;
}
Aggregations