use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class SerialDashboardEditorPart method createPartControl.
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(com.cubrid.common.ui.cubrid.table.Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
refresh();
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem addSerailItem = new ToolItem(toolBar, SWT.NONE);
addSerailItem.setText(Messages.serialsDetailInfoPartCreateSerialBtn);
addSerailItem.setImage(CommonUIPlugin.getImage("icons/action/serial_add.png"));
addSerailItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
addSerial();
}
});
ToolItem editSerailItem = new ToolItem(toolBar, SWT.NONE);
editSerailItem.setText(Messages.serialsDetailInfoPartEditSerialBtn);
editSerailItem.setImage(CommonUIPlugin.getImage("icons/action/serial_edit.png"));
editSerailItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
editSerial();
}
});
ToolItem dropSerailItem = new ToolItem(toolBar, SWT.NONE);
dropSerailItem.setText(Messages.serialsDetailInfoPartDropSerialBtn);
dropSerailItem.setImage(CommonUIPlugin.getImage("icons/action/serial_delete.png"));
dropSerailItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(final SelectionEvent event) {
dropSerial();
}
});
createSerialsDetailInfoTable(parent);
this.setInputs();
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class ColumnViewerSorter method createPartControl.
public void createPartControl(Composite parent) {
parent.setLayout(new GridLayout(1, false));
ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
refreshItem.setToolTipText(Messages.tablesDetailInfoPartBtnRefreshTip);
refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
refreshItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
refresh();
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem countItem = new ToolItem(toolBar, SWT.PUSH);
countItem.setText(Messages.tablesDetailInfoPartBtnEsitmateRecord);
countItem.setToolTipText(Messages.tablesDetailInfoPartBtnEsitmateRecordTip);
countItem.setImage(CommonUIPlugin.getImage("icons/action/count.gif"));
countItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<TableDetailInfo> list = new ArrayList<TableDetailInfo>();
TableItem[] items = tableListView.getTable().getSelection();
for (TableItem item : items) {
list.add((TableDetailInfo) item.getData());
}
// Check selected size and confirm
if (list.size() == 0) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartAlertNotSelected);
return;
}
if (CommonUITool.openConfirmBox(Messages.tablesDetailInfoPartBtnEsitmateRecordAlert)) {
LoadTableRecordCountsProgress progress = new LoadTableRecordCountsProgress(database, list);
progress.getTableCounts();
tableListView.refresh();
}
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem viewDataItem = new ToolItem(toolBar, SWT.PUSH);
viewDataItem.setText(Messages.tablesDetailInfoPartBtnViewData);
viewDataItem.setToolTipText(Messages.tablesDetailInfoPartBtnViewDataTip);
viewDataItem.setImage(CommonUIPlugin.getImage("icons/action/table_select_all.png"));
viewDataItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TableItem[] items = tableListView.getTable().getSelection();
if (items.length == 1) {
TableDetailInfo tableDetailInfo = (TableDetailInfo) items[0].getData();
String query = SQLGenerateUtils.getSelectSQLWithLimit(tableDetailInfo.getTableName(), 1, 100);
QueryEditorUtil.openQueryEditorAndRunQuery(database, query, true, true);
} else {
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnViewDataSelectOne);
}
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem copyTableNamesItem = new ToolItem(toolBar, SWT.PUSH);
copyTableNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyTableNames);
copyTableNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyTableNamesTip);
copyTableNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_table_name.gif"));
copyTableNamesItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
List<String> nameList = new ArrayList<String>();
for (TableDetailInfo tablesDetailInfoPOJO : tableList) {
nameList.add(tablesDetailInfoPOJO.getTableName());
}
if (nameList.size() == 0) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
return;
}
copyNamesToClipboard(nameList);
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
ToolItem copyColumnNamesItem = new ToolItem(toolBar, SWT.PUSH);
copyColumnNamesItem.setText(Messages.tablesDetailInfoPartBtnCopyColumnNames);
copyColumnNamesItem.setToolTipText(Messages.tablesDetailInfoPartBtnCopyColumnNamesTip);
copyColumnNamesItem.setImage(CommonUIPlugin.getImage("icons/action/copy_column_name.gif"));
copyColumnNamesItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
TablesDetailInfoCTabItem tabItem = (TablesDetailInfoCTabItem) tabFolder.getSelection();
schemaInfo = tabItem.getTableInfoComposite().getData();
if (schemaInfo == null) {
CommonUITool.openWarningBox(Messages.tablesDetailInfoPartBtnCopySuccessFailed);
return;
}
List<String> nameList = new ArrayList<String>();
for (DBAttribute att : schemaInfo.getAttributes()) {
nameList.add(att.getName());
}
copyNamesToClipboard(nameList);
CommonUITool.openInformationBox(Messages.tablesDetailInfoPartBtnCopySuccessTitle, Messages.tablesDetailInfoPartBtnCopySuccessMsg);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
final NewTableAction newTableAction = (NewTableAction) ActionManager.getInstance().getAction(NewTableAction.ID);
ToolItem newTableItem = new ToolItem(toolBar, SWT.PUSH);
newTableItem.setText(newTableAction.getText());
newTableItem.setImage(CommonUITool.getImage(newTableAction.getImageDescriptor()));
newTableItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
newTableAction.run(database);
}
});
ScrolledComposite scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
scrolledComp.setLayout(new FillLayout());
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
topSash = new SashForm(scrolledComp, SWT.VERTICAL);
topSash.setBackground(ResourceManager.getColor(136, 161, 227));
GridLayout gridLayout = new GridLayout();
gridLayout.verticalSpacing = 0;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.horizontalSpacing = 0;
topSash.setLayout(gridLayout);
topSash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
topSash.SASH_WIDTH = 1;
scrolledComp.setContent(topSash);
createTablesDetailInfoTable(topSash);
createTabFolder(topSash);
topSash.setWeights(new int[] { 70, 30 });
this.setInputs();
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class QueryPlanCompositeWithHistory method createPlanToolbar.
private void createPlanToolbar() {
Composite toolBarComposite = new Composite(this, SWT.NONE);
GridLayout gridLayout = new GridLayout(2, false);
gridLayout.verticalSpacing = 0;
gridLayout.horizontalSpacing = 10;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
toolBarComposite.setLayout(gridLayout);
toolBarComposite.setLayoutData(new GridData(SWT.FILL, SWT.NONE, false, false));
ToolBar toolBar = new ToolBar(toolBarComposite, SWT.FLAT | SWT.RIGHT);
dispModeTextItem = new ToolItem(toolBar, SWT.CHECK);
dispModeTextItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_raw.png"));
dispModeTextItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode + "(F11)");
dispModeTextItem.setText(Messages.lblPlanRawBtn);
dispModeTextItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
showSelectedPlan(PLAN_DISPLAY_MODE.TEXT.getInt());
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
dispModeTreeItem = new ToolItem(toolBar, SWT.CHECK);
dispModeTreeItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_tree.png"));
dispModeTreeItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode + "(F11)");
dispModeTreeItem.setText(Messages.lblPlanTreeBtn);
dispModeTreeItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
showSelectedPlan(PLAN_DISPLAY_MODE.TREE.getInt());
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
dispModeGraphItem = new ToolItem(toolBar, SWT.CHECK);
dispModeGraphItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_graph.png"));
dispModeGraphItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode + "(F11)");
dispModeGraphItem.setText(Messages.lblPlanGraph);
dispModeGraphItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
showSelectedPlan(PLAN_DISPLAY_MODE.GRAPH.getInt());
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
editTableItem = new ToolItem(toolBar, SWT.None);
editTableItem.setImage(CommonUIPlugin.getImage("icons/navigator/schema_table_item.png"));
editTableItem.setText(Messages.lblPlanEditTable);
editTableItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
QueryPlanComposite comp = getSelectedQueryPlanComposite();
String tableName = comp.getSelectedTable();
if (StringUtil.isEmpty(tableName)) {
CommonUITool.openErrorBox(Messages.msgPlanEditTable);
return;
}
ISchemaNode node = new DefaultSchemaNode(tableName, tableName, null);
node.setDatabase(editor.getSelectedDatabase());
EditTableAction action = (EditTableAction) ActionManager.getInstance().getAction(EditTableAction.ID);
if (action == null) {
CommonUITool.openErrorBox(Messages.errPlanEditNoAction);
return;
}
action.run((ISchemaNode) node);
}
});
editIndexItem = new ToolItem(toolBar, SWT.None);
editIndexItem.setImage(CommonUIPlugin.getImage("icons/navigator/table_index_item.png"));
editIndexItem.setText(Messages.lblPlanEditIndex);
editIndexItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
QueryPlanComposite comp = getSelectedQueryPlanComposite();
String tableName = comp.getSelectedTable();
// String indexName = comp.getSelectedIndex();
if (StringUtil.isEmpty(tableName)) {
CommonUITool.openErrorBox(Messages.msgPlanEditIndex);
return;
}
ISchemaNode node = new DefaultSchemaNode(tableName, tableName, null);
node.setDatabase(editor.getSelectedDatabase());
EditTableAction action = (EditTableAction) ActionManager.getInstance().getAction(EditTableAction.ID);
if (action == null) {
CommonUITool.openErrorBox(Messages.errPlanEditNoAction);
return;
}
action.editIndexMode((ISchemaNode) node);
}
});
ToolItem comparePlanItem = new ToolItem(toolBar, SWT.None);
comparePlanItem.setImage(CommonUIPlugin.getImage("icons/queryplan/use_compare_queryplan.png"));
comparePlanItem.setText(Messages.lblComparePlan);
comparePlanItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
QueryPlanComposite comp = getSelectedQueryPlanComposite();
StructQueryPlan sq = comp.getQueryPlan();
TuneModeModel tuneModeModel = new TuneModeModel(sq, null);
editor.displayTuneModeResult(tuneModeModel);
}
});
ToolBar delHistoryToolBar = new ToolBar(toolBarComposite, SWT.FLAT);
delHistoryToolBar.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, true));
// Show/hide of the history pane
historyShowHideItem = new ToolItem(delHistoryToolBar, SWT.PUSH);
historyShowHideItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_history_hide.png"));
historyShowHideItem.setToolTipText(Messages.tooltip_qedit_explain_history_show_hide);
historyShowHideItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
boolean isShow = !planHistoryTable.getVisible();
if (isShow) {
showHistoryPane();
} else {
hideHistoryPane();
}
}
});
new ToolItem(delHistoryToolBar, SWT.SEPARATOR);
// Collecting histories switch
historySwitchItem = new ToolItem(delHistoryToolBar, SWT.CHECK);
historySwitchItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_history_switch.png"));
historySwitchItem.setToolTipText(Messages.tooltip_qedit_explain_history_switch);
historySwitchItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
collectToHistoryFlag = !historySwitchItem.getSelection();
}
});
historySwitchItem.setSelection(true);
new ToolItem(delHistoryToolBar, SWT.SEPARATOR);
delHistory = new ToolItem(delHistoryToolBar, SWT.PUSH);
delHistory.setImage(CommonUIPlugin.getImage("icons/action/table_record_delete.png"));
delHistory.setDisabledImage(CommonUIPlugin.getImage("icons/action/table_record_delete_disabled.png"));
delHistory.setToolTipText(Messages.tooltip_qedit_explain_history_delete);
delHistory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (planHistoryTable.getSelectionIndices().length == 0) {
MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.error, Messages.explain_history_delete_error);
return;
}
deleteHistory();
}
});
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class RecentlyUsedSQLComposite method initialize.
/**
* Create the SQL history composite
*/
public void initialize() {
Composite toolBarComposite = new Composite(this, SWT.NONE);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.verticalSpacing = 0;
gridLayout.horizontalSpacing = 10;
gridLayout.marginWidth = 0;
gridLayout.marginHeight = 0;
gridLayout.numColumns = 2;
toolBarComposite.setLayout(gridLayout);
toolBarComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ToolBar delHistoryToolBar = new ToolBar(toolBarComposite, SWT.FLAT | SWT.RIGHT);
delHistoryToolBar.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, true, false));
ToolItem delHistory = new ToolItem(delHistoryToolBar, SWT.PUSH);
delHistory.setImage(CommonUIPlugin.getImage("icons/action/table_record_delete.png"));
delHistory.setDisabledImage(CommonUIPlugin.getImage("icons/action/table_record_delete_disabled.png"));
delHistory.setToolTipText(Messages.tooltip_qedit_sql_history_delete);
delHistory.setText(Messages.btn_qedit_sql_history_delete);
delHistory.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (sqlHistoryTable.getTable().getSelectionIndices().length == 0) {
MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), Messages.error, Messages.sql_history_delete_error);
return;
}
MessageBox messageBox = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
messageBox.setText(Messages.tooltip_qedit_sql_history_delete);
messageBox.setMessage(Messages.sql_history_delete_message);
// remove data ,both view and model
int buttonID = messageBox.open();
if (buttonID == SWT.YES) {
deleteHistory();
}
}
});
// help messages
Label helpMsg = new Label(toolBarComposite, SWT.None);
helpMsg.setText(Messages.recentlyUsedSQLHelp);
helpMsg.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, true, false));
// create the query result tab folder
recentlyUsedSQLTabFolder = new CTabFolder(this, SWT.BOTTOM);
recentlyUsedSQLTabFolder.setSimple(false);
recentlyUsedSQLTabFolder.setUnselectedImageVisible(true);
recentlyUsedSQLTabFolder.setUnselectedCloseVisible(true);
recentlyUsedSQLTabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
recentlyUsedSQLTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
recentlyUsedSQLTabFolder.setLayout(new GridLayout(1, true));
recentlyUsedSQLTabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
//TabContextMenuManager tabContextMenuManager = new TabContextMenuManager(recentlyUsedSQLTabFolder);
//tabContextMenuManager.createContextMenu();
recentlyUsedSQLTabItem = new CTabItem(resultTabFolder, SWT.NONE);
recentlyUsedSQLTabItem.setText(Messages.qedit_sql_history_folder);
recentlyUsedSQLTabItem.setControl(this);
recentlyUsedSQLTabItem.setShowClose(false);
final SashForm bottomSash = new SashForm(recentlyUsedSQLTabFolder, SWT.VERTICAL);
bottomSash.SASH_WIDTH = SASH_WIDTH;
bottomSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
createHistoryTable(bottomSash);
SashForm tailSash = new SashForm(bottomSash, SWT.HORIZONTAL);
tailSash.SASH_WIDTH = SASH_WIDTH;
tailSash.setBackground(CombinedQueryEditorComposite.BACK_COLOR);
logMessageArea = new StyledText(tailSash, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
CommonUITool.registerCopyPasteContextMenu(logMessageArea, false);
bottomSash.setWeights(new int[] { 80, 20 });
logMessageArea.setToolTipText(Messages.tooltipHowToExpandLogPane);
logMessageArea.addFocusListener(new FocusListener() {
public void focusLost(FocusEvent e) {
bottomSash.setWeights(new int[] { 80, 20 });
}
public void focusGained(FocusEvent e) {
bottomSash.setWeights(new int[] { 20, 80 });
}
});
CTabItem tabItem = new CTabItem(recentlyUsedSQLTabFolder, SWT.NONE);
tabItem.setText(Messages.qedit_sql_history);
tabItem.setControl(bottomSash);
tabItem.setShowClose(false);
recentlyUsedSQLTabFolder.setSelection(tabItem);
}
use of org.eclipse.swt.widgets.ToolBar in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method displayQueryPlan.
/**
* Display query record for tuner tab
*
* @param queryRecord
*/
private void displayQueryPlan(final QueryRecord queryRecord) {
if (queryPlanComposite != null && !queryPlanComposite.isDisposed()) {
queryPlanComposite.dispose();
}
queryPlanComposite = new Composite(queryPlanContainer, SWT.BORDER);
queryPlanComposite.setLayout(new GridLayout());
ToolBar queryPlanToolBar = new ToolBar(queryPlanComposite, SWT.None);
queryPlanToolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
hideItem = new ToolItem(queryPlanToolBar, SWT.CHECK);
hideItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_panel_down.png"));
hideItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
dispModeTextItem = new ToolItem(queryPlanToolBar, SWT.CHECK);
dispModeTextItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_raw.png"));
dispModeTextItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
dispModeTreeItem = new ToolItem(queryPlanToolBar, SWT.CHECK);
dispModeTreeItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_tree.png"));
dispModeTreeItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
dispModeGraphItem = new ToolItem(queryPlanToolBar, SWT.CHECK);
dispModeGraphItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_graph.png"));
dispModeGraphItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
TableViewer statisticsViewer = new TableViewer(queryPlanComposite, SWT.FULL_SELECTION);
statisticsViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 50));
statisticsViewer.getTable().setHeaderVisible(true);
statisticsViewer.getTable().setLinesVisible(false);
TableColumn itemColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
itemColumn.setText(Messages.columnItem);
itemColumn.setWidth(60);
TableColumn fetchColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
fetchColumn.setText(Messages.columnFetches);
fetchColumn.setWidth(60);
TableColumn dirtyColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
dirtyColumn.setText(Messages.columnDirties);
dirtyColumn.setWidth(60);
TableColumn ioReadColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
ioReadColumn.setText(Messages.columnIORead);
ioReadColumn.setWidth(80);
TableColumn ioWriteColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
ioWriteColumn.setText(Messages.columnIOWrite);
ioWriteColumn.setWidth(80);
TableColumn costColumn = new TableColumn(statisticsViewer.getTable(), SWT.None);
costColumn.setText(Messages.columnCost);
costColumn.setWidth(60);
statisticsViewer.setContentProvider(new QueryPlanContentProvider());
statisticsViewer.setLabelProvider(new QueryPlanLabelPrivoder(statisticsViewer, true));
List<QueryRecord> recordList = new ArrayList<QueryRecord>();
if (queryRecord != null) {
recordList.add(queryRecord);
}
if (lastRecord != null) {
recordList.add(lastRecord);
}
statisticsViewer.setInput(recordList);
final SashForm queryPlanSashForm = new SashForm(queryPlanComposite, SWT.VERTICAL);
queryPlanSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
queryPlanSashForm.setBackground(SASH_COLOR);
queryPlanSashForm.setLayout(new GridLayout());
queryPlanSashForm.SASH_WIDTH = 2;
DatabaseInfo databaseInfo = database == null ? null : database.getDatabaseInfo();
final QueryPlanComposite nowPlanComposite = new QueryPlanComposite(queryPlanSashForm, SWT.None, queryRecord == null ? null : queryRecord.getQueryPlan(), databaseInfo);
final QueryPlanComposite beforePlanComposite = new QueryPlanComposite(queryPlanSashForm, SWT.None, lastRecord == null ? null : lastRecord.getQueryPlan(), databaseInfo);
queryPlanSashForm.setWeights(new int[] { 500, 500 });
hideItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
isHiden = !isHiden;
performHideOperation(queryPlanSashForm, isHiden);
}
});
dispModeTextItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateTunerPlanDisplayModel(nowPlanComposite, beforePlanComposite, DISPLAY_TEXT);
}
});
dispModeTreeItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateTunerPlanDisplayModel(nowPlanComposite, beforePlanComposite, DISPLAY_TREE);
}
});
dispModeGraphItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateTunerPlanDisplayModel(nowPlanComposite, beforePlanComposite, DISPLAY_GRAPH);
}
});
performHideOperation(queryPlanSashForm, isHiden);
updateTunerPlanDisplayModel(nowPlanComposite, beforePlanComposite, tunerDisplayModel);
queryPlanContainer.layout();
}
Aggregations