use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class ShardConnectionPanel method build.
public void build(Composite parent) {
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
parent.setLayout(layout);
Label connectionFileNameLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
connectionFileNameLabel.setText(Messages.shardConnnectionFileName);
gridData = new GridData();
gridData.widthHint = 200;
gridData.horizontalSpan = 2;
connectionFileNameLabel.setLayoutData(gridData);
connectionFileNameText = new Text(parent, SWT.BORDER);
connectionFileNameText.setTextLimit(32);
gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
connectionFileNameText.setLayoutData(gridData);
connectionFileNameText.setEnabled(false);
topLeftToolBar = new ToolBar(parent, SWT.FLAT);
insertRecordItem = new ToolItem(topLeftToolBar, SWT.PUSH);
insertRecordItem.setToolTipText(Messages.addConnection);
insertRecordItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
insertRecordItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
insertRecordItem.setEnabled(true);
delRecordItem = new ToolItem(topLeftToolBar, SWT.PUSH);
delRecordItem.setToolTipText(Messages.deleteConnection);
delRecordItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
delRecordItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
delRecordItem.setEnabled(false);
columnNameArrs = new String[] { Messages.tblShardId, Messages.tblDBName, Messages.tblConInfo };
int[] columnwidthArr = new int[] { 100, 180, 300 };
connectionTableViewer = CommonUITool.createCommonTableViewer(parent, null, columnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 4, 1, -1, 320));
connectionTable = connectionTableViewer.getTable();
load();
initial();
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class ShardKeysPanel method buildKeyList.
private void buildKeyList(Composite parent) {
Group keyListGroup = new Group(parent, SWT.NONE);
keyListGroup.setText(Messages.shardKeyList);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 1;
keyListGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
keyListGroup.setLayout(layout);
keyListToolBar = new ToolBar(keyListGroup, SWT.FLAT);
insertKeyItem = new ToolItem(keyListToolBar, SWT.PUSH);
insertKeyItem.setToolTipText(Messages.AddKey);
insertKeyItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
insertKeyItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
insertKeyItem.setEnabled(true);
deletekeyItem = new ToolItem(keyListToolBar, SWT.PUSH);
deletekeyItem.setToolTipText(Messages.deleteKey);
deletekeyItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
deletekeyItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
deletekeyItem.setEnabled(false);
keyListColumnNameArrs = new String[] { Messages.tblKeyColumnName };
int[] columnwidthArr = new int[] { 180 };
keyListTableViewer = CommonUITool.createCommonTableViewer(keyListGroup, null, keyListColumnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 320));
keyListTable = keyListTableViewer.getTable();
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class ShardKeysPanel method buildKeyInfo.
private void buildKeyInfo(Composite parent) {
keyInfoGroup = new Group(parent, SWT.NONE);
keyInfoGroup.setText(Messages.shardKeyInfo);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.horizontalSpan = 2;
keyInfoGroup.setLayoutData(gridData);
GridLayout layout = new GridLayout();
keyInfoGroup.setLayout(layout);
keyInfoToolBar = new ToolBar(keyInfoGroup, SWT.FLAT);
insertKeyInfoItem = new ToolItem(keyInfoToolBar, SWT.PUSH);
insertKeyInfoItem.setToolTipText(Messages.addData);
insertKeyInfoItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
insertKeyInfoItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert_disabled.png"));
insertKeyInfoItem.setEnabled(false);
deletekeyInfoItem = new ToolItem(keyInfoToolBar, SWT.PUSH);
deletekeyInfoItem.setToolTipText(Messages.deleteData);
deletekeyInfoItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
deletekeyInfoItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete_disabled.png"));
deletekeyInfoItem.setEnabled(false);
keyInfoColumnNameArrs = new String[] { Messages.tblMin, Messages.tblMax, Messages.tblShardId };
int[] columnwidthArr = new int[] { 100, 100, 200 };
keyInfoTableViewer = CommonUITool.createCommonTableViewer(keyInfoGroup, null, keyInfoColumnNameArrs, columnwidthArr, CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, 320));
keyInfoTable = keyInfoTableViewer.getTable();
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class DBSpaceLabelProvider method createButtonComposite.
private void createButtonComposite(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
parent.setLayout(layout);
infoLable = new Label(parent, SWT.None);
infoLable.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
ToolBar toolbar = new ToolBar(parent, SWT.RIGHT_TO_LEFT | SWT.WRAP | SWT.FLAT);
toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
settingItem = new ToolItem(toolbar, SWT.PUSH);
settingItem.setImage(CommonUIPlugin.getImage("/icons/action/settings.png"));
settingItem.setToolTipText(Messages.itemSetting);
settingItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean useOrNot = GeneralPreference.isUseHostDashboard();
ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_HOST, useOrNot, -1);
if (dialog.open() == IDialogConstants.OK_ID) {
useOrNot = dialog.isUseAutoShow();
GeneralPreference.setUseHostDashboard(useOrNot);
}
}
});
saveItem = new ToolItem(toolbar, SWT.PUSH);
saveItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_save.png"));
saveItem.setDisabledImage(CommonUIPlugin.getImage("icons/queryeditor/file_save_disabled.png"));
saveItem.setToolTipText(Messages.saveAutoStartipLabel);
saveItem.setEnabled(false);
saveItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
saveAutoParam(getNewAutoStartDB());
}
});
exportItem = new ToolItem(toolbar, SWT.PUSH);
exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
exportItem.setToolTipText(Messages.itemExport);
exportItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
new ExportHostStatusDialog(Display.getCurrent().getActiveShell(), HostDashboardEditor.this).open();
}
});
refreshItem = new ToolItem(toolbar, SWT.PUSH);
refreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.setToolTipText(Messages.itemRefresh);
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
loadAllData();
}
});
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class EditCMCubridBrokerConfPart method createToolBarComp.
/**
* create tool barcomp
* @param parent
*/
public void createToolBarComp(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
comp.setLayoutData(gd);
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = -1;
comp.setLayout(layout);
ToolBar toolbar = new ToolBar(comp, SWT.LEFT_TO_RIGHT | SWT.FLAT);
toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
saveCubridBrokerConfItem = new ToolItem(toolbar, SWT.PUSH);
saveCubridBrokerConfItem.setImage(CubridManagerUIPlugin.getImage("icons/queryeditor/file_save.png"));
saveCubridBrokerConfItem.setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.msgTipSaveAction);
saveCubridBrokerConfItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
//check whether contains duplicate property name
String errMsg = editorComp.validate();
if (errMsg != null) {
CommonUITool.openErrorBox(errMsg);
return;
}
doSave();
}
});
// Show/hide of the history pane
saveAsCubridBrokerConfItem = new ToolItem(toolbar, SWT.PUSH);
saveAsCubridBrokerConfItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/file_saveas.png"));
saveAsCubridBrokerConfItem.setToolTipText(Messages.cubridBrokerConfEditorSaveAsItemLabel);
saveAsCubridBrokerConfItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
//check whether contains duplicate property name
String errMsg = editorComp.validate();
if (errMsg != null) {
CommonUITool.openErrorBox(errMsg);
return;
}
ExportConfigDialog dialog = new ExportConfigDialog(getSite().getShell(), ConfigType.CUBRID_BROKER, true);
if (defaultExportFilePath != null && !"".equals(defaultExportFilePath)) {
dialog.setDefaultFilePath(defaultExportFilePath);
}
if (defaultExportFileName != null && !"".equals(defaultExportFileName)) {
dialog.setDefaultFileName(defaultExportFileName);
}
if (defaultExportFileExtName != null && !"".equals(defaultExportFileExtName)) {
dialog.setDefaultFileExtName(defaultExportFileExtName);
}
if (defaultExportFileCharset != null && !"".equals(defaultExportFileCharset)) {
dialog.setOutputFileCharset(defaultExportFileCharset);
}
if (dialog.open() == Dialog.OK) {
defaultExportFilePath = dialog.getDefaultFilePath();
defaultExportFileName = dialog.getDefaultFileName();
defaultExportFileExtName = dialog.getDefaultFileExtName();
String fileFullName = dialog.getOutputFileFullName();
defaultExportFileCharset = dialog.getOutputFileCharset();
BrokerConfig cubridBrokerConfig = editorComp.getBrokerConfig();
errMsg = editorComp.validate();
if (errMsg != null) {
CommonUITool.openErrorBox(errMsg);
return;
}
String contents = brokerConfPersistUtil.readBrokerConfig(cubridBrokerConfig);
try {
brokerConfPersistUtil.writeBrokerConfig(new File(fileFullName), defaultExportFileCharset, contents);
CommonUITool.openInformationBox(Messages.titleSuccess, Messages.cubridBrokerConfEditorSaveSucessMsg);
setDirty(false);
} catch (Exception e) {
CommonUITool.openErrorBox(e.getMessage());
}
}
}
});
new ToolItem(toolbar, SWT.SEPARATOR);
ToolItem importItem = new ToolItem(toolbar, SWT.PUSH);
importItem.setImage(CubridManagerUIPlugin.getImage("icons/queryeditor/file_open.png"));
importItem.setToolTipText(com.cubrid.cubridmanager.ui.host.Messages.msgTipOpenAction);
importItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
ImportConfigDialog dialog = new ImportConfigDialog(getSite().getShell(), ConfigType.CUBRID_BROKER, true);
if (defaultImportFileName != null && !"".equals(defaultImportFileName)) {
dialog.setDefaultFileName(defaultImportFileName);
}
if (defaultImportFileCharset != null && !"".equals(defaultImportFileCharset)) {
dialog.setDefaultCharset(defaultImportFileCharset);
}
if (dialog.open() == Dialog.OK) {
defaultImportFileName = dialog.getDefaultFileName();
defaultImportFileCharset = dialog.getDefaultCharset();
List<String> contents = dialog.getImportFileContent();
StringBuilder contentBuilder = new StringBuilder();
for (String content : contents) {
contentBuilder.append(content).append(StringUtil.NEWLINE);
}
BrokerConfig cubridBrokerConfig = brokerConfPersistUtil.parseStringLineToBrokerConfig(contentBuilder.toString());
firstView = false;
editorComp.setBrokerConfig(cubridBrokerConfig);
editorComp.createBrokerConfTableData();
}
}
});
new ToolItem(toolbar, SWT.SEPARATOR);
addPropItem = new ToolItem(toolbar, SWT.PUSH);
addPropItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_insert.png"));
addPropItem.setToolTipText(Messages.cubridBrokerConfEditorAddPropItemLabel);
addPropItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
editorComp.addPropData();
}
});
deletePropItem = new ToolItem(toolbar, SWT.PUSH);
deletePropItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/table_record_delete.png"));
deletePropItem.setToolTipText(Messages.cubridBrokerConfEditorDeletePropItemLabel);
deletePropItem.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("all")
public void widgetSelected(SelectionEvent event) {
editorComp.deletePropData();
}
});
}
Aggregations