Search in sources :

Example 81 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class PartitionsController method createPartition.

public void createPartition() {
    try {
        PartitionSchema partition = new PartitionSchema();
        PartitionSchemaDialog partitionDialog = new PartitionSchemaDialog(shell, partition, repository.readDatabases(), variableSpace);
        if (partitionDialog.open()) {
            // See if this partition already exists...
            ObjectId idPartition = repository.getPartitionSchemaID(partition.getName());
            if (idPartition == null) {
                if (partition.getName() != null && !partition.getName().equals("")) {
                    repository.insertLogEntry(BaseMessages.getString(RepositoryExplorer.class, "PartitionsController.Message.CreatingPartition", partition.getName()));
                    repository.save(partition, Const.VERSION_COMMENT_INITIAL_VERSION, null);
                    if (mainController != null && mainController.getSharedObjectSyncUtil() != null) {
                        mainController.getSharedObjectSyncUtil().reloadTransformationRepositoryObjects(true);
                    }
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.InvalidName.Message"));
                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.Title"));
                    mb.open();
                }
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.AlreadyExists.Message"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.AlreadyExists.Title"));
                mb.open();
            }
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Create.UnexpectedError.Message"), e);
        }
    } finally {
        refreshPartitions();
    }
}
Also used : RepositoryExplorer(org.pentaho.di.ui.repository.repositoryexplorer.RepositoryExplorer) 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)

Example 82 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class PartitionsController method editPartition.

public void editPartition() {
    String partitionSchemaName = "";
    try {
        Collection<UIPartition> partitions = partitionsTable.getSelectedItems();
        if (partitions != null && !partitions.isEmpty()) {
            // Grab the first item in the list & send it to the partition schema dialog
            PartitionSchema partitionSchema = ((UIPartition) partitions.toArray()[0]).getPartitionSchema();
            partitionSchemaName = partitionSchema.getName();
            // Make sure the partition already exists
            ObjectId partitionId = repository.getPartitionSchemaID(partitionSchema.getName());
            if (partitionId == null) {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.DoesNotExists.Message", partitionSchemaName));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.Title"));
                mb.open();
            } else {
                PartitionSchemaDialog partitionDialog = new PartitionSchemaDialog(shell, partitionSchema, repository.readDatabases(), variableSpace);
                if (partitionDialog.open()) {
                    if (partitionSchema.getName() != null && !partitionSchema.getName().equals("")) {
                        repository.insertLogEntry(BaseMessages.getString(RepositoryExplorer.class, "PartitionsController.Message.UpdatingPartition", partitionSchema.getName()));
                        repository.save(partitionSchema, Const.VERSION_COMMENT_EDIT_VERSION, null);
                        if (mainController != null && mainController.getSharedObjectSyncUtil() != null) {
                            mainController.getSharedObjectSyncUtil().synchronizePartitionSchemas(partitionSchema, partitionSchemaName);
                        }
                    } else {
                        MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                        mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.InvalidName.Message"));
                        mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.Title"));
                        mb.open();
                    }
                }
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
            mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.NoItemSelected.Message"));
            mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.Title"));
            mb.open();
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Edit.UnexpectedError.Message") + partitionSchemaName + "]", e);
        }
    } finally {
        refreshPartitions();
    }
}
Also used : RepositoryExplorer(org.pentaho.di.ui.repository.repositoryexplorer.RepositoryExplorer) 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) UIPartition(org.pentaho.di.ui.repository.repositoryexplorer.model.UIPartition) PartitionSchemaDialog(org.pentaho.di.ui.partition.dialog.PartitionSchemaDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 83 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class SlavesController method createSlave.

public void createSlave() {
    try {
        // Create a new SlaveServer for storing the result
        SlaveServer slaveServer = new SlaveServer();
        SlaveServerDialog ssd = new SlaveServerDialog(shell, slaveServer);
        if (ssd.open()) {
            ObjectId slaveId = repository.getSlaveID(slaveServer.getName());
            // Make sure the slave does not already exist
            if (slaveId != null) {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.AlreadyExists.Message", slaveServer.getName()));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"));
                mb.open();
            } else {
                if (slaveServer.getName() != null && !slaveServer.getName().equals("")) {
                    repository.insertLogEntry(BaseMessages.getString(PKG, "SlavesController.Message.CreatingSlave", slaveServer.getName()));
                    repository.save(slaveServer, Const.VERSION_COMMENT_INITIAL_VERSION, null);
                    if (getSharedObjectSyncUtil() != null) {
                        getSharedObjectSyncUtil().reloadJobRepositoryObjects(true);
                        getSharedObjectSyncUtil().reloadTransformationRepositoryObjects(true);
                    }
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Edit.InvalidName.Message"));
                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"));
                    mb.open();
                }
            }
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Slave.Create.UnexpectedError.Message"), e);
        }
    } finally {
        refreshSlaves();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) SlaveServerDialog(org.pentaho.di.ui.cluster.dialog.SlaveServerDialog) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) SlaveServer(org.pentaho.di.cluster.SlaveServer) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 84 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class ClustersController method createCluster.

