Example usage for org.eclipse.jface.preference IPreferencePage performCancel

List of usage examples for org.eclipse.jface.preference IPreferencePage performCancel

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferencePage performCancel.

Prototype

public boolean performCancel();

Source Link

Document

Notifies that the container of this preference page has been canceled.

Usage

From source file:au.gov.ga.earthsci.common.ui.preferences.LazyPreferenceDialog.java

License:Apache License

@Override
protected void cancelPressed() {
    // Inform all pages that we are cancelling
    Iterator<?> nodes = getPreferenceManager().getElements(PreferenceManager.PRE_ORDER).iterator();
    final boolean[] cancelOK = new boolean[] { true };
    while (nodes.hasNext()) {
        final IPreferenceNode node = (IPreferenceNode) nodes.next();
        final IPreferencePage page = getPage(node);
        if (page != null && pagesWithCreatedControls.contains(page)) {
            SafeRunnable.run(new SafeRunnable() {
                @Override/*from w ww .  j  av a2s .co m*/
                public void run() {
                    if (!page.performCancel()) {
                        cancelOK[0] = false;
                    }
                }
            });
            if (!cancelOK[0]) {
                return;
            }
        }
    }

    // Give subclasses the choice to save the state of the preference pages if needed
    handleSave();

    setReturnCode(CANCEL);
    close();
}