Java Code Examples for org.eclipse.swt.widgets.Shell#removeListener()

The following examples show how to use org.eclipse.swt.widgets.Shell#removeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiChoice.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Handle a multichoice event
 *
 * @param event event to handle
 */
private void handleMultiChoiceEvents(final Event event) {
	switch (event.type) {
		case SWT.Dispose:
			if (this.popup != null && !this.popup.isDisposed()) {
				this.popup.dispose();
			}
			final Shell shell = getShell();
			shell.removeListener(SWT.Deactivate, this.listener);
			final Display display = getDisplay();
			display.removeFilter(SWT.FocusIn, this.filter);
			this.popup = null;
			this.arrow = null;
			break;
		case SWT.Move:
			changeVisibilityOfPopupWindow(false);
			break;
		case SWT.Resize:
			if (isDropped()) {
				changeVisibilityOfPopupWindow(false);
			}
			break;
	}

}
 
Example 2
Source File: CalculatorCombo.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void handleMultiChoiceEvent(final Event event) {
	switch (event.type) {
		case SWT.Dispose:
			if (popup != null && !popup.isDisposed()) {
				popup.dispose();
			}
			final Shell shell = getShell();
			shell.removeListener(SWT.Deactivate, listener);
			final Display display = getDisplay();
			display.removeFilter(SWT.FocusIn, filter);
			popup = null;
			arrow = null;
			break;
		case SWT.Move:
			hidePopupWindow(false);
			break;
		case SWT.Resize:
			if (isPopupVisible()) {
				hidePopupWindow(false);
			}
			break;
	}
}
 
Example 3
Source File: BonitaContentProposalAdapter.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
void removeListeners() {
    if (isValid()) {
        proposalTable.removeListener(SWT.FocusOut, this);
        final ScrollBar scrollbar = proposalTable.getVerticalBar();
        if (scrollbar != null) {
            scrollbar.removeListener(SWT.Selection, this);
        }

        getShell().removeListener(SWT.Deactivate, this);
        getShell().removeListener(SWT.Close, this);
    }

    if (control != null && !control.isDisposed()) {

        control.removeListener(SWT.MouseDoubleClick, this);
        control.removeListener(SWT.MouseDown, this);
        control.removeListener(SWT.Dispose, this);
        control.removeListener(SWT.FocusOut, this);

        final Shell controlShell = control.getShell();
        controlShell.removeListener(SWT.Move, this);
        controlShell.removeListener(SWT.Resize, this);
    }
}
 
Example 4
Source File: CustomCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
void comboEvent(Event event) {
	switch (event.type) {
	case SWT.Dispose:
		if (popup != null && !popup.isDisposed()) {
			list.removeListener(SWT.Dispose, listener);
			popup.dispose();
		}
		Shell shell = getShell();
		shell.removeListener(SWT.Deactivate, listener);
		Display display = getDisplay();
		display.removeFilter(SWT.FocusIn, filter);
		popup = null;
		text = null;
		list = null;
		arrow = null;
		break;
	case SWT.FocusIn:
		Control focusControl = getDisplay().getFocusControl();
		if (focusControl == arrow || focusControl == list)
			return;
		if (isDropped()) {
			list.setFocus();
		} else {
			text.setFocus();
		}
		break;
	case SWT.Move:
		dropDown(false);
		break;
	case SWT.Resize:
		internalLayout(false);
		break;
	}
}
 
Example 5
Source File: CTreeCombo.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
void comboEvent(Event event) {
	switch (event.type) {
		case SWT.Dispose:
			if (popup != null && !popup.isDisposed()) {
				tree.removeListener(SWT.Dispose, listener);
				popup.dispose();
			}
			final Shell shell = getShell();
			shell.removeListener(SWT.Deactivate, listener);
			final Display display = getDisplay();
			display.removeFilter(SWT.FocusIn, filter);
			popup = null;
			text = null;
			tree = null;
			arrow = null;
			break;
		case SWT.FocusIn:
			final Control focusControl = getDisplay().getFocusControl();
			if (focusControl == arrow || focusControl == tree) {
				return;
			}
			if (isDropped()) {
				tree.setFocus();
			} else {
				text.setFocus();
			}
			break;
		case SWT.Move:
			dropDown(false);
			break;
		case SWT.Resize:
			internalLayout(false);
			break;
	}
}
 
Example 6
Source File: TableCombo.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handle Combo events
 * @param event
 */
private void comboEvent(Event event) {
	switch (event.type) {
	case SWT.Dispose:
		removeListener(SWT.Dispose, listener);
		notifyListeners(SWT.Dispose, event);
		event.type = SWT.None;

		if (popup != null && !popup.isDisposed()) {
			table.removeListener(SWT.Dispose, listener);
			popup.dispose();
		}
		Shell shell = getShell();
		shell.removeListener(SWT.Deactivate, listener);
		Display display = getDisplay();
		display.removeFilter(SWT.FocusIn, focusFilter);
		popup = null;
		text = null;
		table = null;
		arrow = null;
		selectedImage = null;
		break;
	case SWT.FocusIn:
		Control focusControl = getDisplay().getFocusControl();
		if (focusControl == arrow || focusControl == table)
			return;
		if (isDropped()) {
			table.setFocus();
		} else {
			text.setFocus();
		}
		break;
	case SWT.Move:
		dropDown(false);
		break;
	case SWT.Resize:
		internalLayout(false);
		break;
	}
}
 
