Search in sources :

Example 91 with DisposeListener

use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.

the class JobVMArgumentsComposite method getButtonBoxControl.

/**
     * Returns this field editor's button box containing the Add, Remove, Up, and Down button.
     * 
     * @param parent the parent control
     * @return the button box
     */
public Composite getButtonBoxControl(Composite parent) {
    if (buttonBox == null) {
        buttonBox = new Composite(parent, SWT.NULL);
        GridLayout layout = new GridLayout();
        layout.marginWidth = 0;
        buttonBox.setLayout(layout);
        GridData layoutData = new GridData();
        layoutData.widthHint = 100;
        layoutData.minimumWidth = 100;
        buttonBox.setLayoutData(layoutData);
        createButtons(buttonBox);
        buttonBox.addDisposeListener(new DisposeListener() {

            @Override
            public void widgetDisposed(DisposeEvent event) {
                addButton = null;
                removeButton = null;
                upButton = null;
                downButton = null;
                buttonBox = null;
            }
        });
    }
    selectionChanged();
    return buttonBox;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) GridData(org.eclipse.swt.layout.GridData) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Example 92 with DisposeListener

use of org.eclipse.swt.events.DisposeListener 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)

Example 93 with DisposeListener

use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.

the class TimelineSection method addSectionActions.

/**
     * Adds the menus on expandable composite.
     * 
     * @param expandableComposite The expandable composite
     * @param actions The actions
     */
private static void addSectionActions(ExpandableComposite expandableComposite, List<Action> actions) {
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(expandableComposite);
    // 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) {
        toolBarManager.add(action);
    }
    toolBarManager.update(true);
    expandableComposite.setTextClient(toolbar);
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) GarbageCollectorAction(org.talend.designer.runtime.visualization.internal.ui.properties.memory.GarbageCollectorAction) Action(org.eclipse.jface.action.Action) RefreshAction(org.talend.designer.runtime.visualization.internal.actions.RefreshAction) ToolBar(org.eclipse.swt.widgets.ToolBar) Cursor(org.eclipse.swt.graphics.Cursor) DisposeEvent(org.eclipse.swt.events.DisposeEvent) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager)

Example 94 with DisposeListener

use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.

the class TabFolderEditors method addListenersToInputButtons.

/**
     * DOC amaumont Comment method "addListenersToInputButtons".
     */
private void addListenersToInputButtons() {
    MetadataToolbarEditorView toolBar = inputMetaEditor.getToolBar();
    inputToolBarButtons = toolBar.getButtons();
    beforeCommandListenerForInputButtons = new IExtendedButtonListener() {

        @Override
        public void handleEvent(ExtendedButtonEvent event) {
        // TableViewerCreator tableViewerCreator =
        // mapperManager.getUiManager().getCurrentSelectedInputTableView()
        // .getTableViewerCreatorForColumns();
        // if (tableViewerCreator != null) {
        // tableViewerCreator.applyActivatedCellEditor();
        // }
        }
    };
    for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
        extendedPushButton.addListener(beforeCommandListenerForInputButtons, true);
    }
    this.addDisposeListener(new DisposeListener() {

        /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.DisposeListener#widgetDisposed(org.eclipse.swt.events.DisposeEvent)
             */
        @Override
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true);
            }
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) ExtendedPushButton(org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton) MetadataToolbarEditorView(org.talend.core.ui.metadata.editor.MetadataToolbarEditorView) IExtendedButtonListener(org.talend.commons.ui.swt.extended.table.IExtendedButtonListener) DisposeEvent(org.eclipse.swt.events.DisposeEvent) ExtendedButtonEvent(org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent)

Example 95 with DisposeListener

use of org.eclipse.swt.events.DisposeListener in project tdi-studio-se by Talend.

the class Schema2XMLLinker method initColors.

/**
     * amaumont Comment method "initColors".
     * 
     * @param display
     */
private void initColors(Display display) {
    // selectedLoopLinkColor = new Color(display, 255, 131, 255);
    // light blue
    selectedLoopLinkColor = new Color(display, 110, 168, 255);
    selectedRelativeLinkColor = new Color(display, 110, 168, 0);
    getSource().addDisposeListener(new DisposeListener() {

        @Override
        public void widgetDisposed(DisposeEvent e) {
            selectedLoopLinkColor.dispose();
            selectedRelativeLinkColor.dispose();
            getSource().removeDisposeListener(this);
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Color(org.eclipse.swt.graphics.Color) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Aggregations

DisposeListener (org.eclipse.swt.events.DisposeListener)118 DisposeEvent (org.eclipse.swt.events.DisposeEvent)117 SelectionEvent (org.eclipse.swt.events.SelectionEvent)41 GridData (org.eclipse.swt.layout.GridData)38 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)33 Image (org.eclipse.swt.graphics.Image)29 Cursor (org.eclipse.swt.graphics.Cursor)26 ToolBar (org.eclipse.swt.widgets.ToolBar)25 ToolItem (org.eclipse.swt.widgets.ToolItem)23 Composite (org.eclipse.swt.widgets.Composite)19 Color (org.eclipse.swt.graphics.Color)17 GridLayout (org.eclipse.swt.layout.GridLayout)17 Point (org.eclipse.swt.graphics.Point)16 ControlEvent (org.eclipse.swt.events.ControlEvent)11 SelectionListener (org.eclipse.swt.events.SelectionListener)10 Control (org.eclipse.swt.widgets.Control)10 TextLayout (org.eclipse.swt.graphics.TextLayout)9 Listener (org.eclipse.swt.widgets.Listener)9 ControlListener (org.eclipse.swt.events.ControlListener)8 MouseEvent (org.eclipse.swt.events.MouseEvent)8