use of com.cubrid.common.ui.common.preference.ShowDashboardDialog 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 com.cubrid.common.ui.common.preference.ShowDashboardDialog 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