Search in sources :

Example 81 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)

Example 82 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() {

        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)
             */
        public void widgetDisposed(DisposeEvent e) {
            for (ExtendedPushButton extendedPushButton : inputToolBarButtons) {
                extendedPushButton.removeListener(beforeCommandListenerForInputButtons, true);
            }
        }
    });
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) TableViewerCreator(org.talend.commons.ui.swt.tableviewer.TableViewerCreator) 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 83 with DisposeListener

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

the class RadioFieldEditor method getChangeControl.

@Override
protected Button getChangeControl(Composite parent) {
    if (radio == null) {
        radio = new Button(parent, SWT.RADIO | SWT.LEFT);
        radio.setFont(parent.getFont());
        radio.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                boolean isSelected = radio.getSelection();
                valueChanged(wasSelected, isSelected);
                wasSelected = isSelected;
            }
        });
        radio.addDisposeListener(new DisposeListener() {

            public void widgetDisposed(DisposeEvent event) {
                radio = null;
            }
        });
    } else {
        checkParent(radio, parent);
    }
    return radio;
}
Also used : DisposeListener(org.eclipse.swt.events.DisposeListener) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DisposeEvent(org.eclipse.swt.events.DisposeEvent)

Example 84 with DisposeListener

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

the class HL7Tree2SchemaLinker method initColors.

private void initColors(Display display) {
    // selectedLoopLinkColor = new Color(display, 255, 131, 0);
    selectedRelativeLinkColor = new Color(display, 110, 168, 255);
    getTree().addDisposeListener(new DisposeListener() {

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

Example 85 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)

Aggregations

DisposeEvent (org.eclipse.swt.events.DisposeEvent)95 DisposeListener (org.eclipse.swt.events.DisposeListener)95 SelectionEvent (org.eclipse.swt.events.SelectionEvent)36 GridData (org.eclipse.swt.layout.GridData)35 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)32 Image (org.eclipse.swt.graphics.Image)28 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)17 Color (org.eclipse.swt.graphics.Color)14 GridLayout (org.eclipse.swt.layout.GridLayout)13 Point (org.eclipse.swt.graphics.Point)12 TextLayout (org.eclipse.swt.graphics.TextLayout)9 FocusEvent (org.eclipse.swt.events.FocusEvent)6 FocusListener (org.eclipse.swt.events.FocusListener)6 SelectionListener (org.eclipse.swt.events.SelectionListener)6 Rectangle (org.eclipse.swt.graphics.Rectangle)6 FillLayout (org.eclipse.swt.layout.FillLayout)6 Label (org.eclipse.swt.widgets.Label)6