Search in sources :

Example 1 with TabContextMenuManager

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();
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CTabItem(org.eclipse.swt.custom.CTabItem) TabContextMenuManager(com.cubrid.common.ui.spi.util.TabContextMenuManager)

Example 2 with TabContextMenuManager

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());
}
Also used : CTabFolder(org.eclipse.swt.custom.CTabFolder) Table(org.eclipse.swt.widgets.Table) MouseEvent(org.eclipse.swt.events.MouseEvent) TableItem(org.eclipse.swt.widgets.TableItem) TableColumn(org.eclipse.swt.widgets.TableColumn) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) GridData(org.eclipse.swt.layout.GridData) StructQueryPlan(com.cubrid.common.core.queryplan.StructQueryPlan) TabContextMenuManager(com.cubrid.common.ui.spi.util.TabContextMenuManager)

Aggregations

TabContextMenuManager (com.cubrid.common.ui.spi.util.TabContextMenuManager)2 CTabFolder (org.eclipse.swt.custom.CTabFolder)2 GridData (org.eclipse.swt.layout.GridData)2 StructQueryPlan (com.cubrid.common.core.queryplan.StructQueryPlan)1 CTabItem (org.eclipse.swt.custom.CTabItem)1 SashForm (org.eclipse.swt.custom.SashForm)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 MouseListener (org.eclipse.swt.events.MouseListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Table (org.eclipse.swt.widgets.Table)1 TableColumn (org.eclipse.swt.widgets.TableColumn)1 TableItem (org.eclipse.swt.widgets.TableItem)1