Search in sources :

Example 6 with PartitionSchemaDialog

use of org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog in project pentaho-kettle by pentaho.

the class RepositoryExplorerDialog method newPartitionSchema.

public void newPartitionSchema() {
    try {
        PartitionSchema partitionSchema = new PartitionSchema();
        PartitionSchemaDialog dd = new PartitionSchemaDialog(shell, partitionSchema, rep.readDatabases(), variableSpace);
        if (dd.open()) {
            // See if this slave server already exists...
            ObjectId idPartitionSchema = rep.getPartitionSchemaID(partitionSchema.getName());
            if (idPartitionSchema == null) {
                rep.insertLogEntry("Creating new partition schema '" + partitionSchema.getName() + "'");
                rep.save(partitionSchema, Const.VERSION_COMMENT_INITIAL_VERSION, null);
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.PartitionSchema.Create.AlreadyExists.Message"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.PartitionSchema.Create.AlreadyExists.Title"));
                mb.open();
            }
            // Refresh tree...
            refreshTree();
        }
    } catch (KettleException e) {
        new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.PartitionSchema.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.PartitionSchema.Create.UnexpectedError.Message"), e);
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) PartitionSchema(org.pentaho.di.partition.PartitionSchema) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) PartitionSchemaDialog(org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)6 PartitionSchemaDialog (org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog)6 PartitionSchema (org.pentaho.di.partition.PartitionSchema)5 ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)5 ObjectId (org.pentaho.di.repository.ObjectId)4 MessageBox (org.eclipse.swt.widgets.MessageBox)3 RepositoryExplorer (org.pentaho.di.ui.repository.repositoryexplorer.RepositoryExplorer)2 UIPartition (org.pentaho.di.ui.repository.repositoryexplorer.model.UIPartition)1