Search in sources :

Example 86 with ToolBar

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

the class ViewDashboardEditorPart method createPartControl.

public void createPartControl(Composite parent) {
    parent.setLayout(new GridLayout(1, false));
    ToolBar toolBar = new ToolBar(parent, SWT.LEFT_TO_RIGHT | SWT.FLAT);
    toolBar.setLayoutData(CommonUITool.createGridData(1, 1, -1, -1));
    ToolItem refreshItem = new ToolItem(toolBar, SWT.PUSH);
    refreshItem.setText(Messages.tablesDetailInfoPartRefreshBtn);
    refreshItem.setImage(CommonUIPlugin.getImage("icons/action/refresh.png"));
    refreshItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            refresh();
        }
    });
    new ToolItem(toolBar, SWT.SEPARATOR);
    ToolItem addViewItem = new ToolItem(toolBar, SWT.NONE);
    addViewItem.setText(Messages.viewDetailInfoPartTableCreateViewBtn);
    addViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_add.png"));
    addViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            addView();
        }
    });
    ToolItem editViewItem = new ToolItem(toolBar, SWT.NONE);
    editViewItem.setText(Messages.viewDetailInfoPartTableEditViewBtn);
    editViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_edit.png"));
    editViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            editView();
        }
    });
    ToolItem dropViewItem = new ToolItem(toolBar, SWT.NONE);
    dropViewItem.setText(Messages.viewDetailInfoPartTableDropViewBtn);
    dropViewItem.setImage(CommonUIPlugin.getImage("icons/action/schema_view_delete.png"));
    dropViewItem.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(final SelectionEvent event) {
            dropView();
        }
    });
    createViewsDetailInfoTable(parent);
    createTabFolder(parent);
    this.setInputs();
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ToolBar(org.eclipse.swt.widgets.ToolBar) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ToolItem(org.eclipse.swt.widgets.ToolItem)

Example 87 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 88 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 89 with ToolBar

use of org.eclipse.swt.widgets.ToolBar 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 90 with ToolBar

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

the class RuntimeGraphcsComposite method addSectionActions.

private static void addSectionActions(ExpandableComposite expandableComposite, List<Action> actions) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(expandableComposite);
    Button button = new Button(expandableComposite, SWT.PUSH);
    //$NON-NLS-1$
    button.setText("Trigger GC");
    button.setVisible(false);
    // set cursor
    final Cursor cursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
    toolbar.setCursor(cursor);
    toolbar.addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            if (!cursor.isDisposed()) {
                cursor.dispose();
            }
        }
    });
    // add menus
    for (Action action : actions) {
        if (action instanceof GarbageAction) {
            toolBarManager.add(action);
        }
    }
    toolBarManager.update(true);
    expandableComposite.setTextClient(button);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) LoadChartAction(org.talend.designer.runtime.visualization.internal.ui.properties.timeline.LoadChartAction) GarbageAction(org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageAction) Action(org.eclipse.jface.action.Action) Button(org.eclipse.swt.widgets.Button) GarbageAction(org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageAction) ToolBar(org.eclipse.swt.widgets.ToolBar) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Aggregations

ToolBar (org.eclipse.swt.widgets.ToolBar)127 ToolItem (org.eclipse.swt.widgets.ToolItem)110 SelectionEvent (org.eclipse.swt.events.SelectionEvent)82 GridData (org.eclipse.swt.layout.GridData)81 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)74 GridLayout (org.eclipse.swt.layout.GridLayout)68 Composite (org.eclipse.swt.widgets.Composite)67 Image (org.eclipse.swt.graphics.Image)35 Label (org.eclipse.swt.widgets.Label)34 DisposeEvent (org.eclipse.swt.events.DisposeEvent)27 DisposeListener (org.eclipse.swt.events.DisposeListener)26 Point (org.eclipse.swt.graphics.Point)24 Cursor (org.eclipse.swt.graphics.Cursor)22 TableViewer (org.eclipse.jface.viewers.TableViewer)18 FillLayout (org.eclipse.swt.layout.FillLayout)18 Button (org.eclipse.swt.widgets.Button)17 Text (org.eclipse.swt.widgets.Text)17 ArrayList (java.util.ArrayList)14 SashForm (org.eclipse.swt.custom.SashForm)14 Combo (org.eclipse.swt.widgets.Combo)14