public void createCluster() {
    try {
        ClusterSchema cluster = new ClusterSchema();
        ClusterSchemaDialog clusterDialog = new ClusterSchemaDialog(shell, cluster, repository.getSlaveServers());
        if (clusterDialog.open()) {
            // See if this cluster already exists...
            ObjectId idCluster = repository.getClusterID(cluster.getName());
            if (idCluster == null) {
                if (cluster.getName() != null && !cluster.getName().equals("")) {
                    repository.insertLogEntry(BaseMessages.getString(RepositoryExplorer.class, "ClusterController.Message.CreatingNewCluster", cluster.getName()));
                    repository.save(cluster, Const.VERSION_COMMENT_INITIAL_VERSION, null);
                    if (mainController != null && mainController.getSharedObjectSyncUtil() != null) {
                        mainController.getSharedObjectSyncUtil().reloadTransformationRepositoryObjects(true);
                    }
                } else {
                    MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                    mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Edit.InvalidName.Message"));
                    mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Edit.Title"));
                    mb.open();
                }
            } else {
                MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Message"));
                mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.AlreadyExists.Title"));
                mb.open();
            }
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Cluster.Create.UnexpectedError.Message"), e);
        }
    } finally {
        refreshClusters();
    }
}
Also used : RepositoryExplorer(org.pentaho.di.ui.repository.repositoryexplorer.RepositoryExplorer) KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) ClusterSchema(org.pentaho.di.cluster.ClusterSchema) ClusterSchemaDialog(org.pentaho.di.ui.cluster.dialog.ClusterSchemaDialog) MessageBox(org.eclipse.swt.widgets.MessageBox)

Example 85 with ErrorDialog

use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.

the class ConnectionsController method removeConnection.

public void removeConnection() {
    try {
        Collection<UIDatabaseConnection> connections = connectionsTable.getSelectedItems();
        if (connections != null && !connections.isEmpty()) {
            for (Object obj : connections) {
                if (obj != null && obj instanceof UIDatabaseConnection) {
                    UIDatabaseConnection connection = (UIDatabaseConnection) obj;
                    DatabaseMeta databaseMeta = connection.getDatabaseMeta();
                    // Make sure this connection already exists and store its id for updating
                    ObjectId idDatabase = repository.getDatabaseID(databaseMeta.getName());
                    if (idDatabase == null) {
                        MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
                        mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.DoesNotExists.Message", databaseMeta.getName()));
                        mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
                        mb.open();
                    } else {
                        repository.deleteDatabaseMeta(databaseMeta.getName());
                        reloadLoadedJobsAndTransformations();
                    }
                }
            }
        } else {
            MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
            mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Edit.NoItemSelected.Message"));
            mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Delete.Title"));
            mb.open();
        }
    } catch (KettleException e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Create.UnexpectedError.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Connection.Remove.UnexpectedError.Message"), e);
        }
    } finally {
        refreshConnectionList();
    }
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) UIDatabaseConnection(org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection) ErrorDialog(org.pentaho.di.ui.core.dialog.ErrorDialog) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) MessageBox(org.eclipse.swt.widgets.MessageBox)

Aggregations

ErrorDialog (org.pentaho.di.ui.core.dialog.ErrorDialog)527 KettleException (org.pentaho.di.core.exception.KettleException)440 RowMetaInterface (org.pentaho.di.core.row.RowMetaInterface)178 MessageBox (org.eclipse.swt.widgets.MessageBox)118 TableItem (org.eclipse.swt.widgets.TableItem)97 ValueMetaInterface (org.pentaho.di.core.row.ValueMetaInterface)76 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)63 TransMeta (org.pentaho.di.trans.TransMeta)48 Shell (org.eclipse.swt.widgets.Shell)46 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)46 ValueMetaString (org.pentaho.di.core.row.value.ValueMetaString)44 EnterTextDialog (org.pentaho.di.ui.core.dialog.EnterTextDialog)44 ArrayList (java.util.ArrayList)43 TableItemInsertListener (org.pentaho.di.ui.trans.step.TableItemInsertListener)43 EnterSelectionDialog (org.pentaho.di.ui.core.dialog.EnterSelectionDialog)42 SelectionEvent (org.eclipse.swt.events.SelectionEvent)40 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)39 StepMeta (org.pentaho.di.trans.step.StepMeta)38 FormData (org.eclipse.swt.layout.FormData)37 FormLayout (org.eclipse.swt.layout.FormLayout)37