use of com.cubrid.common.ui.spi.util.TabContextMenuManager in project cubrid-manager by CUBRID.
the class QueryEditorPart method createCombinedQueryEditorCTabFolder.
/**
* create editor CTabFolder all sql editor tab will add to this
*/
public void createCombinedQueryEditorCTabFolder() {
combinedQueryEditortabFolder = new CTabFolder(topComposite, SWT.TOP);
combinedQueryEditortabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
combinedQueryEditortabFolder.setUnselectedImageVisible(true);
combinedQueryEditortabFolder.setUnselectedCloseVisible(false);
combinedQueryEditortabFolder.setBorderVisible(true);
combinedQueryEditortabFolder.setSimple(false);
combinedQueryEditortabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
combinedQueryEditortabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
combinedQueryEditortabFolder.setMinimizeVisible(false);
combinedQueryEditortabFolder.setMaximizeVisible(false);
combinedQueryEditortabFolder.setTabHeight(22);
combinedQueryEditortabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CTabItem item = combinedQueryEditortabFolder.getSelection();
if (item instanceof SubQueryEditorTabItem) {
SubQueryEditorTabItem queryResultTabItem = (SubQueryEditorTabItem) item;
combinedQueryComposite = queryResultTabItem.getControl();
combinedQueryComposite.refreshEditorComposite();
InfoWindowManager.getInstance().updateContent(QueryEditorPart.this);
}
}
});
TabContextMenuManager ctxmenu = new TabContextMenuManager(combinedQueryEditortabFolder);
ctxmenu.createContextMenu();
//add a default SQL Tab item
addEditorTab();
}
use of com.cubrid.common.ui.spi.util.TabContextMenuManager in project cubrid-manager by CUBRID.
the class QueryPlanCompositeWithHistory method initialize.
/**
* Initializing a Plan Tab
*/
private void initialize() {
createPlanToolbar();
//create the plan tab folder and history sash
plansHistorySash = new SashForm(this, SWT.HORIZONTAL);
plansHistorySash.setLayout(new GridLayout(2, true));
plansHistorySash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//create left plan tab folder
plansTabFolder = new CTabFolder(plansHistorySash, SWT.BOTTOM | SWT.CLOSE);
plansTabFolder.setSimple(false);
plansTabFolder.setUnselectedImageVisible(true);
plansTabFolder.setUnselectedCloseVisible(true);
plansTabFolder.setSelectionBackground(CombinedQueryEditorComposite.BACK_COLOR);
plansTabFolder.setSelectionForeground(ResourceManager.getColor(SWT.COLOR_BLACK));
plansTabFolder.setLayout(new GridLayout(1, true));
plansTabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
TabContextMenuManager tabContextMenuManager = new TabContextMenuManager(plansTabFolder);
tabContextMenuManager.createContextMenu();
//create the right plan history table
planHistoryTable = new Table(plansHistorySash, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
planHistoryTable.setLayout(new GridLayout(1, true));
planHistoryTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
planHistoryTable.setHeaderVisible(true);
planHistoryTable.setLinesVisible(true);
planHistoryTable.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent event) {
int selectionIndex = planHistoryTable.getSelectionIndex();
if (selectionIndex < 0) {
return;
}
TableItem tableItem = planHistoryTable.getItem(planHistoryTable.getSelectionIndex());
if (tableItem == null) {
return;
}
int uid = Integer.valueOf(tableItem.getText(0));
StructQueryPlan sq = planHistoryList.get(uid - 1);
PlanTabItem tabItem = findPlanTab(uid);
if (tabItem == null) {
tabItem = newPlanTab(uid);
}
plansTabFolder.setSelection(tabItem);
printPlan(tabItem, sq);
}
public void mouseDown(MouseEvent event) {
}
public void mouseUp(MouseEvent event) {
}
});
int i = 0;
planHistoryTblCols[i] = new TableColumn(planHistoryTable, SWT.RIGHT);
// No
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col1);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(20);
addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "NUMBER");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
// Date
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col2);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(100);
addStringSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "STRING");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.RIGHT);
// Cost
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col4);
planHistoryTblCols[i].setMoveable(true);
planHistoryTblCols[i].setWidth(90);
addNumberSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "NUMBER");
planHistoryTblCols[++i] = new TableColumn(planHistoryTable, SWT.LEFT);
// Cost
planHistoryTblCols[i].setText(Messages.qedit_plan_history_col3);
planHistoryTblCols[i].setMoveable(false);
planHistoryTblCols[i].setWidth(90);
addStringSorter(planHistoryTable, planHistoryTblCols[i]);
sortType.put(planHistoryTblCols[i], "STRING");
sashPlanWeight = new int[] { 80, 20 };
plansHistorySash.setWeights(sashPlanWeight);
newPlanTab(1);
plansTabFolder.setSelection(0);
hideHistoryPane();
refreshToolbarStatus(QueryOptions.getQueryPlanDisplayType());
}
Aggregations