Search in sources :

Example 1 with GarbageAction

use of org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageAction 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

Action (org.eclipse.jface.action.Action)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1 DisposeEvent (org.eclipse.swt.events.DisposeEvent)1 DisposeListener (org.eclipse.swt.events.DisposeListener)1 Cursor (org.eclipse.swt.graphics.Cursor)1 Button (org.eclipse.swt.widgets.Button)1 ToolBar (org.eclipse.swt.widgets.ToolBar)1 GarbageAction (org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageAction)1 LoadChartAction (org.talend.designer.runtime.visualization.internal.ui.properties.timeline.LoadChartAction)1