use of com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite 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 com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite 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();
}
use of com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite in project cubrid-manager by CUBRID.
the class QueryRecordListComparator method createQueryCompareTab.
private void createQueryCompareTab(CTabFolder tabFolder) {
CTabItem item = new CTabItem(tabFolder, SWT.None | SWT.MULTI | SWT.V_SCROLL);
item.setText(Messages.tabItemQueryCompare);
Composite composite = new Composite(tabFolder, SWT.None);
composite.setLayout(new GridLayout());
item.setControl(composite);
Composite topComposite = new Composite(composite, SWT.None);
topComposite.setLayout(new FormLayout());
topComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 25));
Composite leftTopComposite = new Composite(topComposite, SWT.None);
FormData leftTopData = new FormData();
leftTopData.top = new FormAttachment(0, 0);
leftTopData.bottom = new FormAttachment(100, 0);
leftTopData.left = new FormAttachment(0, 0);
leftTopData.right = new FormAttachment(50, 0);
leftTopComposite.setLayoutData(leftTopData);
leftTopComposite.setLayout(new GridLayout(2, false));
Composite rightTopComposite = new Composite(topComposite, SWT.None);
FormData rightTopData = new FormData();
rightTopData.top = new FormAttachment(0, 0);
rightTopData.bottom = new FormAttachment(100, 0);
rightTopData.left = new FormAttachment(50, 0);
rightTopData.right = new FormAttachment(100, 0);
rightTopComposite.setLayoutData(rightTopData);
rightTopComposite.setLayout(new GridLayout(5, false));
Label leftLabel = new Label(leftTopComposite, SWT.None);
leftLabel.setText(Messages.lblQuery);
leftLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
queryRecordLeftCombo = new Combo(leftTopComposite, SWT.READ_ONLY);
queryRecordLeftCombo.setLayoutData(CommonUITool.createGridData(1, 1, 200, -1));
queryRecordLeftCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
displayCompareQueryRecord();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Label rightLabel = new Label(rightTopComposite, SWT.None);
rightLabel.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
rightLabel.setText(Messages.lblQuery);
queryRecordRightCombo = new Combo(rightTopComposite, SWT.READ_ONLY);
queryRecordRightCombo.setLayoutData(CommonUITool.createGridData(1, 1, 200, -1));
queryRecordRightCombo.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
displayCompareQueryRecord();
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
ToolBar leftToolBar = new ToolBar(rightTopComposite, SWT.None);
leftToolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
compareItem = new ToolItem(leftToolBar, SWT.None);
compareItem.setImage(CommonUIPlugin.getImage("icons/action/refresh_tuning.png"));
compareItem.setToolTipText(Messages.itemTooltipCompare);
compareItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
displayCompareQueryRecord();
}
});
delQueryRecordItem = new ToolItem(leftToolBar, SWT.None);
delQueryRecordItem.setImage(CommonUIPlugin.getImage("icons/queryplan/delete_query.gif"));
delQueryRecordItem.setToolTipText(Messages.itemTooltipRemoveQuery);
delQueryRecordItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
if (CommonUITool.openConfirmBox(Messages.confirmDeleteQueryPlanOnTuner)) {
removeQueryRecord();
}
}
});
Composite folderPlaceComposite = new Composite(rightTopComposite, SWT.None);
folderPlaceComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
ToolBar rightToolBar = new ToolBar(rightTopComposite, SWT.None);
rightToolBar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
multiRunItem = new ToolItem(rightToolBar, SWT.None);
multiRunItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/query_multi_run.png"));
multiRunItem.setToolTipText(Messages.itemTooltipRunAgain);
multiRunItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
QueryRecord leftRecord = getSelectedLeftQueryRecord();
QueryRecord rightRecord = getSelectedRightQueryRecord();
if (leftRecord == null || rightRecord == null) {
CommonUITool.openErrorBox(Messages.errCompareQueryEmpty);
return;
}
runQueryPlanAgain(leftRecord.getQuery(), rightRecord.getQuery());
}
});
sqlModeItem = new ToolItem(rightToolBar, SWT.CHECK);
sqlModeItem.setImage(CommonUIPlugin.getImage("icons/queryplan/sql_compare.gif"));
sqlModeItem.setToolTipText(Messages.itemTooltipQuery);
sqlModeItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_SQL);
}
});
textModelItem = new ToolItem(rightToolBar, SWT.CHECK);
textModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_raw.png"));
textModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
textModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_TEXT);
}
});
treeModelItem = new ToolItem(rightToolBar, SWT.CHECK);
treeModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_tree.png"));
treeModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
treeModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_TREE);
}
});
graphModelItem = new ToolItem(rightToolBar, SWT.CHECK);
graphModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_graph.png"));
graphModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
graphModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_GRAPH);
}
});
Composite tablesComposite = new Composite(composite, SWT.None);
tablesComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 60));
tablesComposite.setLayout(new FormLayout());
/*Left composite*/
Composite leftTableComposite = new Composite(tablesComposite, SWT.BORDER);
leftTableComposite.setLayout(new GridLayout());
FormData leftTableData = new FormData();
leftTableData.top = new FormAttachment(0, 0);
leftTableData.bottom = new FormAttachment(100, 0);
leftTableData.left = new FormAttachment(0, 0);
leftTableData.right = new FormAttachment(50, -2);
leftTableComposite.setLayoutData(leftTableData);
/*Right composite*/
Composite rightTableComposite = new Composite(tablesComposite, SWT.BORDER);
rightTableComposite.setLayout(new GridLayout());
FormData rightTabelData = new FormData();
rightTabelData.top = new FormAttachment(0, 0);
rightTabelData.bottom = new FormAttachment(100, 0);
rightTabelData.left = new FormAttachment(50, 2);
rightTabelData.right = new FormAttachment(100, 0);
rightTableComposite.setLayoutData(rightTabelData);
compareLeftTableViewer = new TableViewer(leftTableComposite, SWT.FULL_SELECTION);
compareLeftTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareLeftTableViewer.getTable().setHeaderVisible(true);
compareLeftTableViewer.getTable().setLinesVisible(false);
compareLeftTableViewer.setContentProvider(new QueryPlanContentProvider());
compareLeftTableViewer.setLabelProvider(new QueryPlanLabelPrivoder(compareLeftTableViewer, false));
TableColumn fetchColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
fetchColumnLeft.setText(Messages.columnFetches);
fetchColumnLeft.setWidth(60);
TableColumn dirtyColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
dirtyColumnLeft.setText(Messages.columnDirties);
dirtyColumnLeft.setWidth(60);
TableColumn ioReadColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
ioReadColumnLeft.setText(Messages.columnIORead);
ioReadColumnLeft.setWidth(80);
TableColumn ioWriteColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
ioWriteColumnLeft.setText(Messages.columnIOWrite);
ioWriteColumnLeft.setWidth(80);
TableColumn costColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
costColumnLeft.setText(Messages.columnCost);
costColumnLeft.setWidth(60);
compareRightTableViewer = new TableViewer(rightTableComposite, SWT.FULL_SELECTION);
compareRightTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareRightTableViewer.getTable().setHeaderVisible(true);
compareRightTableViewer.getTable().setLinesVisible(false);
compareRightTableViewer.setContentProvider(new QueryPlanContentProvider());
compareRightTableViewer.setLabelProvider(new QueryPlanLabelPrivoder(compareRightTableViewer, false));
TableColumn fetchColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
fetchColumnRight.setText(Messages.columnFetches);
fetchColumnRight.setWidth(60);
TableColumn dirtyColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
dirtyColumnRight.setText(Messages.columnDirties);
dirtyColumnRight.setWidth(60);
TableColumn ioReadColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
ioReadColumnRight.setText(Messages.columnIORead);
ioReadColumnRight.setWidth(80);
TableColumn ioWriteColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
ioWriteColumnRight.setText(Messages.columnIOWrite);
ioWriteColumnRight.setWidth(80);
TableColumn costColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
costColumnRight.setText(Messages.columnCost);
costColumnRight.setWidth(60);
queryPlanCompareSashForm = new SashForm(composite, SWT.VERTICAL);
queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
queryPlanCompareSashForm.setBackground(SASH_COLOR);
queryPlanCompareSashForm.setLayout(new GridLayout());
queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
Composite textMergeComposite = new Composite(queryPlanCompareSashForm, SWT.None);
textMergeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
textMergeComposite.setLayout(new FillLayout());
textMergeConfig = new CompareConfiguration();
textMergeConfig.setProperty(CompareConfiguration.SHOW_PSEUDO_CONFLICTS, Boolean.FALSE);
textMergeConfig.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.TRUE);
textMergeConfig.setLeftEditable(false);
textMergeConfig.setRightEditable(false);
textMergeViewer = new TextMergeViewer(textMergeComposite, SWT.BORDER, textMergeConfig);
DiffNode queryDiffNode = new DiffNode(null, Differencer.CHANGE, null, new TextCompareInput(""), new TextCompareInput(""));
textMergeViewer.setInput(queryDiffNode);
Composite compareQueryPlanComposite = new Composite(queryPlanCompareSashForm, SWT.None);
compareQueryPlanComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareQueryPlanComposite.setLayout(new FormLayout());
DatabaseInfo databaseInfo = database == null ? null : database.getDatabaseInfo();
leftComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 0);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 0);
leftData.right = new FormAttachment(50, 0);
leftComparePlanComposite.setLayoutData(leftData);
rightComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 0);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(50, 0);
rightData.right = new FormAttachment(100, 0);
rightComparePlanComposite.setLayoutData(rightData);
queryPlanCompareSashForm.setWeights(new int[] { 100, 0 });
}
use of com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite in project cubrid-manager by CUBRID.
the class QueryPlanCompositeWithHistory method newPlanTab.
/**
* create a new plan tab
*
* @param uid int
* @return planTabItem
*/
private PlanTabItem newPlanTab(int uid) {
final PlanTabItem planTabItem = new PlanTabItem(plansTabFolder, SWT.NONE);
planTabItem.setText(uid > 0 ? Messages.qedit_plan + uid : Messages.qedit_plan);
DatabaseInfo databaseInfo = (editor == null || editor.getSelectedDatabase() == null) ? null : editor.getSelectedDatabase().getDatabaseInfo();
QueryPlanComposite queryPlanComposite = new QueryPlanComposite(plansTabFolder, SWT.None, null, databaseInfo, true);
setupContextMenu(queryPlanComposite.getPlanTree());
CommonUITool.registerCopyPasteContextMenu(queryPlanComposite.getPlanRaw(), false);
planTabItem.setQueryPlanComposite(queryPlanComposite);
planTabItem.setControl(queryPlanComposite);
return planTabItem;
}
use of com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite in project cubrid-manager by CUBRID.
the class TuneModeResultComposite method createQueryCompareTab.
private void createQueryCompareTab(Composite comp) {
Composite composite = new Composite(comp, SWT.None);
composite.setLayout(new GridLayout());
composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
Composite topComposite = new Composite(composite, SWT.None);
topComposite.setLayout(new FormLayout());
topComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 25));
Composite leftTopComposite = new Composite(topComposite, SWT.None);
FormData leftTopData = new FormData();
leftTopData.top = new FormAttachment(0, 0);
leftTopData.bottom = new FormAttachment(100, 0);
leftTopData.left = new FormAttachment(0, 0);
leftTopData.right = new FormAttachment(50, 0);
leftTopComposite.setLayoutData(leftTopData);
leftTopComposite.setLayout(new GridLayout(1, false));
Composite rightTopComposite = new Composite(topComposite, SWT.None);
FormData rightTopData = new FormData();
rightTopData.top = new FormAttachment(0, 0);
rightTopData.bottom = new FormAttachment(100, 0);
rightTopData.left = new FormAttachment(50, 0);
rightTopData.right = new FormAttachment(100, 0);
rightTopComposite.setLayoutData(rightTopData);
rightTopComposite.setLayout(new GridLayout(4, false));
useLeft = new Button(leftTopComposite, SWT.CHECK);
useLeft.setText(Messages.lblTuneModeOrgPlan);
useLeft.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
useLeft.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (useLeft.getSelection()) {
useRight.setSelection(false);
} else {
useRight.setSelection(true);
}
}
});
useLeft.setSelection(true);
useRight = new Button(rightTopComposite, SWT.CHECK);
useRight.setText(Messages.lblTuneModeNewPlan);
useRight.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
useRight.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (useRight.getSelection()) {
useLeft.setSelection(false);
} else {
useLeft.setSelection(true);
}
}
});
useRight.setSelection(false);
ToolBar leftToolBar = new ToolBar(rightTopComposite, SWT.None);
leftToolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
Composite folderPlaceComposite = new Composite(rightTopComposite, SWT.None);
folderPlaceComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
ToolBar rightToolBar = new ToolBar(rightTopComposite, SWT.None);
rightToolBar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
sqlModeItem = new ToolItem(rightToolBar, SWT.CHECK);
sqlModeItem.setImage(CommonUIPlugin.getImage("icons/queryplan/sql_compare.gif"));
sqlModeItem.setToolTipText(Messages.itemTooltipQuery);
//sqlModeItem.setText(Messages.lblTuneCompareQueryBtn);
sqlModeItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_SQL);
}
});
textModelItem = new ToolItem(rightToolBar, SWT.CHECK);
textModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_raw.png"));
textModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
//textModelItem.setText(Messages.lblPlanRawBtn);
textModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_TEXT);
}
});
treeModelItem = new ToolItem(rightToolBar, SWT.CHECK);
treeModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_tree.png"));
treeModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
//treeModelItem.setText(Messages.lblPlanTreeBtn);
treeModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_TREE);
}
});
graphModelItem = new ToolItem(rightToolBar, SWT.CHECK);
graphModelItem.setImage(CommonUIPlugin.getImage("icons/queryeditor/qe_explain_mode_graph.png"));
graphModelItem.setToolTipText(Messages.tooltip_qedit_explain_display_mode);
//graphModelItem.setText(Messages.lblPlanGraph);
graphModelItem.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
widgetDefaultSelected(e);
}
public void widgetDefaultSelected(SelectionEvent e) {
updateCompareDisplayModel(DISPLAY_GRAPH);
}
});
Composite tablesComposite = new Composite(composite, SWT.None);
tablesComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, 60));
tablesComposite.setLayout(new FormLayout());
/*Left composite*/
Composite leftTableComposite = new Composite(tablesComposite, SWT.BORDER);
leftTableComposite.setLayout(new GridLayout());
FormData leftTableData = new FormData();
leftTableData.top = new FormAttachment(0, 0);
leftTableData.bottom = new FormAttachment(100, 0);
leftTableData.left = new FormAttachment(0, 0);
leftTableData.right = new FormAttachment(50, -2);
leftTableComposite.setLayoutData(leftTableData);
/*Right composite*/
Composite rightTableComposite = new Composite(tablesComposite, SWT.BORDER);
rightTableComposite.setLayout(new GridLayout());
FormData rightTabelData = new FormData();
rightTabelData.top = new FormAttachment(0, 0);
rightTabelData.bottom = new FormAttachment(100, 0);
rightTabelData.left = new FormAttachment(50, 2);
rightTabelData.right = new FormAttachment(100, 0);
rightTableComposite.setLayoutData(rightTabelData);
compareLeftTableViewer = new TableViewer(leftTableComposite, SWT.FULL_SELECTION);
compareLeftTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareLeftTableViewer.getTable().setHeaderVisible(true);
compareLeftTableViewer.getTable().setLinesVisible(false);
compareLeftTableViewer.setContentProvider(new TuneModeResultContentProvider());
compareLeftTableViewer.setLabelProvider(new TuneModeResultLabelProvider(compareLeftTableViewer, false));
TableColumn fetchColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
fetchColumnLeft.setText(Messages.columnFetches);
fetchColumnLeft.setWidth(60);
TableColumn dirtyColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
dirtyColumnLeft.setText(Messages.columnDirties);
dirtyColumnLeft.setWidth(60);
TableColumn ioReadColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
ioReadColumnLeft.setText(Messages.columnIORead);
ioReadColumnLeft.setWidth(80);
TableColumn ioWriteColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
ioWriteColumnLeft.setText(Messages.columnIOWrite);
ioWriteColumnLeft.setWidth(80);
TableColumn costColumnLeft = new TableColumn(compareLeftTableViewer.getTable(), SWT.None);
costColumnLeft.setText(Messages.columnCost);
costColumnLeft.setWidth(60);
compareRightTableViewer = new TableViewer(rightTableComposite, SWT.FULL_SELECTION);
compareRightTableViewer.getTable().setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareRightTableViewer.getTable().setHeaderVisible(true);
compareRightTableViewer.getTable().setLinesVisible(false);
compareRightTableViewer.setContentProvider(new TuneModeResultContentProvider());
compareRightTableViewer.setLabelProvider(new TuneModeResultLabelProvider(compareRightTableViewer, false));
TableColumn fetchColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
fetchColumnRight.setText(Messages.columnFetches);
fetchColumnRight.setWidth(60);
TableColumn dirtyColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
dirtyColumnRight.setText(Messages.columnDirties);
dirtyColumnRight.setWidth(60);
TableColumn ioReadColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
ioReadColumnRight.setText(Messages.columnIORead);
ioReadColumnRight.setWidth(80);
TableColumn ioWriteColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
ioWriteColumnRight.setText(Messages.columnIOWrite);
ioWriteColumnRight.setWidth(80);
TableColumn costColumnRight = new TableColumn(compareRightTableViewer.getTable(), SWT.None);
costColumnRight.setText(Messages.columnCost);
costColumnRight.setWidth(60);
queryPlanCompareSashForm = new SashForm(composite, SWT.VERTICAL);
queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
queryPlanCompareSashForm.setBackground(SASH_COLOR);
queryPlanCompareSashForm.setLayout(new GridLayout());
queryPlanCompareSashForm.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
queryPlanCompareSashForm.setSashWidth(0);
Composite textMergeComposite = new Composite(queryPlanCompareSashForm, SWT.None);
textMergeComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
textMergeComposite.setLayout(new FillLayout());
textMergeConfig = new CompareConfiguration();
textMergeConfig.setProperty(CompareConfiguration.SHOW_PSEUDO_CONFLICTS, Boolean.FALSE);
textMergeConfig.setProperty(CompareConfiguration.IGNORE_WHITESPACE, Boolean.TRUE);
textMergeConfig.setLeftEditable(false);
textMergeConfig.setRightEditable(false);
textMergeViewer = new TextMergeViewer(textMergeComposite, SWT.BORDER, textMergeConfig);
DiffNode queryDiffNode = new DiffNode(null, Differencer.CHANGE, null, new TextCompareInput(""), new TextCompareInput(""));
textMergeViewer.setInput(queryDiffNode);
Composite compareQueryPlanComposite = new Composite(queryPlanCompareSashForm, SWT.None);
compareQueryPlanComposite.setLayoutData(CommonUITool.createGridData(GridData.FILL_BOTH, 1, 1, -1, -1));
compareQueryPlanComposite.setLayout(new FormLayout());
leftComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
FormData leftData = new FormData();
leftData.top = new FormAttachment(0, 0);
leftData.bottom = new FormAttachment(100, 0);
leftData.left = new FormAttachment(0, 0);
leftData.right = new FormAttachment(50, 0);
leftComparePlanComposite.setLayoutData(leftData);
rightComparePlanComposite = new QueryPlanComposite(compareQueryPlanComposite, SWT.BORDER, null, databaseInfo);
FormData rightData = new FormData();
rightData.top = new FormAttachment(0, 0);
rightData.bottom = new FormAttachment(100, 0);
rightData.left = new FormAttachment(50, 0);
rightData.right = new FormAttachment(100, 0);
rightComparePlanComposite.setLayoutData(rightData);
queryPlanCompareSashForm.setWeights(new int[] { 100, 0 });
updateCompareDisplayModel(DISPLAY_TREE);
}
Aggregations