use of com.cubrid.cubridmanager.ui.cubrid.database.dialog.ExportDashboardDialog in project cubrid-manager by CUBRID.
the class DatabaseDashboardEditor method createButtonComposite.
/**
* create button composite
*
* @param parent
*/
public void createButtonComposite(Composite parent) {
GridLayout layout = new GridLayout(2, false);
layout.marginHeight = 0;
parent.setLayout(layout);
Composite composite = new Composite(parent, SWT.None);
layout.marginHeight = 0;
composite.setLayout(new GridLayout(3, false));
composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
infoLable = new Label(composite, SWT.None);
infoLable.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
infoLable.setText(getPartName());
new Label(composite, SWT.None).setText(" ");
errMsgLable = new Label(composite, SWT.None);
errMsgLable.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.databaseDashboardSettingTooltip);
settingItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean useOrNot = GeneralPreference.isUseDatabaseDashboard();
ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_DB, useOrNot, autoRefreshTime);
if (dialog.open() == IDialogConstants.OK_ID) {
autoRefreshTime = dialog.getAutoRefreshSecond();
useOrNot = dialog.isUseAutoShow();
GeneralPreference.setUseDatabaseDashboard(useOrNot);
}
}
});
exportItem = new ToolItem(toolbar, SWT.PUSH);
exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
exportItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
exportItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<Table> exportTableList = new ArrayList<Table>();
if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
exportTableList.add(dbInfoTableViewer.getTable());
}
exportTableList.add(volumnInfoTableViewer.getTable());
exportTableList.add(brokerInfoTableViewer.getTable());
exportTableList.add(lockAndTransactionTable);
String[] excelSheetNames = { Messages.exportDashboardDBTableTitle, Messages.exportDashboardVolumnTableTitle, Messages.exportDashboardBrokerTableTitle, Messages.exportDashboardLockTableTitle };
new ExportDashboardDialog(Display.getCurrent().getActiveShell(), exportTableList, database.getDatabaseInfo().getDbName(), excelSheetNames).open();
}
});
new ToolItem(toolbar, SWT.SEPARATOR | SWT.VERTICAL);
autoRefreshItem = new ToolItem(toolbar, SWT.PUSH);
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
autoRefreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (autoRefreshData) {
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
stopAutoRefreshData();
} else {
autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
autoRefreshItem.setToolTipText(Messages.databaseDashboardStopAutoRefreshTooltip);
startAutoRefreshData();
}
autoRefreshData = !autoRefreshData;
}
});
}
Aggregations