Java Code Examples for org.eclipse.swt.widgets.Table#isDisposed()

The following examples show how to use org.eclipse.swt.widgets.Table#isDisposed() . 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: PopulationInspectView.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
void recreateViewer() {
	if (viewer == null) { return; }
	final Table table = viewer.getTable();
	if (table.isDisposed()) { return; }
	table.dispose();
	createViewer(getParentComposite());
	getParentComposite().layout(true);
}
 
Example 2
Source File: GamlSearchField.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Checks if the text or shell has focus. If not, closes the shell.
 *
 * @param table
 *            the shell's table
 * @param text
 *            the search text field
 */
protected void checkFocusLost(final Table table, final Text text) {
	if (!shell.isDisposed() && !table.isDisposed() && !text.isDisposed()) {
		if (table.getDisplay().getActiveShell() == table.getShell()) {
			// If the user selects the trim shell, leave focus on the text
			// so shell stays open
			text.setFocus();
			return;
		}
		if (!shell.isFocusControl() && !table.isFocusControl() && !text.isFocusControl()) {
			quickAccessContents.doClose();
		}
	}
}
 
Example 3
Source File: OfflineActionTarget.java    From Pydev with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void verifyKey(VerifyEvent event) {

    if (!event.doit)
        return;

    if (event.character == 0) {

        switch (event.keyCode) {

            case SWT.ARROW_DOWN:
                //special case: 
                //if there's a key dialog with a table shown, set its focus when down is pressed
                synchronized (lock) {
                    KeyAssistDialog tempKeyAssistDialog = this.keyAssistDialog;
                    if (tempKeyAssistDialog != null) {
                        Table completionsTable = this.keyAssistDialog.getCompletionsTable();
                        if (completionsTable != null && !completionsTable.isDisposed()) {
                            completionsTable.setFocus();
                            completionsTable.setSelection(0);
                            event.doit = false;
                            break;
                        }
                    }
                }
                // ALT, CTRL, ARROW_LEFT, ARROW_RIGHT == leave
            case SWT.ARROW_LEFT:
            case SWT.ARROW_RIGHT:
            case SWT.HOME:
            case SWT.END:
            case SWT.PAGE_DOWN:
            case SWT.PAGE_UP:
            case SWT.ARROW_UP:
                leave();
                break;

        }

        // event.character != 0
    } else {

        switch (event.character) {

        // ESC = quit
            case 0x1B:
                leave();
                event.doit = false;
                break;

            //CR = exec and quit
            case 0x0D:
                boolean executed = doExec();
                event.doit = false;
                if (!executed) {
                    return; //we don't want to update the status
                }
                break;

            // backspace    and delete
            case 0x08:
            case 0x7F:
                removeLastCharSearch();
                event.doit = false;
                break;

            default:
                if (event.stateMask == 0 || event.stateMask == SWT.SHIFT || event.stateMask == (SWT.ALT | SWT.CTRL)) { // SWT.ALT | SWT.CTRL covers AltGr (see bug 43049)
                    event.doit = false;
                    if (addCharSearch(event.character)) {
                        //ok, triggered some automatic action (does not need enter)
                        executed = doExec();
                        if (!executed) {
                            return; //we don't want to update the status
                        }

                    }
                }
                break;
        }
    }
    updateStatus();
}