Example 7
Source File: TableCombo.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Handle Combo events
 * @param event
 */
private void comboEvent(Event event) {
	switch (event.type) {
	case SWT.Dispose:
		removeListener(SWT.Dispose, listener);
		notifyListeners(SWT.Dispose, event);
		event.type = SWT.None;

		if (popup != null && !popup.isDisposed()) {
			table.removeListener(SWT.Dispose, listener);
			popup.dispose();
		}
		Shell shell = getShell();
		shell.removeListener(SWT.Deactivate, listener);
		Display display = getDisplay();
		display.removeFilter(SWT.FocusIn, focusFilter);
		popup = null;
		text = null;
		table = null;
		arrow = null;
		selectedImage = null;
		break;
	case SWT.FocusIn:
		Control focusControl = getDisplay().getFocusControl();
		if (focusControl == arrow || focusControl == table)
			return;
		if (isDropped()) {
			table.setFocus();
		} else {
			text.setFocus();
		}
		break;
	case SWT.Move:
		dropDown(false);
		break;
	case SWT.Resize:
		internalLayout(false);
		break;
	}
}
 
Example 8
Source File: TableCombo.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Handle Combo events
 * @param event
 */
private void comboEvent(Event event) {
    switch (event.type) {
        case SWT.Dispose:
            removeListener(SWT.Dispose, listener);
            notifyListeners(SWT.Dispose, event);
            event.type = SWT.None;

            if (popup != null && !popup.isDisposed()) {
                table.removeListener(SWT.Dispose, listener);
                popup.dispose();
            }
            Shell shell = getShell();
            shell.removeListener(SWT.Deactivate, listener);
            Display display = getDisplay();
            display.removeFilter(SWT.FocusIn, focusFilter);
            popup = null;
            text = null;
            table = null;
            arrow = null;
            selectedImage = null;
            break;
        case SWT.FocusIn:
            Control focusControl = getDisplay().getFocusControl();
            if (focusControl == arrow || focusControl == table)
                return;
            if (isDropped()) {
                table.setFocus();
            } else {
                text.setFocus();
            }
            break;
        case SWT.Move:
            dropDown(false);
            break;
        case SWT.Resize:
            internalLayout(false);
            break;
    }
}
 
Example 9
Source File: TableCombo.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Handle Combo events
 *
 * @param event
 */
private void comboEvent(final Event event) {
	switch (event.type) {
	case SWT.Dispose:
		removeListener(SWT.Dispose, listener);
		notifyListeners(SWT.Dispose, event);
		event.type = SWT.None;

		if (popup != null && !popup.isDisposed()) {
			if (!table.isDisposed()) {
				table.removeListener(SWT.Dispose, listener);
			}
			popup.dispose();
		}
		final Shell shell = getShell();
		if (!shell.isDisposed()) {
			shell.removeListener(SWT.Deactivate, listener);
		}
		final Display display = getDisplay();
		display.removeFilter(SWT.FocusIn, focusFilter);
		popup = null;
		text = null;
		table = null;
		arrow = null;
		selectedImage = null;
		break;
	case SWT.FocusIn:
		final Control focusControl = getDisplay().getFocusControl();
		if (focusControl == arrow || focusControl == table) {
			return;
		}
		if (!isDropped()) {
			text.setFocus();
		}
		break;
	case SWT.Move:
		dropDown(false);
		break;
	case SWT.Resize:
		internalLayout(false, true);
		break;
	}
}
 
Example 10
Source File: DataItemCombo.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
void comboEvent( Event event )
{
	switch ( event.type )
	{
		case SWT.Dispose :
			removeListener( SWT.Dispose, listener );
			notifyListeners( SWT.Dispose, event );
			event.type = SWT.None;

			if ( popup != null && !popup.isDisposed( ) )
			{
				list.removeListener( SWT.Dispose, listener );
				popup.dispose( );
			}
			Shell shell = getShell( );
			shell.removeListener( SWT.Deactivate, listener );
			Display display = getDisplay( );
			display.removeFilter( SWT.FocusIn, filter );
			popup = null;
			text = null;
			list = null;
			arrow = null;
			_shell = null;
			break;
		case SWT.FocusIn :
			Control focusControl = getDisplay( ).getFocusControl( );
			if ( focusControl == arrow || focusControl == list )
				return;
			if ( isDropped( ) )
			{
				list.setFocus( );
			}
			else
			{
				text.setFocus( );
			}
			break;
		case SWT.Move :
			dropDown( false );
			break;
		case SWT.Resize :
			internalLayout( false );
			break;
	}
}