Example usage for org.eclipse.jface.preference PreferenceDialog close

List of usage examples for org.eclipse.jface.preference PreferenceDialog close

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferenceDialog close.

Prototype

@Override
    public boolean close() 

Source Link

Usage

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method getEmail./*from  w  ww . j  ava  2s  .  c om*/
 * 
 * @return String
 */
public String getEmail() {
    //Inner class that runs the command on the UI thread
    class RunGetEmail implements Runnable {
        private String email;

        public String getEmail() {
            return email;
        }

        public void setEmail(String aEmail) {
            email = aEmail;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            setEmail(preferences.getEmail());
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RunGetEmail getEmailJob = new RunGetEmail();
    Display.getDefault().syncExec(getEmailJob);
    TestUtils.waitForJobs();
    return getEmailJob.getEmail();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method setEmail./*  w  w w  .  j a v a2 s .c om*/
 * 
 * @param aEmail
 *            - String
 */
public void setEmail(String aEmail) {
    //Inner class that runs the command on the UI thread
    class RunSetEmail implements Runnable {
        private String email;

        public String getEmail() {
            return email;
        }

        public void setEmail(String aEmail) {
            email = aEmail;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.setEmail(getEmail());
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RunSetEmail setEmailJob = new RunSetEmail();
    setEmailJob.setEmail(aEmail);
    Display.getDefault().syncExec(setEmailJob);
    TestUtils.waitForJobs();
    return;
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method addGroupToPreferences.//w  w w.  j a va 2s.  co m
 * 
 * @param aGroupPath
 */
public void addGroupToPreferences(String aGroupPath) {
    //Inner class that runs the command on the UI thread
    class AddGroupPreferences implements Runnable {

        private String group;

        public void setGroup(String aGroupPath) {
            group = aGroupPath;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.addGroupPrefs(group);
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    AddGroupPreferences addGroupPreferencesJob = new AddGroupPreferences();
    addGroupPreferencesJob.setGroup(aGroupPath);
    Display.getDefault().syncExec(addGroupPreferencesJob);
    TestUtils.waitForJobs();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method removeGroupFromPreferences.//from  w  w w .  j  av  a2s.c o  m
 * 
 * @param aGroupPath
 */
public void removeGroupFromPreferences(String aGroupPath) {
    //Inner class that runs the command on the UI thread
    class RemoveGroupPreferences implements Runnable {

        private String group;

        public void setGroup(String aGroupPath) {
            group = aGroupPath;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.removeGroupPrefs(group);
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RemoveGroupPreferences removeGroupPreferencesJob = new RemoveGroupPreferences();
    removeGroupPreferencesJob.setGroup(aGroupPath);
    Display.getDefault().syncExec(removeGroupPreferencesJob);
    TestUtils.waitForJobs();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method addRuleSetToPreferences./*w  w w . j  a v  a  2  s  .co m*/
 * 
 * @param aRuleSetPath
 */
public void addRuleSetToPreferences(String aRuleSetPath) {
    //Inner class that runs the command on the UI thread
    class AddRuleSetPreferences implements Runnable {

        private String ruleSet;

        public void setRuleSet(String aRuleSetPath) {
            ruleSet = aRuleSetPath;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.addRuleSetPrefs(ruleSet);
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    AddRuleSetPreferences addRuleSetPreferencesJob = new AddRuleSetPreferences();
    addRuleSetPreferencesJob.setRuleSet(aRuleSetPath);
    Display.getDefault().syncExec(addRuleSetPreferencesJob);
    TestUtils.waitForJobs();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method removeRuleSetFromPreferences.//from w  ww. j  a  v a2  s.co m
 * 
 * @param aRuleSetPath
 */
public void removeRuleSetFromPreferences(String aRuleSetPath) {
    //Inner class that runs the command on the UI thread
    class RemoveRuleSetPreferences implements Runnable {

        private String ruleSet;

        public void setRuleSet(String aRuleSetPath) {
            ruleSet = aRuleSetPath;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.removeRuleSetPrefs(ruleSet);
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RemoveRuleSetPreferences removeRuleSetPreferencesJob = new RemoveRuleSetPreferences();
    removeRuleSetPreferencesJob.setRuleSet(aRuleSetPath);
    Display.getDefault().syncExec(removeRuleSetPreferencesJob);
    TestUtils.waitForJobs();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method getGlobalPostponedImport.// w  w w .  j  a va 2 s  . c o m
 * 
 * @return boolean
 */
public boolean getGlobalPostponedImport() {
    //Inner class that runs the command on the UI thread
    class RunGetGlobalPostponedImport implements Runnable {
        private boolean fValue;

        public boolean getGlobalPostponedImport() {
            return fValue;
        }

        public void setGlobalPostponedImport(boolean aValue) {
            fValue = aValue;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            setGlobalPostponedImport(preferences.getGlobalPostponedImport());
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RunGetGlobalPostponedImport getGlobalPostponedImportJob = new RunGetGlobalPostponedImport();
    Display.getDefault().syncExec(getGlobalPostponedImportJob);
    TestUtils.waitForJobs();
    return getGlobalPostponedImportJob.getGlobalPostponedImport();
}

From source file:org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestPreferences.java

License:Open Source License

/**
 * Method toggleGlobalPostponedImport Toggles the importing of Global Postponed Anomalies on/off
 *//*  w w w  .  j av a  2  s.c  o  m*/
public void setGlobalPostponedImport(boolean aValue) {
    //Inner class that runs the command on the UI thread
    class RunToggleGlobalPostponedImport implements Runnable {
        private boolean fValue;

        public void setGlobalPostponedImport(boolean aValue) {
            fValue = aValue;
        }

        public void run() {
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, PREFERENCES_PAGE_ID, null,
                    null);
            R4EPreferencePage preferences = (R4EPreferencePage) dialog.getSelectedPage();
            preferences.setGlobalPostponedImport(fValue);
            preferences.performOk();
            dialog.close();
        }
    }
    ;

    //Run the UI job and wait until the command is completely executed before continuing
    RunToggleGlobalPostponedImport toggleGlobalPostponedImportJob = new RunToggleGlobalPostponedImport();
    toggleGlobalPostponedImportJob.setGlobalPostponedImport(aValue);
    Display.getDefault().syncExec(toggleGlobalPostponedImportJob);
    TestUtils.waitForJobs();
}

From source file:org.eclipse.php.internal.ui.actions.ConfigurePHPIncludePathAction.java

License:Open Source License

public void run() {
    if (fProject != null) {
        // TODO retrieve the page id via project nature
        PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(getShell(), fProject, null, null,
                null);/*from   w ww. jav  a 2s .co m*/
        // search for the language specific page
        final List elements = dialog.getPreferenceManager().getElements(PreferenceManager.PRE_ORDER);
        for (Iterator i = elements.iterator(); i.hasNext();) {
            final IPreferenceNode node = (IPreferenceNode) i.next();
            final String nodeId = node.getId();
            if (nodeId.endsWith("IncludepathProperties")) { //$NON-NLS-1$
                // recreate dialog and select page found
                dialog.close();
                dialog = PreferencesUtil.createPropertyDialogOn(getShell(), fProject, nodeId, null, null);
                break;
            }
        }
        dialog.open();
    }
}

From source file:org.eclipse.rap.ui.internal.launch.rwt.tab.BrowserSection.java

License:Open Source License

private void handleBrowserPrefsLink() {
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), BROWSER_PREFERENCE_PAGE,
            null, null);/*from  w  w w. j a  v a 2  s. com*/
    dialog.open();
    dialog.close();
}