Search in sources :

Example 91 with ToolItem

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

the class EditorToolBar method CreateSelectItem.

private void CreateSelectItem(Composite parent) {
    ToolItem selectDbItem = new ToolItem(this, SWT.SEPARATOR);
    Composite comp = createDropDownComp();
    selectDbItem.setControl(comp);
    selectDbItem.setWidth(SELECTDBLABEL_LENTH + SELECTDBBUTTON_LENTH);
    new ToolItem(this, SWT.SEPARATOR | SWT.VERTICAL);
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 92 with ToolItem

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

the class JobAutoDashboardEditorPart method createBackupPlanInfoTable.

public void createBackupPlanInfoTable(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.RIGHT);
    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) {
            refreshBackupPlan();
        }
    });
    ToolItem createItem = new ToolItem(toolBar, SWT.PUSH);
    createItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
    createItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
    createItem.setEnabled(canAddOrEdit);
    createItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addBackupPlan();
        }
    });
    ToolItem editItem = new ToolItem(toolBar, SWT.PUSH);
    editItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
    editItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    editItem.setEnabled(canAddOrEdit);
    editItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            editBackupPlan();
        }
    });
    ToolItem deleteItem = new ToolItem(toolBar, SWT.PUSH);
    deleteItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
    deleteItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
    deleteItem.setEnabled(canAddOrEdit);
    deleteItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            deleteBackupPlan();
        }
    });
    ToolItem openLogItem = new ToolItem(toolBar, SWT.PUSH);
    openLogItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
    openLogItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            openBackupPlanLog();
        }
    });
    final Composite tableComposite = new Composite(parent, SWT.NONE);
    tableComposite.setLayout(new FillLayout());
    tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    backupPlanInfoTable = new TableViewer(tableComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
    backupPlanInfoTable.getTable().setHeaderVisible(true);
    backupPlanInfoTable.getTable().setLinesVisible(true);
    backupPlanInfoTable.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            editBackupPlan();
        }
    });
    final TableViewerColumn idColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    idColumn.getColumn().setWidth(80);
    idColumn.getColumn().setText(Messages.backupPlanInfoTableIDColumn);
    final TableViewerColumn levelColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    levelColumn.getColumn().setWidth(80);
    levelColumn.getColumn().setText(Messages.backupPlanInfoTableLevelColumn);
    final TableViewerColumn pathColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    pathColumn.getColumn().setWidth(200);
    pathColumn.getColumn().setText(Messages.backupPlanInfoTablePathColumn);
    final TableViewerColumn periodTypeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    periodTypeColumn.getColumn().setWidth(100);
    periodTypeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTypeColumn);
    final TableViewerColumn backupDetailColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    backupDetailColumn.getColumn().setWidth(150);
    backupDetailColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodDetailColumn);
    final TableViewerColumn backupTimeColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    backupTimeColumn.getColumn().setWidth(90);
    backupTimeColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodTimeColumn);
    if (isSupportPeriodicAutoJob) {
        final TableViewerColumn backupIntervalColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
        backupIntervalColumn.getColumn().setWidth(100);
        backupIntervalColumn.getColumn().setText(Messages.backupPlanInfoTablePeriodIntervalColumn);
    }
    final TableViewerColumn onOffLineColumn = new TableViewerColumn(backupPlanInfoTable, SWT.LEFT);
    onOffLineColumn.getColumn().setWidth(100);
    onOffLineColumn.getColumn().setText(Messages.backupPlanInfoTableOnlineOfflineColumn);
    backupPlanInfoTable.setContentProvider(new BackupPlanTableViewerContentProvider());
    backupPlanInfoTable.setLabelProvider(new BackupPlanTableViewerLabelProvider());
    backupPlanInfoTable.getTable().addFocusListener(new FocusAdapter() {

        public void focusGained(FocusEvent event) {
            ActionManager.getInstance().changeFocusProvider(backupPlanInfoTable.getTable());
        }
    });
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    Menu contextMenu = menuManager.createContextMenu(backupPlanInfoTable.getTable());
    backupPlanInfoTable.getTable().setMenu(contextMenu);
    Menu menu = new Menu(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.POP_UP);
    final MenuItem createMenuItem = new MenuItem(menu, SWT.PUSH);
    createMenuItem.setText(Messages.jobAutoInfoDetailPartCreateBackupBtn);
    createMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_add.png"));
    createMenuItem.setEnabled(canAddOrEdit);
    createMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            addBackupPlan();
        }
    });
    final MenuItem editMenuItem = new MenuItem(menu, SWT.PUSH);
    editMenuItem.setText(Messages.jobAutoInfoDetailPartEditBackupBtn);
    editMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_edit.png"));
    editMenuItem.setEnabled(canAddOrEdit);
    editMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            editBackupPlan();
        }
    });
    final MenuItem dropMenuItem = new MenuItem(menu, SWT.PUSH);
    dropMenuItem.setText(Messages.jobAutoInfoDetailPartDeleteBackupBtn);
    dropMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_backup_delete.png"));
    dropMenuItem.setEnabled(canAddOrEdit);
    dropMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            deleteBackupPlan();
        }
    });
    final MenuItem openLogMenuItem = new MenuItem(menu, SWT.PUSH);
    openLogMenuItem.setText(Messages.jobAutoInfoDetailPartOpenBackupLogBtn);
    openLogMenuItem.setImage(CubridManagerUIPlugin.getImage("icons/action/auto_log.png"));
    openLogMenuItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            openBackupPlanLog();
        }
    });
    backupPlanInfoTable.getTable().setMenu(menu);
}
Also used : FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) MenuItem(org.eclipse.swt.widgets.MenuItem) FillLayout(org.eclipse.swt.layout.FillLayout) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) MenuManager(org.eclipse.jface.action.MenuManager) Menu(org.eclipse.swt.widgets.Menu) TableViewer(org.eclipse.jface.viewers.TableViewer) ToolItem(org.eclipse.swt.widgets.ToolItem) TableViewerColumn(org.eclipse.jface.viewers.TableViewerColumn)

