Search in sources :

Example 41 with ToolItem

use of org.eclipse.swt.widgets.ToolItem 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 });
}
Also used : DatabaseInfo(com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo) CompareConfiguration(org.eclipse.compare.CompareConfiguration) Label(org.eclipse.swt.widgets.Label) DiffNode(org.eclipse.compare.structuremergeviewer.DiffNode) Combo(org.eclipse.swt.widgets.Combo) CTabItem(org.eclipse.swt.custom.CTabItem) TextMergeViewer(org.eclipse.compare.contentmergeviewer.TextMergeViewer) GridLayout(org.eclipse.swt.layout.GridLayout) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextCompareInput(com.cubrid.common.ui.compare.schema.control.TextCompareInput) FormAttachment(org.eclipse.swt.layout.FormAttachment) ToolItem(org.eclipse.swt.widgets.ToolItem) FormLayout(org.eclipse.swt.layout.FormLayout) FormData(org.eclipse.swt.layout.FormData) Composite(org.eclipse.swt.widgets.Composite) QueryPlanComposite(com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite) QueryPlanComposite(com.cubrid.common.ui.query.control.queryplan.QueryPlanComposite) QueryRecord(com.cubrid.common.ui.query.tuner.QueryRecord) FillLayout(org.eclipse.swt.layout.FillLayout) TableColumn(org.eclipse.swt.widgets.TableColumn) SashForm(org.eclipse.swt.custom.SashForm) ToolBar(org.eclipse.swt.widgets.ToolBar) TableViewer(org.eclipse.jface.viewers.TableViewer) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 42 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class MonitorStatisticEditor method createToolBar.

private void createToolBar(Composite parent) {
    toolbarComp = new Composite(parent, SWT.NONE);
    {
        final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
        toolbarComp.setLayoutData(gd);
        GridLayout layout = new GridLayout(2, false);
        toolbarComp.setLayout(layout);
    }
    toolbar = new ToolBar(toolbarComp, SWT.RIGHT);
    toolbar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    changeModeItem = new ToolItem(toolbar, SWT.PUSH);
    changeModeItem.setText(MESSAGE_View_MODE);
    changeModeItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    changeModeItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            isEditMode = !isEditMode;
            updateToolbarAndCharts(isEditMode);
            updateScrolledCompositeHeight();
            scrolledComp.layout();
        }
    });
    //initial
    refreshToolbar(isEditMode);
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 43 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class RecordAction method runWithEvent.

/**
	 * Shifting the recordFlag and return the the interface of Recordable.
	 * 
	 * @param event the SWT event which triggered this action being run
	 */
public void runWithEvent(final Event event) {
    recordFlag = recorder.getRecordFlag();
    recordFlag = !recordFlag;
    recorder.setRecordFlag(recordFlag);
    final Display display = Display.getDefault();
    Runnable runnable = new Runnable() {

        boolean state = false;

        public void run() {
            if (state) {
                ((ToolItem) (event.widget)).setImage(CubridManagerUIPlugin.getImage("icons/monitor/record_bright.png"));
            } else {
                ((ToolItem) (event.widget)).setImage(CubridManagerUIPlugin.getImage("icons/monitor/record_dim.png"));
            }
            state = !state;
            if (recordFlag) {
                display.timerExec(800, this);
            } else {
                display.timerExec(-1, this);
                ((ToolItem) (event.widget)).setImage(CubridManagerUIPlugin.getImage("icons/monitor/prepare_record.png"));
            }
        }
    };
    if (recordFlag) {
        this.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/monitor/record_bright.png"));
        this.setToolTipText(recordTooltip);
        display.timerExec(20, runnable);
    } else {
        this.setImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/monitor/prepare_record.png"));
        this.setToolTipText(prepareTooltip);
    }
}
Also used : ToolItem(org.eclipse.swt.widgets.ToolItem) Display(org.eclipse.swt.widgets.Display)

Example 44 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class MonitorStatisticChart method addToolbar.

