use of com.cubrid.common.ui.cubrid.table.control.CreatePartitionWizard in project cubrid-manager by CUBRID.
the class TableEditorPart method createPartitionTabButtons.
/**
* Create Partition tab buttons
*
* @param parent Composite
*/
private void createPartitionTabButtons(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
{
GridLayout gl = new GridLayout();
gl.numColumns = 5;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
}
addPartitionBtn = new Button(composite, SWT.PUSH);
{
GridData gd = new GridData(SWT.NONE);
gd.horizontalIndent = 10;
addPartitionBtn.setLayoutData(gd);
}
addPartitionBtn.setText(Messages.btnAddPartition);
addPartitionBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String tableName = tableNameText.getText();
if (tableName.trim().length() == 0) {
CommonUITool.openErrorBox(getSite().getShell(), Messages.msgNoTableName);
return;
}
newSchemaInfo.setClassname(tableName);
Wizard wizard = new CreatePartitionWizard(database.getDatabaseInfo(), newSchemaInfo, partitionInfoList, isNewTableFlag, null);
CMWizardDialog dialog = new CMWizardDialog(getSite().getShell(), wizard);
dialog.setPageSize(600, 400);
if (dialog.open() != IDialogConstants.OK_ID) {
return;
}
partitionTableView.refresh();
changePartitionTabButtonStatus();
}
});
editPartitionBtn = new Button(composite, SWT.PUSH);
{
GridData gd = new GridData(SWT.NONE);
gd.horizontalIndent = 10;
editPartitionBtn.setLayoutData(gd);
}
editPartitionBtn.setText(Messages.btnEditPartition);
editPartitionBtn.setEnabled(false);
editPartitionBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editPartition();
}
});
delPartitionBtn = new Button(composite, SWT.PUSH);
{
GridData gd = new GridData(SWT.NONE);
gd.horizontalIndent = 10;
delPartitionBtn.setLayoutData(gd);
}
delPartitionBtn.setText(Messages.btnDelPartition);
delPartitionBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
String confirmMsg = Messages.msgDelPartition;
if (getPartitonType() == PartitionType.HASH) {
confirmMsg = Messages.msgDelHashPartition;
}
boolean deleteConfirm = CommonUITool.openConfirmBox(getSite().getShell(), confirmMsg);
if (!deleteConfirm) {
return;
}
if (getPartitonType() == PartitionType.HASH) {
partitionInfoList.clear();
} else {
IStructuredSelection selection = (IStructuredSelection) partitionTableView.getSelection();
if (selection == null || selection.isEmpty()) {
return;
}
partitionInfoList.removeAll(selection.toList());
if (getPartitonType() == PartitionType.RANGE) {
CreatePartitionWizard.resetRangePartitionInfoList(partitionInfoList);
}
}
partitionTableView.refresh();
changePartitionTabButtonStatus();
}
});
final Table partitionTable = partitionTableView.getTable();
partitionTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
changePartitionTabButtonStatus();
}
});
changePartitionTabButtonStatus();
}
use of com.cubrid.common.ui.cubrid.table.control.CreatePartitionWizard in project cubrid-manager by CUBRID.
the class TableEditorPart method editPartition.
/**
* Show the edit dialog for selected partition.
*/
private void editPartition() {
if (WidgetUtil.disposed(partitionTableView)) {
return;
}
PartitionInfo partitionInfo = null;
if (getPartitonType() == PartitionType.HASH) {
partitionInfo = partitionInfoList.get(0);
} else {
IStructuredSelection selection = (IStructuredSelection) partitionTableView.getSelection();
if (selection == null || selection.isEmpty()) {
return;
}
partitionInfo = (PartitionInfo) selection.getFirstElement();
}
String tableName = tableNameText.getText();
if (WidgetUtil.disposed(tableNameText) || StringUtil.isEmpty(tableName)) {
CommonUITool.openErrorBox(getSite().getShell(), Messages.msgNoTableName);
return;
}
newSchemaInfo.setClassname(tableName);
CreatePartitionWizard wizard = new CreatePartitionWizard(database.getDatabaseInfo(), newSchemaInfo, partitionInfoList, isNewTableFlag, partitionInfo);
CMWizardDialog dialog = new CMWizardDialog(getSite().getShell(), wizard);
dialog.setPageSize(600, 400);
if (dialog.open() != IDialogConstants.OK_ID) {
return;
}
newSchemaInfo.setPartitionList(partitionInfoList);
partitionTableView.refresh();
changePartitionTabButtonStatus();
}
Aggregations