Example 93 with ToolItem

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

the class DatabaseDashboardEditor method createButtonComposite.

/**
	 * create button composite
	 *
	 * @param parent
	 */
public void createButtonComposite(Composite parent) {
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    parent.setLayout(layout);
    Composite composite = new Composite(parent, SWT.None);
    layout.marginHeight = 0;
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    infoLable = new Label(composite, SWT.None);
    infoLable.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));
    infoLable.setText(getPartName());
    new Label(composite, SWT.None).setText("    ");
    errMsgLable = new Label(composite, SWT.None);
    errMsgLable.setLayoutData(CommonUITool.createGridData(GridData.FILL_HORIZONTAL, 1, 1, -1, -1));
    ToolBar toolbar = new ToolBar(parent, SWT.RIGHT_TO_LEFT | SWT.WRAP | SWT.FLAT);
    toolbar.setLayoutData(CommonUITool.createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 1, -1, -1));
    settingItem = new ToolItem(toolbar, SWT.PUSH);
    settingItem.setImage(CommonUIPlugin.getImage("/icons/action/settings.png"));
    settingItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
    settingItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent event) {
            boolean useOrNot = GeneralPreference.isUseDatabaseDashboard();
            ShowDashboardDialog dialog = new ShowDashboardDialog(getSite().getShell(), ShowDashboardDialog.TYPE_DB, useOrNot, autoRefreshTime);
            if (dialog.open() == IDialogConstants.OK_ID) {
                autoRefreshTime = dialog.getAutoRefreshSecond();
                useOrNot = dialog.isUseAutoShow();
                GeneralPreference.setUseDatabaseDashboard(useOrNot);
            }
        }
    });
    exportItem = new ToolItem(toolbar, SWT.PUSH);
    exportItem.setImage(CubridManagerUIPlugin.getImage("icons/action/conf_export.png"));
    exportItem.setToolTipText(Messages.databaseDashboardSettingTooltip);
    exportItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            List<Table> exportTableList = new ArrayList<Table>();
            if (CompatibleUtil.isSupportGetCPUAndMemoryInfo(database.getDatabaseInfo())) {
                exportTableList.add(dbInfoTableViewer.getTable());
            }
            exportTableList.add(volumnInfoTableViewer.getTable());
            exportTableList.add(brokerInfoTableViewer.getTable());
            exportTableList.add(lockAndTransactionTable);
            String[] excelSheetNames = { Messages.exportDashboardDBTableTitle, Messages.exportDashboardVolumnTableTitle, Messages.exportDashboardBrokerTableTitle, Messages.exportDashboardLockTableTitle };
            new ExportDashboardDialog(Display.getCurrent().getActiveShell(), exportTableList, database.getDatabaseInfo().getDbName(), excelSheetNames).open();
        }
    });
    new ToolItem(toolbar, SWT.SEPARATOR | SWT.VERTICAL);
    autoRefreshItem = new ToolItem(toolbar, SWT.PUSH);
    autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
    autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
    autoRefreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (autoRefreshData) {
                autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh_disabled.png"));
                autoRefreshItem.setToolTipText(Messages.databaseDashboardStartAutoRefreshTooltip);
                stopAutoRefreshData();
            } else {
                autoRefreshItem.setImage(CubridManagerUIPlugin.getImage("icons/action/refresh.png"));
                autoRefreshItem.setToolTipText(Messages.databaseDashboardStopAutoRefreshTooltip);
                startAutoRefreshData();
            }
            autoRefreshData = !autoRefreshData;
        }
    });
}
Also used : Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) ShowDashboardDialog(com.cubrid.common.ui.common.preference.ShowDashboardDialog) GridLayout(org.eclipse.swt.layout.GridLayout) ExportDashboardDialog(com.cubrid.cubridmanager.ui.cubrid.database.dialog.ExportDashboardDialog) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) BrokerInfoList(com.cubrid.cubridmanager.core.broker.model.BrokerInfoList) ArrayList(java.util.ArrayList) DbSpaceInfoList(com.cubrid.cubridmanager.core.cubrid.dbspace.model.DbSpaceInfoList) List(java.util.List) DbTransactionList(com.cubrid.cubridmanager.core.cubrid.database.model.transaction.DbTransactionList) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 94 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.

