use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class EditVirtualTableDialog method createGeneralTabItem.
/**
* Create general tab item
*
* @param tabFolder the object of TabFolder
*/
private void createGeneralTabItem(final TabFolder tabFolder) {
final TabItem generalTabItem = new TabItem(tabFolder, SWT.NONE);
generalTabItem.setText(Messages.infoGeneralTab);
final Composite compositeGenaral = new Composite(tabFolder, SWT.NONE);
GridLayout gridLayout = new GridLayout();
compositeGenaral.setLayout(gridLayout);
generalTabItem.setControl(compositeGenaral);
createTableInformationGroup(compositeGenaral);
if (database == null) {
return;
}
final Label columnsLabel = new Label(compositeGenaral, SWT.NONE);
columnsLabel.setText(Messages.lblColumn);
// create attribute table
columnTableView = new TableViewer(compositeGenaral, SWT.FULL_SELECTION | SWT.BORDER);
columnTableView.setUseHashlookup(true);
columnTableView.setColumnProperties(columnProperites);
columnsTable = columnTableView.getTable();
final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
gdColumnsTable.heightHint = 189;
columnsTable.setLayoutData(gdColumnsTable);
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
// The empty column
final TableColumn emptyColumn = new TableColumn(columnsTable, SWT.NONE);
emptyColumn.setWidth(0);
// The flag column
final TableColumn flagColumn = new TableColumn(columnsTable, SWT.RIGHT_TO_LEFT);
flagColumn.setWidth(28);
// NAME
final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
nameColumn.setWidth(140);
nameColumn.setText(Messages.tblColumnName);
// DATATYPE
final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
dataTypeColumn.setWidth(120);
dataTypeColumn.setText(Messages.tblColumnDataType);
// DEFAULT
final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
defaultColumn.setWidth(98);
defaultColumn.setText(Messages.tblColumnDefault);
defaultColumn.setToolTipText(Messages.tblColumnDefaultHint);
// AUTO INCREMENT
final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
autoIncrTableColumn.setAlignment(SWT.LEFT);
autoIncrTableColumn.setWidth(100);
autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
autoIncrTableColumn.setToolTipText(Messages.tblColumnAutoIncrHint);
// NOT NULL
final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
notNullColumn.setWidth(60);
notNullColumn.setText(Messages.tblColumnNotNull);
notNullColumn.setAlignment(SWT.LEFT);
notNullColumn.setToolTipText(Messages.tblColumnNotNullHint);
// PK
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.CENTER);
pkColumn.setWidth(75);
pkColumn.setText(Messages.tblColumnPK);
// UK
final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
uniqueColumn.setWidth(55);
uniqueColumn.setText(Messages.tblColumnUnique);
uniqueColumn.setAlignment(SWT.LEFT);
uniqueColumn.setToolTipText(Messages.tblColumnUniqueHint);
// SHARED
sharedColumn = new TableColumn(columnsTable, SWT.NONE);
sharedColumn.setWidth(50);
sharedColumn.setResizable(false);
sharedColumn.setText(Messages.tblColumnShared);
sharedColumn.setAlignment(SWT.LEFT);
sharedColumn.setToolTipText(Messages.tblColumnSharedHint);
if (supportCharset) {
final TableColumn collationColumn = new TableColumn(columnsTable, SWT.NONE);
collationColumn.setWidth(120);
collationColumn.setText(Messages.tblColumnColumnCollation);
collationColumn.setAlignment(SWT.LEFT);
}
if (erSchema.isPhysicModel()) {
final TableColumn descColumn = new TableColumn(columnsTable, SWT.NONE);
descColumn.setWidth(180);
descColumn.setText(Messages.tblColumnColumnDesc);
descColumn.setAlignment(SWT.LEFT);
}
boolean canEdit = true;
if (!this.isNewTableFlag() && !this.isSupportChange()) {
canEdit = false;
}
attrContentProvider = new AttributeContentProvider();
attrLabelProvider = new ERAttributeLabelProvider(database.getDatabaseInfo(), getNewSchemaInfo(), canEdit, editorAdaptor, erSchema.isPhysicModel());
columnTableView.setContentProvider(attrContentProvider);
columnTableView.setLabelProvider(attrLabelProvider);
CellEditor[] cellEditor = new CellEditor[columnProperites.length];
{
int index = 0;
// Empty
cellEditor[index++] = null;
// Flag
cellEditor[index++] = null;
// NAME
cellEditor[index++] = new TextCellEditor(columnsTable);
// DATATYPE
cellEditor[index++] = new DataTypeCellEditor((Composite) columnsTable, listDataTypes(), editorAdaptor);
// DEFAULT
cellEditor[index++] = new TextCellEditor(columnsTable);
// AUTO INCREMENT
cellEditor[index++] = new AutoIncrementCellEditor(columnsTable, editorAdaptor);
// NOT NULL
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// PK
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// UK
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// SHARD
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// COLLATION
if (supportCharset) {
cellEditor[index++] = new ComboBoxCellEditor(columnsTable, getCollationArray(), SWT.READ_ONLY);
}
// MEMO
cellEditor[index++] = erSchema.isPhysicModel() ? new TextCellEditor(columnsTable) : null;
}
columnTableView.setCellEditors(cellEditor);
ERAttributeCellModifier modifier = new ERAttributeCellModifier(editorAdaptor, erSchema.isPhysicModel());
columnTableView.setCellModifier(modifier);
loadColumnData();
// Create button
final Composite btnRowComposite = new Composite(compositeGenaral, SWT.NONE);
btnRowComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
{
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 5;
btnRowComposite.setLayout(layout);
}
final Composite optComposite = new Composite(btnRowComposite, SWT.NONE);
optComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
{
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 0;
optComposite.setLayout(layout);
}
final Composite btnComposite = new Composite(btnRowComposite, SWT.NONE);
btnComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
{
GridLayout layout = new GridLayout();
layout.marginRight = 0;
layout.numColumns = 6;
layout.marginWidth = 0;
btnComposite.setLayout(layout);
}
final Button setPkButton = new Button(btnComposite, SWT.NONE);
setPkButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
setPkButton.setText(Messages.btnPK);
setPkButton.addSelectionListener(new PkBtnListenerOnGeneTab(isNewTableFlag));
final GridData gdUpDown = new GridData(60, SWT.DEFAULT);
upColumnBtn = new Button(btnComposite, SWT.NONE);
upColumnBtn.setLayoutData(gdUpDown);
upColumnBtn.setEnabled(false);
upColumnBtn.setText(Messages.btnUp);
upColumnBtn.addSelectionListener(new UpBtnListenerOnGeneTab());
downColumnBtn = new Button(btnComposite, SWT.DOWN);
downColumnBtn.setLayoutData(gdUpDown);
downColumnBtn.setEnabled(false);
downColumnBtn.setText(Messages.btnDown);
downColumnBtn.addSelectionListener(new DownBtnListenerOnGeneTab());
final Button addButton = new Button(btnComposite, SWT.NONE);
final GridData gdAddButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdAddButton.horizontalIndent = 10;
addButton.setLayoutData(gdAddButton);
addButton.setText(Messages.btnAddColumn);
addButton.addSelectionListener(new AddBtnListenerOnGeneTab());
deleteColumnBtn = new Button(btnComposite, SWT.NONE);
final GridData gdDeleteButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdDeleteButton.horizontalIndent = 10;
deleteColumnBtn.setLayoutData(gdDeleteButton);
deleteColumnBtn.setEnabled(false);
deleteColumnBtn.setText(Messages.btnDelColumn);
deleteColumnBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
deleteColumn();
}
});
columnsTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleSelectionChangeInColumnTable();
}
});
buildColumnTableMenu();
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class BrokerParameterDialog method createDialogArea.
/**
* Create the dialog area content
*
* @param parent the parent composite
* @return the composite
*/
protected Control createDialogArea(Composite parent) {
Composite parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
composite.setLayout(layout);
GridData gdComposite = new GridData(SWT.FILL, SWT.FILL, true, true);
gdComposite.heightHint = 440;
composite.setLayoutData(gdComposite);
Composite nameComp = new Composite(composite, SWT.NONE);
nameComp.setLayout(new GridLayout(2, false));
nameComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
final Label brokerNameLabel = new Label(nameComp, SWT.NONE);
brokerNameLabel.setText(Messages.brokerNameLbl);
nameTxt = new Text(nameComp, SWT.BORDER);
final GridData gdNameTxt = new GridData(SWT.FILL, SWT.CENTER, true, false);
nameTxt.setLayoutData(gdNameTxt);
TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
final GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
tabFolder.setLayoutData(gdTabFolder);
tabFolder.setLayout(new GridLayout());
TabItem item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.paraParameterNameOfTap);
item.setControl(createParamComp(tabFolder));
item = new TabItem(tabFolder, SWT.NONE);
item.setText(Messages.paraRefreshNameOfTap);
item.setControl(createRefreshComp(tabFolder));
initialize();
if (operation == AddEditType.ADD) {
setTitle(Messages.addTitle);
setMessage(Messages.addMsg);
nameTxt.setEnabled(true);
getShell().setText(Messages.shellAddTitle);
brokerMap = new HashMap<String, String>();
isOkenable[0] = false;
isOkenable[1] = false;
isOkenable[2] = false;
} else {
editTitle = Messages.bind(Messages.editTitle, brokerMap.get("0"));
editMsg = Messages.bind(Messages.editMsg, brokerMap.get("0"));
setTitle(editTitle);
setMessage(editMsg);
getShell().setText(Messages.shellEditTitle);
nameTxt.setEnabled(false);
isOkenable[0] = true;
isOkenable[1] = true;
isOkenable[2] = true;
}
nameTxt.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
String content = ((Text) event.widget).getText().trim();
if (content.length() == 0) {
isOkenable[0] = false;
} else if (content.equalsIgnoreCase("broker")) {
setErrorMessage(Messages.errBrokerName);
isOkenable[0] = false;
} else {
boolean hasName = false;
if (brokerLst != null) {
for (Map<String, String> brokerInfo : brokerLst) {
if (content.equalsIgnoreCase(brokerInfo.get("0"))) {
hasName = true;
break;
}
}
}
if (hasName) {
isOkenable[0] = false;
setErrorMessage(Messages.errReduplicateName);
} else {
isOkenable[0] = true;
setErrorMessage(null);
}
}
enableOk();
}
});
return parentComp;
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class CreateViewDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
parentComp = (Composite) super.createDialogArea(parent);
Composite composite = new Composite(parentComp, SWT.NONE);
{
final GridData gdComposite = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(gdComposite);
GridLayout layout = new GridLayout();
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.numColumns = 1;
composite.setLayout(layout);
}
tabFolder = new TabFolder(composite, SWT.NONE);
final GridData gdTabFolder = new GridData(SWT.FILL, SWT.FILL, true, true);
tabFolder.setLayoutData(gdTabFolder);
final TabItem generalTabItem = new TabItem(tabFolder, SWT.NONE);
generalTabItem.setText(Messages.tabItemGeneral);
final Composite compositeGenaral = createGeneralComposite();
generalTabItem.setControl(compositeGenaral);
final TabItem ddlTabItem = new TabItem(tabFolder, SWT.NONE);
ddlTabItem.setText(Messages.tabItemSQLScript);
final Composite sqlScriptComp = createSQLScriptComposite();
ddlTabItem.setControl(sqlScriptComp);
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean isFirstTab = tabFolder.getSelectionIndex() == 0;
boolean isLastTab = tabFolder.getSelectionIndex() == tabFolder.getItemCount() - 1;
if (isFirstTab) {
tableText.setFocus();
} else if (isLastTab) {
StringBuilder sb = new StringBuilder();
String dropSql = makeDropSQLScript();
if (dropSql.length() > 0) {
sb.append(dropSql);
sb.append(StringUtil.NEWLINE);
sb.append(StringUtil.NEWLINE);
sb.append(StringUtil.NEWLINE);
}
sb.append(makeCreateSQLScript());
String ownerNew = ownerCombo.getText();
String ownerOld = null;
if (isNewTableFlag) {
DatabaseInfo dbInfo = database.getDatabaseInfo();
ownerOld = dbInfo.getAuthLoginedDbUserInfo().getName();
} else {
ownerOld = classInfo.getOwnerName();
}
boolean isSameUser = StringUtil.isEqualIgnoreCase(ownerOld, ownerNew);
if (!isSameUser) {
sb.append(";");
sb.append(StringUtil.NEWLINE);
sb.append(StringUtil.NEWLINE);
sb.append(StringUtil.NEWLINE);
sb.append(makeChangeOwnerSQLScript()).append(";");
sb.append(StringUtil.NEWLINE);
}
sqlText.setText(formatSql(sb.toString()));
}
}
});
init();
tableText.setFocus();
return parent;
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class TableEditorPart method createGeneralTabItem.
/**
* Create general tab item
*
* @param tabFolder the object of TabFolder
*/
private void createGeneralTabItem(final TabFolder tabFolder) {
final TabItem generalTabItem = new TabItem(tabFolder, SWT.NONE);
generalTabItem.setText(Messages.infoGeneralTab);
final Composite compositeGenaral = new Composite(tabFolder, SWT.NONE);
GridLayout gridLayout = new GridLayout();
compositeGenaral.setLayout(gridLayout);
generalTabItem.setControl(compositeGenaral);
final Group group = new Group(compositeGenaral, SWT.NONE);
group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
gridLayout = new GridLayout();
gridLayout.numColumns = 2;
group.setLayout(gridLayout);
group.setText(Messages.lblTableInfo);
final Label tableNameLabel = new Label(group, SWT.NONE);
tableNameLabel.setData(Messages.dataNewKey, null);
tableNameLabel.setText(Messages.lblTableName);
tableNameComp = new Composite(group, SWT.NONE);
{
GridLayout gl = new GridLayout();
gl.numColumns = 5;
gl.marginWidth = 0;
tableNameComp.setLayout(gl);
tableNameComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
tableNameText = new Text(tableNameComp, SWT.BORDER);
tableNameText.setTextLimit(ValidateUtil.MAX_SCHEMA_NAME_LENGTH);
{
GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gd.widthHint = 200;
tableNameText.setLayoutData(gd);
}
tableNameText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
if (tableNameText.getText().length() == 0) {
CommonUITool.hideErrorBaloon(errorBaloon);
} else if (verifyTableName()) {
String tableName = tableNameText.getText();
newSchemaInfo.setClassname(tableName);
}
}
});
tableNameText.addFocusListener(new FocusAdapter() {
public void focusLost(FocusEvent e) {
CommonUITool.hideErrorBaloon(errorBaloon);
}
});
final Label ownerLabel = new Label(tableNameComp, SWT.NONE);
ownerLabel.setText(Messages.lblOwner);
ownerCombo = new Combo(tableNameComp, SWT.READ_ONLY);
{
GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gd.widthHint = 100;
ownerCombo.setLayoutData(gd);
}
ownerCombo.setVisibleItemCount(10);
fillOwnerCombo();
if (supportCharset) {
final Label collationLabel = new Label(tableNameComp, SWT.NONE);
collationLabel.setText(Messages.lblCollation);
collationCombo = new Combo(tableNameComp, SWT.READ_ONLY);
{
GridData gd = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gd.widthHint = 100;
collationCombo.setLayoutData(gd);
}
collationCombo.setVisibleItemCount(10);
fillCollationCombo();
String collation = collationCombo.getText();
newSchemaInfo.setCollation(collation);
collationCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
String collation = collationCombo.getText();
newSchemaInfo.setCollation(collation);
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
if (!isNewTableFlag && newSchemaInfo.getCollation() != null) {
collationCombo.setText(newSchemaInfo.getCollation());
}
} else {
new Label(tableNameComp, SWT.NONE);
new Label(tableNameComp, SWT.NONE);
}
}
final Label tableDescLabel = new Label(group, SWT.NONE);
tableDescLabel.setText(Messages.lblTableDesc);
tableDescText = new Text(group, SWT.BORDER);
tableDescText.setTextLimit(512);
tableDescText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
if (newSchemaInfo != null && newSchemaInfo.getDescription() != null) {
tableDescText.setText(newSchemaInfo.getDescription());
}
tableDescText.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
if (!isSupportTableComment) {
CommonUITool.showErrorBaloon(group, tableDescText, errorBaloon, "", Messages.errNotSupportTableCommentNotice);
tableDescText.setFocus();
}
}
public void focusLost(FocusEvent e) {
CommonUITool.hideErrorBaloon(errorBaloon);
}
});
tableDescText.setEditable(isSupportTableComment);
if (database == null) {
return;
}
if (CompatibleUtil.isSupportReuseOID(database.getDatabaseInfo())) {
reuseOIDBtn = new Button(group, SWT.CHECK);
reuseOIDBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
reuseOIDBtn.setText(Messages.btnReuseOid);
if (!isNewTableFlag) {
reuseOIDBtn.setEnabled(false);
}
}
final Label columnsLabel = new Label(compositeGenaral, SWT.NONE);
columnsLabel.setText(Messages.lblColumn);
// create attribute table
columnTableView = new TableViewer(compositeGenaral, SWT.FULL_SELECTION | SWT.BORDER);
columnTableView.setUseHashlookup(true);
columnTableView.setColumnProperties(columnProperites);
columnsTable = columnTableView.getTable();
//columnsTable.pack();
final GridData gdColumnsTable = new GridData(SWT.FILL, SWT.FILL, true, true);
gdColumnsTable.heightHint = 189;
columnsTable.setLayoutData(gdColumnsTable);
columnsTable.setLinesVisible(true);
columnsTable.setHeaderVisible(true);
// The empty column
final TableColumn emptyColumn = new TableColumn(columnsTable, SWT.NONE);
emptyColumn.setWidth(0);
// The flag column
final TableColumn flagColumn = new TableColumn(columnsTable, SWT.RIGHT_TO_LEFT);
flagColumn.setWidth(28);
// NAME
final TableColumn nameColumn = new TableColumn(columnsTable, SWT.NONE);
nameColumn.setWidth(140);
nameColumn.setText(Messages.tblColumnName);
// DATATYPE
final TableColumn dataTypeColumn = new TableColumn(columnsTable, SWT.NONE);
dataTypeColumn.setWidth(120);
dataTypeColumn.setText(Messages.tblColumnDataType);
// DEFAULT
final TableColumn defaultColumn = new TableColumn(columnsTable, SWT.NONE);
defaultColumn.setWidth(98);
defaultColumn.setText(Messages.tblColumnDefault);
defaultColumn.setToolTipText(Messages.tblColumnDefaultHint);
// AUTO INCREMENT
final TableColumn autoIncrTableColumn = new TableColumn(columnsTable, SWT.NONE);
autoIncrTableColumn.setAlignment(SWT.LEFT);
autoIncrTableColumn.setWidth(100);
autoIncrTableColumn.setText(Messages.tblColumnAutoIncr);
autoIncrTableColumn.setToolTipText(Messages.tblColumnAutoIncrHint);
// NOT NULL
final TableColumn notNullColumn = new TableColumn(columnsTable, SWT.NONE);
notNullColumn.setWidth(65);
notNullColumn.setText(Messages.tblColumnNotNull);
notNullColumn.setAlignment(SWT.LEFT);
notNullColumn.setToolTipText(Messages.tblColumnNotNullHint);
// PK
final TableColumn pkColumn = new TableColumn(columnsTable, SWT.NONE);
pkColumn.setAlignment(SWT.CENTER);
pkColumn.setWidth(90);
pkColumn.setText(Messages.tblColumnPK);
// UK
final TableColumn uniqueColumn = new TableColumn(columnsTable, SWT.NONE);
uniqueColumn.setWidth(55);
uniqueColumn.setText(Messages.tblColumnUnique);
uniqueColumn.setAlignment(SWT.LEFT);
uniqueColumn.setToolTipText(Messages.tblColumnUniqueHint);
// SHARED
sharedColumn = new TableColumn(columnsTable, SWT.NONE);
sharedColumn.setWidth(65);
sharedColumn.setText(Messages.tblColumnShared);
sharedColumn.setAlignment(SWT.LEFT);
sharedColumn.setToolTipText(Messages.tblColumnSharedHint);
if (supportCharset) {
final TableColumn collationColumn = new TableColumn(columnsTable, SWT.NONE);
collationColumn.setWidth(120);
collationColumn.setText(Messages.tblColumnColumnCollation);
collationColumn.setAlignment(SWT.LEFT);
}
final TableColumn descColumn = new TableColumn(columnsTable, SWT.NONE);
descColumn.setWidth(180);
descColumn.setText(Messages.tblColumnColumnDesc);
descColumn.setAlignment(SWT.LEFT);
boolean canEdit = true;
if (!editor.isNewTableFlag() && !editor.isSupportChange()) {
canEdit = false;
}
attrContentProvider = new AttributeContentProvider();
attrLabelProvider = new AttributeLabelProvider(database.getDatabaseInfo(), newSchemaInfo, canEdit, editorAdaptor);
columnTableView.setContentProvider(attrContentProvider);
columnTableView.setLabelProvider(attrLabelProvider);
CellEditor[] cellEditor = new CellEditor[columnProperites.length];
{
int index = 0;
// Empty
cellEditor[index++] = null;
// Flag
cellEditor[index++] = null;
// NAME
cellEditor[index++] = new TextCellEditor(columnsTable);
// DATATYPE
cellEditor[index++] = new DataTypeCellEditor((Composite) columnsTable, listDataTypes(), editorAdaptor);
// DEFAULT
cellEditor[index++] = new TextCellEditor(columnsTable);
// AUTO INCREMENT
cellEditor[index++] = new AutoIncrementCellEditor(columnsTable, editorAdaptor);
// NOT NULL
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// PK
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// UK
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// SHARD
cellEditor[index++] = new CheckboxCellEditor(columnsTable);
// COLLATION
if (supportCharset) {
cellEditor[index++] = new ComboBoxCellEditor(columnsTable, getCollationArray(), SWT.READ_ONLY);
}
// MEMO
cellEditor[index++] = new TextCellEditor(columnsTable);
}
columnTableView.setCellEditors(cellEditor);
columnTableView.setCellModifier(new AttributeCellModifier(editorAdaptor));
loadColumnData();
CommonUITool.hackForYosemite(columnsTable);
// Create button
final Composite btnRowComposite = new Composite(compositeGenaral, SWT.NONE);
btnRowComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
{
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 5;
btnRowComposite.setLayout(layout);
}
final Composite optComposite = new Composite(btnRowComposite, SWT.NONE);
optComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
{
GridLayout layout = new GridLayout();
layout.numColumns = 1;
layout.marginWidth = 0;
optComposite.setLayout(layout);
}
final Composite btnComposite = new Composite(btnRowComposite, SWT.NONE);
btnComposite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
{
GridLayout layout = new GridLayout();
layout.marginRight = 0;
layout.numColumns = 6;
layout.marginWidth = 0;
btnComposite.setLayout(layout);
}
final Button setPkButton = new Button(btnComposite, SWT.NONE);
setPkButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
setPkButton.setText(Messages.btnPK);
setPkButton.addSelectionListener(new PkBtnListenerOnGeneTab(isNewTableFlag));
final GridData gdUpDown = new GridData(60, SWT.DEFAULT);
upColumnBtn = new Button(btnComposite, SWT.NONE);
upColumnBtn.setLayoutData(gdUpDown);
upColumnBtn.setEnabled(false);
upColumnBtn.setText(Messages.btnUp);
upColumnBtn.addSelectionListener(new UpBtnListenerOnGeneTab());
downColumnBtn = new Button(btnComposite, SWT.DOWN);
downColumnBtn.setLayoutData(gdUpDown);
downColumnBtn.setEnabled(false);
downColumnBtn.setText(Messages.btnDown);
downColumnBtn.addSelectionListener(new DownBtnListenerOnGeneTab());
final Button addButton = new Button(btnComposite, SWT.NONE);
final GridData gdAddButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdAddButton.horizontalIndent = 10;
addButton.setLayoutData(gdAddButton);
addButton.setText(Messages.btnAddColumn);
addButton.addSelectionListener(new AddBtnListenerOnGeneTab());
deleteColumnBtn = new Button(btnComposite, SWT.NONE);
final GridData gdDeleteButton = new GridData(SWT.LEFT, SWT.CENTER, false, false);
gdDeleteButton.horizontalIndent = 10;
deleteColumnBtn.setLayoutData(gdDeleteButton);
deleteColumnBtn.setEnabled(false);
deleteColumnBtn.setText(Messages.btnDelColumn);
deleteColumnBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
deleteColumn();
}
});
columnsTable.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
handleSelectionChangeInColumnTable();
}
});
buildColumnTableMenu();
}
use of org.eclipse.swt.widgets.TabItem in project cubrid-manager by CUBRID.
the class TableEditorPart method createPartitionTabItem.
private void createPartitionTabItem(final TabFolder tabFolder) {
loadPartitionInfoList();
final TabItem partTabItem = new TabItem(tabFolder, SWT.NONE);
final Composite parentComp = new Composite(tabFolder, SWT.NONE);
{
GridLayout gd = new GridLayout();
parentComp.setLayout(gd);
}
partTabItem.setControl(parentComp);
partTabItem.setText(Messages.tabItemPartition);
partitionTableView = new TableViewer(parentComp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
final Table partitionTable = partitionTableView.getTable();
{
partitionTable.setLayout(TableViewUtil.createTableViewLayout(new int[] { 20, 15, 10, 20, 25, 10 }));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.heightHint = 350;
partitionTable.setLayoutData(gd);
}
partitionTable.setHeaderVisible(true);
partitionTable.setLinesVisible(true);
CommonUITool.hackForYosemite(partitionTable);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColTableName);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColPartitionName);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColType);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColExpr);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColExprValue);
TableViewUtil.createTableColumn(partitionTable, SWT.CENTER, Messages.tblColRows);
partitionTableView.setLabelProvider(new PartitionTableLabelProvider());
partitionTableView.setContentProvider(new PartitionContentProvider());
partitionTableView.setInput(partitionInfoList);
partitionTableView.addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
editPartition();
}
});
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
if (tabFolder.getSelection()[0].getText().equals(Messages.tabItemPartition)) {
partitionTableView.refresh();
}
}
});
createPartitionTabButtons(parentComp);
}
Aggregations