private void addToolbar(Composite parent) {
    btnsComp = new Composite(chartGroup, SWT.RESIZE);
    final GridLayout btnsGridLayout = new GridLayout(2, false);
    btnsComp.setLayout(btnsGridLayout);
    btnsComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    btnsComp.setBackground(ResourceManager.getColor(255, 255, 255));
    checkBtn = new Button(btnsComp, SWT.CHECK);
    checkBtn.setText(Messages.btnSelect);
    checkBtn.setBackground(ResourceManager.getColor(255, 255, 255));
    checkBtn.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            isSelected = ((Button) event.widget).getSelection();
        }
    });
    ToolBar toolbar = new ToolBar(btnsComp, SWT.RIGHT);
    toolbar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    toolbar.setBackground(ResourceManager.getColor(255, 255, 255));
    ToolItem showDetailItem = new ToolItem(toolbar, SWT.PUSH);
    showDetailItem.setText(Messages.btnShowDetail);
    showDetailItem.setToolTipText(Messages.ShowDetailTooltip);
    showDetailItem.setImage(CubridManagerUIPlugin.getImage("icons/action/status_execute.png"));
    showDetailItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            if (editor == null) {
                return;
            }
            editor.openDetailView(statisticChartItem, statisticDataList);
        }
    });
    ToolItem editItem = new ToolItem(toolbar, SWT.PUSH);
    editItem.setText(Messages.btnEdit);
    editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    editItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent event) {
            openEditStatisticItemDialog();
        }
    });
    ToolItem deleteItem = new ToolItem(toolbar, SWT.PUSH);
    deleteItem.setText(Messages.btnDelete);
    deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
    deleteItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (!CommonUITool.openConfirmBox(Messages.confirmStatisticChartRemoveWarn)) {
                return;
            }
            editor.removeStatisticItem(statisticChartItem);
        }
    });
    ToolItem refreshItem = new ToolItem(toolbar, SWT.PUSH);
    refreshItem.setText(Messages.btnRefresh);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (editor == null) {
                return;
            }
            editor.refreshChartBySeries(statisticChartItem.getSeries());
        }
    });
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) ChartComposite(org.jfree.experimental.chart.swt.ChartComposite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolBar(org.eclipse.swt.widgets.ToolBar) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 45 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project cubrid-manager by CUBRID.

the class ServiceDashboardEditor method createButtonComposite.

private void createButtonComposite(Composite parent) {
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 2;
    layout.marginWidth = 5;
    parent.setLayout(layout);
    ToolBar toolbar = new ToolBar(parent, SWT.RIGHT | SWT.WRAP | SWT.FLAT);
    toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 1, -1, -1));
    refreshItem = new ToolItem(toolbar, SWT.PUSH);
    refreshItem.setText(Messages.btnRefresh);
    refreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            if (!CommonUITool.openConfirmBox(Messages.msgRefreshConfirm)) {
                return;
            }
            loadAllData();
        }
    });
    ActionManager manager = ActionManager.getInstance();
    final CubridServerImportAction importAction = (CubridServerImportAction) manager.getAction(CubridServerImportAction.ID);
    importItem = new ToolItem(toolbar, SWT.PUSH);
    importItem.setText(Messages.btnImport);
    importItem.setImage(importAction.getImageDescriptor().createImage());
    importItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            importAction.run();
        }
    });
    final CubridServerExportAction exportAction = (CubridServerExportAction) manager.getAction(CubridServerExportAction.ID);
    exportItem = new ToolItem(toolbar, SWT.PUSH);
    exportItem.setText(Messages.btnExport);
    exportItem.setImage(exportAction.getImageDescriptor().createImage());
    exportItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            widgetDefaultSelected(e);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            exportAction.run();
        }
    });
//		infoLabel = new Label(parent, SWT.None);
//		infoLabel.setLayoutData(CommonUITool.createGridData(
//				GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) GridLayout(org.eclipse.swt.layout.GridLayout) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) CubridServerExportAction(com.cubrid.cubridmanager.ui.host.action.CubridServerExportAction) CubridServerImportAction(com.cubrid.cubridmanager.ui.host.action.CubridServerImportAction) ToolItem(org.eclipse.swt.widgets.ToolItem) SelectionListener(org.eclipse.swt.events.SelectionListener)

Aggregations

ToolItem (org.eclipse.swt.widgets.ToolItem)140 ToolBar (org.eclipse.swt.widgets.ToolBar)110 SelectionEvent (org.eclipse.swt.events.SelectionEvent)91 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)81 GridData (org.eclipse.swt.layout.GridData)73 Composite (org.eclipse.swt.widgets.Composite)64 GridLayout (org.eclipse.swt.layout.GridLayout)58 Image (org.eclipse.swt.graphics.Image)36 Label (org.eclipse.swt.widgets.Label)32 Point (org.eclipse.swt.graphics.Point)26 DisposeEvent (org.eclipse.swt.events.DisposeEvent)25 DisposeListener (org.eclipse.swt.events.DisposeListener)24 Cursor (org.eclipse.swt.graphics.Cursor)20 FillLayout (org.eclipse.swt.layout.FillLayout)18 SelectionListener (org.eclipse.swt.events.SelectionListener)17 TableViewer (org.eclipse.jface.viewers.TableViewer)16 Text (org.eclipse.swt.widgets.Text)16 Display (org.eclipse.swt.widgets.Display)15 ArrayList (java.util.ArrayList)14 List (java.util.List)14