in plugins/actions/snowflake/src/main/java/org/apache/hop/workflow/actions/snowflake/WarehouseManagerDialog.java [167:987]
public IAction open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.MAX | SWT.RESIZE);
PropsUi.setLook(shell);
WorkflowDialog.setShellImage(shell, warehouseManager);
backupChanged = warehouseManager.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = PropsUi.getFormMargin();
formLayout.marginHeight = PropsUi.getFormMargin();
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Title"));
int middle = props.getMiddlePct();
int margin = PropsUi.getMargin();
// Name line
Label wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Name.Label"));
PropsUi.setLook(wlName);
FormData fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.top = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, -margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wName);
FormData fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(middle, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// Connection line
wConnection = addConnectionLine(shell, wName, warehouseManager.getDatabaseMeta(), null);
if (warehouseManager.getDatabaseMeta() == null && workflowMeta.nrDatabases() == 1) {
wConnection.select(0);
}
// Warehouse name line
//
Label wlWarehouseName = new Label(shell, SWT.RIGHT);
wlWarehouseName.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.WarehouseName.Label"));
PropsUi.setLook(wlWarehouseName);
FormData fdlWarehouseName = new FormData();
fdlWarehouseName.left = new FormAttachment(0, 0);
fdlWarehouseName.top = new FormAttachment(wConnection, margin * 2);
fdlWarehouseName.right = new FormAttachment(middle, -margin);
wlWarehouseName.setLayoutData(fdlWarehouseName);
wWarehouseName = new ComboVar(variables, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wWarehouseName);
FormData fdWarehouseName = new FormData();
fdWarehouseName.left = new FormAttachment(middle, 0);
fdWarehouseName.top = new FormAttachment(wConnection, margin * 2);
fdWarehouseName.right = new FormAttachment(100, 0);
wWarehouseName.setLayoutData(fdWarehouseName);
wWarehouseName.addFocusListener(
new FocusAdapter() {
/**
* Get the list of stages for the schema, and populate the stage name drop down.
*
* @param focusEvent The event
*/
@Override
public void focusGained(FocusEvent focusEvent) {
DatabaseMeta databaseMeta = workflowMeta.findDatabase(wConnection.getText(), variables);
if (databaseMeta != null) {
String warehouseName = wWarehouseName.getText();
wWarehouseName.removeAll();
Database db = null;
try {
db = new Database(loggingObject, variables, databaseMeta);
db.connect();
try (ResultSet resultSet =
db.openQuery("show warehouses;", null, null, ResultSet.FETCH_FORWARD, false)) {
IRowMeta rowMeta = db.getReturnRowMeta();
Object[] row = db.getRow(resultSet);
int nameField = rowMeta.indexOfValue("NAME");
if (nameField >= 0) {
while (row != null) {
String name = rowMeta.getString(row, nameField);
wWarehouseName.add(name);
row = db.getRow(resultSet);
}
} else {
throw new HopException("Unable to find warehouse name field in result");
}
db.closeQuery(resultSet);
}
if (warehouseName != null) {
wWarehouseName.setText(warehouseName);
}
} catch (Exception ex) {
warehouseManager.logDebug("Error getting warehouses", ex);
} finally {
if (db != null) {
db.disconnect();
}
}
}
}
});
// ///////////////////
// Action line
// ///////////////////
Label wlAction = new Label(shell, SWT.RIGHT);
wlAction.setText(BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Action.Label"));
PropsUi.setLook(wlAction);
FormData fdlAction = new FormData();
fdlAction.left = new FormAttachment(0, 0);
fdlAction.right = new FormAttachment(middle, -margin);
fdlAction.top = new FormAttachment(wWarehouseName, margin);
wlAction.setLayoutData(fdlAction);
wAction = new CCombo(shell, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wAction.setItems(MANAGEMENT_ACTION_DESCS);
PropsUi.setLook(wAction);
FormData fdAction = new FormData();
fdAction.left = new FormAttachment(middle, 0);
fdAction.top = new FormAttachment(wWarehouseName, margin);
fdAction.right = new FormAttachment(100, 0);
wAction.setLayoutData(fdAction);
wAction.addSelectionListener(
new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent selectionEvent) {
setFlags();
}
});
/////////////////////
// Start Create Warehouse Group
/////////////////////
wCreateGroup = new Group(shell, SWT.SHADOW_ETCHED_IN);
wCreateGroup.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Group.CreateWarehouse.Label"));
FormLayout createWarehouseLayout = new FormLayout();
createWarehouseLayout.marginWidth = 3;
createWarehouseLayout.marginHeight = 3;
wCreateGroup.setLayout(createWarehouseLayout);
PropsUi.setLook(wCreateGroup);
FormData fdgCreateGroup = new FormData();
fdgCreateGroup.left = new FormAttachment(0, 0);
fdgCreateGroup.right = new FormAttachment(100, 0);
fdgCreateGroup.top = new FormAttachment(wAction, margin * 2);
wCreateGroup.setLayoutData(fdgCreateGroup);
// //////////////////////
// Replace line
// /////////////////////
Label wlCreateReplace = new Label(wCreateGroup, SWT.RIGHT);
wlCreateReplace.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.Replace.Label"));
wlCreateReplace.setToolTipText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.Replace.Tooltip"));
PropsUi.setLook(wlCreateReplace);
FormData fdlCreateReplace = new FormData();
fdlCreateReplace.left = new FormAttachment(0, 0);
fdlCreateReplace.top = new FormAttachment(0, margin * 2);
fdlCreateReplace.right = new FormAttachment(middle, -margin);
wlCreateReplace.setLayoutData(fdlCreateReplace);
wCreateReplace = new Button(wCreateGroup, SWT.CHECK);
PropsUi.setLook(wCreateReplace);
FormData fdCreateReplace = new FormData();
fdCreateReplace.left = new FormAttachment(middle, 0);
fdCreateReplace.top = new FormAttachment(0, margin * 2);
fdCreateReplace.right = new FormAttachment(100, 0);
wCreateReplace.setLayoutData(fdCreateReplace);
wCreateReplace.addListener(SWT.Selection, e -> warehouseManager.setChanged());
wCreateReplace.addListener(SWT.Selection, e -> setFlags());
// /////////////////////
// Fail if exists line
// /////////////////////
Label wlCreateFailIfExists = new Label(wCreateGroup, SWT.RIGHT);
wlCreateFailIfExists.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.FailIfExists.Label"));
PropsUi.setLook(wlCreateFailIfExists);
FormData fdlCreateFailIfExists = new FormData();
fdlCreateFailIfExists.left = new FormAttachment(0, 0);
fdlCreateFailIfExists.top = new FormAttachment(wCreateReplace, margin * 2);
fdlCreateFailIfExists.right = new FormAttachment(middle, -margin);
wlCreateFailIfExists.setLayoutData(fdlCreateFailIfExists);
wCreateFailIfExists = new Button(wCreateGroup, SWT.CHECK);
PropsUi.setLook(wCreateFailIfExists);
FormData fdCreateFailIfExists = new FormData();
fdCreateFailIfExists.left = new FormAttachment(middle, 0);
fdCreateFailIfExists.top = new FormAttachment(wCreateReplace, margin * 2);
fdCreateFailIfExists.right = new FormAttachment(100, 0);
wCreateFailIfExists.setLayoutData(fdCreateFailIfExists);
wCreateFailIfExists.addListener(SWT.Selection, e -> warehouseManager.setChanged());
// Warehouse Size
//
Label wlCreateWarehouseSize = new Label(wCreateGroup, SWT.RIGHT);
wlCreateWarehouseSize.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.CreateWarehouseSize.Label"));
PropsUi.setLook(wlCreateWarehouseSize);
FormData fdlCreateWarehouseSize = new FormData();
fdlCreateWarehouseSize.left = new FormAttachment(0, 0);
fdlCreateWarehouseSize.top = new FormAttachment(wCreateFailIfExists, margin * 2);
fdlCreateWarehouseSize.right = new FormAttachment(middle, -margin);
wlCreateWarehouseSize.setLayoutData(fdlCreateWarehouseSize);
wCreateWarehouseSize =
new ComboVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateWarehouseSize);
wCreateWarehouseSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateWarehouseSize = new FormData();
fdCreateWarehouseSize.left = new FormAttachment(middle, 0);
fdCreateWarehouseSize.top = new FormAttachment(wCreateFailIfExists, margin * 2);
fdCreateWarehouseSize.right = new FormAttachment(100, 0);
wCreateWarehouseSize.setLayoutData(fdCreateWarehouseSize);
wCreateWarehouseSize.setItems(WAREHOUSE_SIZE_DESCS);
// Warehouse Type
//
Label wlCreateWarehouseType = new Label(wCreateGroup, SWT.RIGHT);
wlCreateWarehouseType.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.CreateWarehouseType.Label"));
PropsUi.setLook(wlCreateWarehouseType);
FormData fdlCreateWarehouseType = new FormData();
fdlCreateWarehouseType.left = new FormAttachment(0, 0);
fdlCreateWarehouseType.top = new FormAttachment(wCreateWarehouseSize, margin * 2);
fdlCreateWarehouseType.right = new FormAttachment(middle, -margin);
wlCreateWarehouseType.setLayoutData(fdlCreateWarehouseType);
wCreateWarehouseType =
new ComboVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateWarehouseType);
wCreateWarehouseType.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateWarehouseType = new FormData();
fdCreateWarehouseType.left = new FormAttachment(middle, 0);
fdCreateWarehouseType.top = new FormAttachment(wCreateWarehouseSize, margin * 2);
fdCreateWarehouseType.right = new FormAttachment(100, 0);
wCreateWarehouseType.setLayoutData(fdCreateWarehouseType);
wCreateWarehouseType.setItems(WAREHOUSE_TYPE_DESCS);
// /////////////////////
// Max Cluster Size
// /////////////////////
Label wlCreateMaxClusterSize = new Label(wCreateGroup, SWT.RIGHT);
wlCreateMaxClusterSize.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Create.MaxClusterSize.Label"));
PropsUi.setLook(wlCreateMaxClusterSize);
FormData fdlCreateMaxClusterSize = new FormData();
fdlCreateMaxClusterSize.left = new FormAttachment(0, 0);
fdlCreateMaxClusterSize.top = new FormAttachment(wCreateWarehouseType, margin * 2);
fdlCreateMaxClusterSize.right = new FormAttachment(middle, -margin);
wlCreateMaxClusterSize.setLayoutData(fdlCreateMaxClusterSize);
wCreateMaxClusterSize =
new TextVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateGroup);
wCreateMaxClusterSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateMaxClusterSize = new FormData();
fdCreateMaxClusterSize.left = new FormAttachment(middle, 0);
fdCreateMaxClusterSize.right = new FormAttachment(100, 0);
fdCreateMaxClusterSize.top = new FormAttachment(wCreateWarehouseType, margin * 2);
wCreateMaxClusterSize.setLayoutData(fdCreateMaxClusterSize);
// /////////////////////
// Min Cluster Size
// /////////////////////
Label wlCreateMinClusterSize = new Label(wCreateGroup, SWT.RIGHT);
wlCreateMinClusterSize.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Create.MinClusterSize.Label"));
PropsUi.setLook(wlCreateMinClusterSize);
FormData fdlCreateMinClusterSize = new FormData();
fdlCreateMinClusterSize.left = new FormAttachment(0, 0);
fdlCreateMinClusterSize.top = new FormAttachment(wCreateMaxClusterSize, margin * 2);
fdlCreateMinClusterSize.right = new FormAttachment(middle, -margin);
wlCreateMinClusterSize.setLayoutData(fdlCreateMinClusterSize);
wCreateMinClusterSize =
new TextVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateGroup);
wCreateMinClusterSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateMinClusterSize = new FormData();
fdCreateMinClusterSize.left = new FormAttachment(middle, 0);
fdCreateMinClusterSize.right = new FormAttachment(100, 0);
fdCreateMinClusterSize.top = new FormAttachment(wCreateMaxClusterSize, margin * 2);
wCreateMinClusterSize.setLayoutData(fdCreateMinClusterSize);
// /////////////////////
// Auto Suspend Size
// /////////////////////
Label wlCreateAutoSuspend = new Label(wCreateGroup, SWT.RIGHT);
wlCreateAutoSuspend.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.AutoSuspend.Label"));
wlCreateAutoSuspend.setToolTipText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.AutoSuspend.Tooltip"));
PropsUi.setLook(wlCreateAutoSuspend);
FormData fdlCreateAutoSuspend = new FormData();
fdlCreateAutoSuspend.left = new FormAttachment(0, 0);
fdlCreateAutoSuspend.top = new FormAttachment(wCreateMinClusterSize, margin * 2);
fdlCreateAutoSuspend.right = new FormAttachment(middle, -margin);
wlCreateAutoSuspend.setLayoutData(fdlCreateAutoSuspend);
wCreateAutoSuspend = new TextVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateGroup);
wCreateAutoSuspend.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateAutoSuspend = new FormData();
fdCreateAutoSuspend.left = new FormAttachment(middle, 0);
fdCreateAutoSuspend.right = new FormAttachment(100, 0);
fdCreateAutoSuspend.top = new FormAttachment(wCreateMinClusterSize, margin * 2);
wCreateAutoSuspend.setLayoutData(fdCreateAutoSuspend);
// /////////////////////
// Auto-resume
// /////////////////////
Label wlCreateAutoResume = new Label(wCreateGroup, SWT.RIGHT);
wlCreateAutoResume.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.AutoResume.Label"));
PropsUi.setLook(wlCreateAutoResume);
FormData fdlCreateAutoResume = new FormData();
fdlCreateAutoResume.left = new FormAttachment(0, 0);
fdlCreateAutoResume.top = new FormAttachment(wCreateAutoSuspend, margin * 2);
fdlCreateAutoResume.right = new FormAttachment(middle, -margin);
wlCreateAutoResume.setLayoutData(fdlCreateAutoResume);
wCreateAutoResume = new Button(wCreateGroup, SWT.CHECK);
PropsUi.setLook(wCreateAutoResume);
FormData fdCreateAutoResume = new FormData();
fdCreateAutoResume.left = new FormAttachment(middle, 0);
fdCreateAutoResume.top = new FormAttachment(wCreateAutoSuspend, margin * 2);
fdCreateAutoResume.right = new FormAttachment(100, 0);
wCreateAutoResume.setLayoutData(fdCreateAutoResume);
wCreateAutoResume.addListener(SWT.Selection, e -> warehouseManager.setChanged());
// /////////////////////
// Auto-resume
// /////////////////////
Label wlCreateInitialSuspend = new Label(wCreateGroup, SWT.RIGHT);
wlCreateInitialSuspend.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Create.InitialSuspend.Label"));
wlCreateInitialSuspend.setToolTipText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Create.InitialSuspend.Tooltip"));
PropsUi.setLook(wlCreateInitialSuspend);
FormData fdlCreateInitialSuspend = new FormData();
fdlCreateInitialSuspend.left = new FormAttachment(0, 0);
fdlCreateInitialSuspend.top = new FormAttachment(wCreateAutoResume, margin * 2);
fdlCreateInitialSuspend.right = new FormAttachment(middle, -margin);
wlCreateInitialSuspend.setLayoutData(fdlCreateInitialSuspend);
wCreateInitialSuspend = new Button(wCreateGroup, SWT.CHECK);
PropsUi.setLook(wCreateInitialSuspend);
FormData fdCreateInitialSuspend = new FormData();
fdCreateInitialSuspend.left = new FormAttachment(middle, 0);
fdCreateInitialSuspend.top = new FormAttachment(wCreateAutoResume, margin * 2);
fdCreateInitialSuspend.right = new FormAttachment(100, 0);
wCreateInitialSuspend.setLayoutData(fdCreateInitialSuspend);
wCreateInitialSuspend.addListener(SWT.Selection, e -> warehouseManager.setChanged());
// Resource monitor line
//
Label wlCreateResourceMonitor = new Label(wCreateGroup, SWT.RIGHT);
wlCreateResourceMonitor.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.ResourceMonitor.Label"));
PropsUi.setLook(wlCreateResourceMonitor);
FormData fdlCreateResourceMonitor = new FormData();
fdlCreateResourceMonitor.left = new FormAttachment(0, 0);
fdlCreateResourceMonitor.top = new FormAttachment(wCreateInitialSuspend, margin * 2);
fdlCreateResourceMonitor.right = new FormAttachment(middle, -margin);
wlCreateResourceMonitor.setLayoutData(fdlCreateResourceMonitor);
wCreateResourceMonitor =
new ComboVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateResourceMonitor);
wCreateResourceMonitor.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateResourceMonitor = new FormData();
fdCreateResourceMonitor.left = new FormAttachment(middle, 0);
fdCreateResourceMonitor.top = new FormAttachment(wCreateInitialSuspend, margin * 2);
fdCreateResourceMonitor.right = new FormAttachment(100, 0);
wCreateResourceMonitor.setLayoutData(fdCreateResourceMonitor);
wCreateResourceMonitor.addFocusListener(
new FocusAdapter() {
/**
* Get the list of stages for the schema, and populate the stage name drop down.
*
* @param focusEvent The event
*/
@Override
public void focusGained(FocusEvent focusEvent) {
getResourceMonitors();
}
});
// /////////////////////
// Comment Line
// /////////////////////
Label wlCreateComment = new Label(wCreateGroup, SWT.RIGHT);
wlCreateComment.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Create.Comment.Label"));
PropsUi.setLook(wlCreateComment);
FormData fdlCreateComment = new FormData();
fdlCreateComment.left = new FormAttachment(0, 0);
fdlCreateComment.top = new FormAttachment(wCreateResourceMonitor, margin * 2);
fdlCreateComment.right = new FormAttachment(middle, -margin);
wlCreateComment.setLayoutData(fdlCreateComment);
wCreateComment = new TextVar(variables, wCreateGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wCreateGroup);
wCreateComment.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdCreateComment = new FormData();
fdCreateComment.left = new FormAttachment(middle, 0);
fdCreateComment.right = new FormAttachment(100, 0);
fdCreateComment.top = new FormAttachment(wCreateResourceMonitor, margin * 2);
wCreateComment.setLayoutData(fdCreateComment);
/////////////////////
// Start Drop Warehouse Group
/////////////////////
wDropGroup = new Group(shell, SWT.SHADOW_ETCHED_IN);
wDropGroup.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Group.DropWarehouse.Label"));
FormLayout dropWarehouseLayout = new FormLayout();
dropWarehouseLayout.marginWidth = 3;
dropWarehouseLayout.marginHeight = 3;
wDropGroup.setLayout(dropWarehouseLayout);
PropsUi.setLook(wDropGroup);
FormData fdgDropGroup = new FormData();
fdgDropGroup.left = new FormAttachment(0, 0);
fdgDropGroup.right = new FormAttachment(100, 0);
fdgDropGroup.top = new FormAttachment(wAction, margin * 2);
wDropGroup.setLayoutData(fdgDropGroup);
// //////////////////////
// Fail if Not exists line
// /////////////////////
Label wlDropFailIfNotExists = new Label(wDropGroup, SWT.RIGHT);
wlDropFailIfNotExists.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Drop.FailIfNotExists.Label"));
PropsUi.setLook(wlDropFailIfNotExists);
FormData fdlDropFailIfNotExists = new FormData();
fdlDropFailIfNotExists.left = new FormAttachment(0, 0);
fdlDropFailIfNotExists.top = new FormAttachment(0, margin);
fdlDropFailIfNotExists.right = new FormAttachment(middle, -margin);
wlDropFailIfNotExists.setLayoutData(fdlDropFailIfNotExists);
wDropFailIfNotExists = new Button(wDropGroup, SWT.CHECK);
PropsUi.setLook(wDropFailIfNotExists);
FormData fdDropFailIfNotExists = new FormData();
fdDropFailIfNotExists.left = new FormAttachment(middle, 0);
fdDropFailIfNotExists.top = new FormAttachment(0, margin);
fdDropFailIfNotExists.right = new FormAttachment(100, 0);
wDropFailIfNotExists.setLayoutData(fdDropFailIfNotExists);
wDropFailIfNotExists.addListener(SWT.Selection, e -> warehouseManager.setChanged());
/////////////////////
// Start Resume Warehouse Group
/////////////////////
wResumeGroup = new Group(shell, SWT.SHADOW_ETCHED_IN);
wResumeGroup.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Group.ResumeWarehouse.Label"));
FormLayout resumeWarehouseLayout = new FormLayout();
resumeWarehouseLayout.marginWidth = 3;
resumeWarehouseLayout.marginHeight = 3;
wResumeGroup.setLayout(resumeWarehouseLayout);
PropsUi.setLook(wResumeGroup);
FormData fdgResumeGroup = new FormData();
fdgResumeGroup.left = new FormAttachment(0, 0);
fdgResumeGroup.right = new FormAttachment(100, 0);
fdgResumeGroup.top = new FormAttachment(wAction, margin * 2);
wResumeGroup.setLayoutData(fdgResumeGroup);
// //////////////////////
// Fail if Not exists line
// /////////////////////
Label wlResumeFailIfNotExists = new Label(wResumeGroup, SWT.RIGHT);
wlResumeFailIfNotExists.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Resume.FailIfNotExists.Label"));
PropsUi.setLook(wlResumeFailIfNotExists);
FormData fdlResumeFailIfNotExists = new FormData();
fdlResumeFailIfNotExists.left = new FormAttachment(0, 0);
fdlResumeFailIfNotExists.top = new FormAttachment(0, margin);
fdlResumeFailIfNotExists.right = new FormAttachment(middle, -margin);
wlResumeFailIfNotExists.setLayoutData(fdlResumeFailIfNotExists);
wResumeFailIfNotExists = new Button(wResumeGroup, SWT.CHECK);
PropsUi.setLook(wResumeFailIfNotExists);
FormData fdResumeFailIfNotExists = new FormData();
fdResumeFailIfNotExists.left = new FormAttachment(middle, 0);
fdResumeFailIfNotExists.top = new FormAttachment(0, margin);
fdResumeFailIfNotExists.right = new FormAttachment(100, 0);
wResumeFailIfNotExists.setLayoutData(fdResumeFailIfNotExists);
wResumeFailIfNotExists.addListener(SWT.Selection, e -> warehouseManager.setChanged());
/////////////////////
// Start Suspend Warehouse Group
/////////////////////
wSuspendGroup = new Group(shell, SWT.SHADOW_ETCHED_IN);
wSuspendGroup.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Group.SuspendWarehouse.Label"));
FormLayout suspendWarehouseLayout = new FormLayout();
suspendWarehouseLayout.marginWidth = 3;
suspendWarehouseLayout.marginHeight = 3;
wSuspendGroup.setLayout(suspendWarehouseLayout);
PropsUi.setLook(wSuspendGroup);
FormData fdgSuspendGroup = new FormData();
fdgSuspendGroup.left = new FormAttachment(0, 0);
fdgSuspendGroup.right = new FormAttachment(100, 0);
fdgSuspendGroup.top = new FormAttachment(wAction, margin * 2);
wSuspendGroup.setLayoutData(fdgSuspendGroup);
// //////////////////////
// Fail if Not exists line
// /////////////////////
Label wlSuspendFailIfNotExists = new Label(wSuspendGroup, SWT.RIGHT);
wlSuspendFailIfNotExists.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Suspend.FailIfNotExists.Label"));
PropsUi.setLook(wlSuspendFailIfNotExists);
FormData fdlSuspendFailIfNotExists = new FormData();
fdlSuspendFailIfNotExists.left = new FormAttachment(0, 0);
fdlSuspendFailIfNotExists.top = new FormAttachment(0, margin);
fdlSuspendFailIfNotExists.right = new FormAttachment(middle, -margin);
wlSuspendFailIfNotExists.setLayoutData(fdlSuspendFailIfNotExists);
wSuspendFailIfNotExists = new Button(wSuspendGroup, SWT.CHECK);
PropsUi.setLook(wSuspendFailIfNotExists);
FormData fdSuspendFailIfNotExists = new FormData();
fdSuspendFailIfNotExists.left = new FormAttachment(middle, 0);
fdSuspendFailIfNotExists.top = new FormAttachment(0, margin);
fdSuspendFailIfNotExists.right = new FormAttachment(100, 0);
wSuspendFailIfNotExists.setLayoutData(fdSuspendFailIfNotExists);
wSuspendFailIfNotExists.addListener(SWT.Selection, e -> warehouseManager.setChanged());
/////////////////////
// Start Alter Warehouse Group
/////////////////////
wAlterGroup = new Group(shell, SWT.SHADOW_ETCHED_IN);
wAlterGroup.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Group.AlterWarehouse.Label"));
FormLayout alterWarehouseLayout = new FormLayout();
alterWarehouseLayout.marginWidth = 3;
alterWarehouseLayout.marginHeight = 3;
wAlterGroup.setLayout(alterWarehouseLayout);
PropsUi.setLook(wAlterGroup);
FormData fdgAlterGroup = new FormData();
fdgAlterGroup.left = new FormAttachment(0, 0);
fdgAlterGroup.right = new FormAttachment(100, 0);
fdgAlterGroup.top = new FormAttachment(wAction, margin * 2);
wAlterGroup.setLayoutData(fdgAlterGroup);
// //////////////////////
// Fail if Not exists line
// /////////////////////
Label wlAlterFailIfNotExists = new Label(wAlterGroup, SWT.RIGHT);
wlAlterFailIfNotExists.setText(
BaseMessages.getString(
PKG, "SnowflakeWarehouseManager.Dialog.Alter.FailIfNotExists.Label"));
PropsUi.setLook(wlAlterFailIfNotExists);
FormData fdlAlterFailIfNotExists = new FormData();
fdlAlterFailIfNotExists.left = new FormAttachment(0, 0);
fdlAlterFailIfNotExists.top = new FormAttachment(0, margin);
fdlAlterFailIfNotExists.right = new FormAttachment(middle, -margin);
wlAlterFailIfNotExists.setLayoutData(fdlAlterFailIfNotExists);
wAlterFailIfNotExists = new Button(wAlterGroup, SWT.CHECK);
PropsUi.setLook(wAlterFailIfNotExists);
FormData fdAlterFailIfNotExists = new FormData();
fdAlterFailIfNotExists.left = new FormAttachment(middle, 0);
fdAlterFailIfNotExists.top = new FormAttachment(0, margin);
fdAlterFailIfNotExists.right = new FormAttachment(100, 0);
wAlterFailIfNotExists.setLayoutData(fdAlterFailIfNotExists);
wAlterFailIfNotExists.addListener(SWT.Selection, e -> warehouseManager.setChanged());
// Warehouse Size
//
Label wlAlterWarehouseSize = new Label(wAlterGroup, SWT.RIGHT);
wlAlterWarehouseSize.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.AlterWarehouseSize.Label"));
PropsUi.setLook(wlAlterWarehouseSize);
FormData fdlAlterWarehouseSize = new FormData();
fdlAlterWarehouseSize.left = new FormAttachment(0, 0);
fdlAlterWarehouseSize.top = new FormAttachment(wAlterFailIfNotExists, margin);
fdlAlterWarehouseSize.right = new FormAttachment(middle, -margin);
wlAlterWarehouseSize.setLayoutData(fdlAlterWarehouseSize);
wAlterWarehouseSize = new ComboVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterWarehouseSize);
wAlterWarehouseSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterWarehouseSize = new FormData();
fdAlterWarehouseSize.left = new FormAttachment(middle, 0);
fdAlterWarehouseSize.top = new FormAttachment(wAlterFailIfNotExists, margin);
fdAlterWarehouseSize.right = new FormAttachment(100, 0);
wAlterWarehouseSize.setLayoutData(fdAlterWarehouseSize);
wAlterWarehouseSize.setItems(WAREHOUSE_SIZE_DESCS);
// Warehouse Type
//
Label wlAlterWarehouseType = new Label(wAlterGroup, SWT.RIGHT);
wlAlterWarehouseType.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.AlterWarehouseType.Label"));
PropsUi.setLook(wlAlterWarehouseType);
FormData fdlAlterWarehouseType = new FormData();
fdlAlterWarehouseType.left = new FormAttachment(0, 0);
fdlAlterWarehouseType.top = new FormAttachment(wAlterWarehouseSize, margin);
fdlAlterWarehouseType.right = new FormAttachment(middle, -margin);
wlAlterWarehouseType.setLayoutData(fdlAlterWarehouseType);
wAlterWarehouseType = new ComboVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterWarehouseType);
wAlterWarehouseType.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterWarehouseType = new FormData();
fdAlterWarehouseType.left = new FormAttachment(middle, 0);
fdAlterWarehouseType.top = new FormAttachment(wAlterWarehouseSize, margin);
fdAlterWarehouseType.right = new FormAttachment(100, 0);
wAlterWarehouseType.setLayoutData(fdAlterWarehouseType);
wAlterWarehouseType.setItems(WAREHOUSE_TYPE_DESCS);
// /////////////////////
// Max Cluster Size
// /////////////////////
Label wlAlterMaxClusterSize = new Label(wAlterGroup, SWT.RIGHT);
wlAlterMaxClusterSize.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.MaxClusterSize.Label"));
PropsUi.setLook(wlAlterMaxClusterSize);
FormData fdlAlterMaxClusterSize = new FormData();
fdlAlterMaxClusterSize.left = new FormAttachment(0, 0);
fdlAlterMaxClusterSize.top = new FormAttachment(wAlterWarehouseType, margin);
fdlAlterMaxClusterSize.right = new FormAttachment(middle, -margin);
wlAlterMaxClusterSize.setLayoutData(fdlAlterMaxClusterSize);
wAlterMaxClusterSize = new TextVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterGroup);
wAlterMaxClusterSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterMaxClusterSize = new FormData();
fdAlterMaxClusterSize.left = new FormAttachment(middle, 0);
fdAlterMaxClusterSize.right = new FormAttachment(100, 0);
fdAlterMaxClusterSize.top = new FormAttachment(wAlterWarehouseType, margin);
wAlterMaxClusterSize.setLayoutData(fdAlterMaxClusterSize);
// /////////////////////
// Min Cluster Size
// /////////////////////
Label wlAlterMinClusterSize = new Label(wAlterGroup, SWT.RIGHT);
wlAlterMinClusterSize.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.MinClusterSize.Label"));
PropsUi.setLook(wlAlterMinClusterSize);
FormData fdlAlterMinClusterSize = new FormData();
fdlAlterMinClusterSize.left = new FormAttachment(0, 0);
fdlAlterMinClusterSize.top = new FormAttachment(wAlterMaxClusterSize, margin);
fdlAlterMinClusterSize.right = new FormAttachment(middle, -margin);
wlAlterMinClusterSize.setLayoutData(fdlAlterMinClusterSize);
wAlterMinClusterSize = new TextVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterGroup);
wAlterMinClusterSize.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterMinClusterSize = new FormData();
fdAlterMinClusterSize.left = new FormAttachment(middle, 0);
fdAlterMinClusterSize.right = new FormAttachment(100, 0);
fdAlterMinClusterSize.top = new FormAttachment(wAlterMaxClusterSize, margin);
wAlterMinClusterSize.setLayoutData(fdAlterMinClusterSize);
// /////////////////////
// Auto Suspend Size
// /////////////////////
Label wlAlterAutoSuspend = new Label(wAlterGroup, SWT.RIGHT);
wlAlterAutoSuspend.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.AutoSuspend.Label"));
wlAlterAutoSuspend.setToolTipText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.AutoSuspend.Tooltip"));
PropsUi.setLook(wlAlterAutoSuspend);
FormData fdlAlterAutoSuspend = new FormData();
fdlAlterAutoSuspend.left = new FormAttachment(0, 0);
fdlAlterAutoSuspend.top = new FormAttachment(wAlterMinClusterSize, margin);
fdlAlterAutoSuspend.right = new FormAttachment(middle, -margin);
wlAlterAutoSuspend.setLayoutData(fdlAlterAutoSuspend);
wAlterAutoSuspend = new TextVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterGroup);
wAlterAutoSuspend.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterAutoSuspend = new FormData();
fdAlterAutoSuspend.left = new FormAttachment(middle, 0);
fdAlterAutoSuspend.right = new FormAttachment(100, 0);
fdAlterAutoSuspend.top = new FormAttachment(wAlterMinClusterSize, margin);
wAlterAutoSuspend.setLayoutData(fdAlterAutoSuspend);
// /////////////////////
// Auto-resume
// /////////////////////
Label wlAlterAutoResume = new Label(wAlterGroup, SWT.RIGHT);
wlAlterAutoResume.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.AutoResume.Label"));
PropsUi.setLook(wlAlterAutoResume);
FormData fdlAlterAutoResume = new FormData();
fdlAlterAutoResume.left = new FormAttachment(0, 0);
fdlAlterAutoResume.top = new FormAttachment(wAlterAutoSuspend, margin);
fdlAlterAutoResume.right = new FormAttachment(middle, -margin);
wlAlterAutoResume.setLayoutData(fdlAlterAutoResume);
wAlterAutoResume = new Button(wAlterGroup, SWT.CHECK);
PropsUi.setLook(wAlterAutoResume);
FormData fdAlterAutoResume = new FormData();
fdAlterAutoResume.left = new FormAttachment(middle, 0);
fdAlterAutoResume.top = new FormAttachment(wAlterAutoSuspend, margin);
fdAlterAutoResume.right = new FormAttachment(100, 0);
wAlterAutoResume.setLayoutData(fdAlterAutoResume);
wAlterAutoResume.addListener(SWT.Selection, e -> warehouseManager.setChanged());
// Resource monitor line
//
Label wlAlterResourceMonitor = new Label(wAlterGroup, SWT.RIGHT);
wlAlterResourceMonitor.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.ResourceMonitor.Label"));
PropsUi.setLook(wlAlterResourceMonitor);
FormData fdlAlterResourceMonitor = new FormData();
fdlAlterResourceMonitor.left = new FormAttachment(0, 0);
fdlAlterResourceMonitor.top = new FormAttachment(wAlterAutoResume, margin);
fdlAlterResourceMonitor.right = new FormAttachment(middle, -margin);
wlAlterResourceMonitor.setLayoutData(fdlAlterResourceMonitor);
wAlterResourceMonitor =
new ComboVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterResourceMonitor);
wAlterResourceMonitor.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterResourceMonitor = new FormData();
fdAlterResourceMonitor.left = new FormAttachment(middle, 0);
fdAlterResourceMonitor.top = new FormAttachment(wAlterAutoResume, margin);
fdAlterResourceMonitor.right = new FormAttachment(100, 0);
wAlterResourceMonitor.setLayoutData(fdAlterResourceMonitor);
wAlterResourceMonitor.addFocusListener(
new FocusAdapter() {
/**
* Get the list of stages for the schema, and populate the stage name drop down.
*
* @param focusEvent The event
*/
@Override
public void focusGained(FocusEvent focusEvent) {
getResourceMonitors();
}
});
// /////////////////////
// Comment Line
// /////////////////////
Label wlAlterComment = new Label(wAlterGroup, SWT.RIGHT);
wlAlterComment.setText(
BaseMessages.getString(PKG, "SnowflakeWarehouseManager.Dialog.Alter.Comment.Label"));
PropsUi.setLook(wlAlterComment);
FormData fdlAlterComment = new FormData();
fdlAlterComment.left = new FormAttachment(0, 0);
fdlAlterComment.top = new FormAttachment(wAlterResourceMonitor, margin);
fdlAlterComment.right = new FormAttachment(middle, -margin);
wlAlterComment.setLayoutData(fdlAlterComment);
wAlterComment = new TextVar(variables, wAlterGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
PropsUi.setLook(wAlterGroup);
wAlterComment.addListener(SWT.Modify, e -> warehouseManager.setChanged());
FormData fdAlterComment = new FormData();
fdAlterComment.left = new FormAttachment(middle, 0);
fdAlterComment.right = new FormAttachment(100, 0);
fdAlterComment.top = new FormAttachment(wAlterResourceMonitor, margin);
wAlterComment.setLayoutData(fdAlterComment);
// Some buttons
Button wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
Button wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseTransformDialog.positionBottomButtons(
shell, new Button[] {wOK, wCancel}, margin, wCreateGroup);
// Add listeners
Listener lsCancel = e -> cancel();
Listener lsOK = e -> ok();
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
wName.addListener(SWT.Modify, e -> warehouseManager.setChanged());
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(
new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
setFlags();
BaseTransformDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "WarehouseManagerSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return warehouseManager;
}