the class TalendPaletteViewer method creatToolControl.

/**
     * FIXME ggu
     * 
     * Because the method createControl is final in super calss ScrollingGraphicalViewer,
     * 
     * Then, use the reflection function to move to class TalendPaletteViewerProvider.
     */
// @Override
// public Control createControl(Composite parent) {
// FigureCanvas canvas = new TalendFigureCanvas(parent, getLightweightSystem(), this);
// setControl(canvas);
// installRootFigure(); // change the parent method to "protected".
// return canvas;
// }
/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.gef.ui.parts.ScrollingGraphicalViewer#creatToolControl(org.eclipse.swt.widgets.Composite)
     */
public Control creatToolControl(Composite parent) {
    Composite container = new Composite(parent, SWT.BORDER);
    // GridLayout layout = new GridLayout(3, false);
    GridLayout layout = new GridLayout(2, false);
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginTop = 0;
    layout.marginBottom = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    container.setLayout(layout);
    final Text text = new Text(container, SWT.NONE);
    GridData textGridData = new GridData(SWT.FILL, SWT.CENTER, true, true);
    textGridData.horizontalIndent = 0;
    textGridData.verticalIndent = 0;
    text.setLayoutData(textGridData);
    filters.add(text);
    initFilterTextControl(text);
    ToolBar toolbar = new ToolBar(container, SWT.NONE);
    Color searchButtonForgroundColor = cssStyleSetting.getSearchButtonBackgroundColor();
    if (searchButtonForgroundColor != null) {
        toolbar.setBackground(searchButtonForgroundColor);
    }
    GridLayout toolbarLayout = new GridLayout();
    toolbarLayout.marginLeft = 0;
    toolbarLayout.marginRight = 0;
    toolbarLayout.marginTop = 0;
    toolbarLayout.marginBottom = 0;
    toolbarLayout.marginHeight = 0;
    toolbarLayout.marginWidth = 0;
    toolbar.setLayout(toolbarLayout);
    Image findImage = cssStyleSetting.getSearchButtonImage();
    if (findImage == null) {
        findImage = ImageProvider.getImage(EImage.FIND_ICON);
    }
    ToolItem findItem = new ToolItem(toolbar, SWT.NONE);
    findItem.setImage(findImage);
    findItem.setToolTipText("Search");
    findItem.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            startFiltering(text);
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    // });
    return container;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Color(org.eclipse.swt.graphics.Color) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Text(org.eclipse.swt.widgets.Text) Image(org.eclipse.swt.graphics.Image) EImage(org.talend.commons.ui.runtime.image.EImage) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 95 with ToolItem

use of org.eclipse.swt.widgets.ToolItem in project tdi-studio-se by Talend.

the class OutputDataMapTableView method createFiltersDropDown.

private void createFiltersDropDown() {
    // itemDropDown = new ToolItem(toolBarActions, SWT.PUSH);
    itemDropDown = new ToolItem(toolBarActions, SWT.ARROW);
    //$NON-NLS-1$
    itemDropDown.setToolTipText(Messages.getString("DataMapTableView.buttonTooltip.addFilterRow"));
    itemDropDown.setImage(ImageProviderMapper.getImage(ImageInfo.ADD_FILTER_ICON));
    menu = new Menu(this);
    itemDropDown.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            Rectangle bounds = itemDropDown.getBounds();
            Point point = toolBarActions.toDisplay(bounds.x, bounds.y + bounds.height);
            menu.setLocation(point);
            menu.setVisible(true);
        }
    });
    MenuItem addWhereClauses = new MenuItem(menu, SWT.PUSH);
    //$NON-NLS-1$
    addWhereClauses.setText(Messages.getString("DataMapTableView.buttonTooltip.menu.addWhereClauses"));
    addWhereClauses.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            onFiltersToolItemsSelected(e, extendedTableViewerForFilters.getTableViewerCreator(), FilterTableEntry.WHERE_FILTER);
        }
    });
    MenuItem addOtherClauses = new MenuItem(menu, SWT.PUSH);
    //$NON-NLS-1$
    addOtherClauses.setText(Messages.getString("DataMapTableView.buttonTooltip.menu.addOtherClauses"));
    addOtherClauses.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            onFiltersToolItemsSelected(e, entendedTableViewerForOtherClauses.getTableViewerCreator(), FilterTableEntry.OTHER_FILTER);
        }
    });
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Rectangle(org.eclipse.swt.graphics.Rectangle) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Point(org.eclipse.swt.graphics.Point) ToolItem(org.eclipse.swt.widgets.ToolItem)

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