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

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

Introduction

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

Prototype

@Override
public Object getSelectedPage() 

Source Link

Usage

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

License:Open Source License

/**
 * Method setUser./*from  www.j  a v  a  2 s .  c o m*/
 * 
 * @param aUser
 *            - String
 */
public void setUser(String aUser) {
    //Inner class that runs the command on the UI thread
    class RunSetUser implements Runnable {
        private String user;

        public String getUser() {
            return user;
        }

        public void setUser(String aUser) {
            user = aUser;
        }

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

    //Run the UI job and wait until the command is completely executed before continuing
    RunSetUser setUserJob = new RunSetUser();
    setUserJob.setUser(aUser);
    Display.getDefault().syncExec(setUserJob);
    TestUtils.waitForJobs();
    return;
}

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

License:Open Source License

/**
 * Method getEmail./*from   w  w  w .j a va2s . c  o  m*/
 * 
 * @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./*from  ww w .  j  a  va2 s .co m*/
 * 
 * @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.//from  w w w . j  a  v a2  s.c  om
 * 
 * @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 a  2 s .  c  om*/
 * 
 * @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  ww.j a va2s. c  o 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   ww w  . ja 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  ww .  j  a va2s  .c  om*/
 * 
 * @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 ww . 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.pde.internal.runtime.spy.sections.ActiveHelpSection.java

License:Open Source License

public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
    this.toolkit = toolkit;
    final Shell shell = HandlerUtil.getActiveShell(event);
    Object object = shell.getData();
    if (object == null)
        return;/*from www  . j av a 2s  .  c  o m*/

    StringBuffer helpBuffer = new StringBuffer();
    // process help
    // TODO we need to make this cleaner... help processing is complicated atm
    if (object instanceof PreferenceDialog) {
        PreferenceDialog dialog = (PreferenceDialog) object;
        IPreferencePage page = (IPreferencePage) dialog.getSelectedPage();
        processHelp(page.getControl().getShell(), helpBuffer);
        processChildren(page.getControl(), helpBuffer);
    } else if (object instanceof Dialog) {
        Dialog dialog = (Dialog) object;
        processChildren(dialog.getShell(), helpBuffer);
    } else {
        helpBuffer.append(processControlHelp(event, toolkit));
    }

    if (helpBuffer != null && helpBuffer.length() > 0) {
        Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
        section.setText(PDERuntimeMessages.SpyDialog_activeHelpSection_title);
        section.clientVerticalSpacing = 9;

        FormText text = toolkit.createFormText(section, true);
        section.setClient(text);
        TableWrapData td = new TableWrapData();
        td.align = TableWrapData.FILL;
        td.grabHorizontal = true;
        section.setLayoutData(td);

        Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_CONTEXTID_OBJ);
        text.setImage("contextid", image); //$NON-NLS-1$

        StringBuffer buffer = new StringBuffer();
        buffer.append("<form>"); //$NON-NLS-1$
        buffer.append("<p>"); //$NON-NLS-1$
        buffer.append(PDERuntimeMessages.SpyDialog_activeHelpSection_desc);
        buffer.append("</p>"); //$NON-NLS-1$
        buffer.append(helpBuffer.toString());
        buffer.append("</form>"); //$NON-NLS-1$
        String content = buffer.toString().replaceAll("&", "&amp;"); //$NON-NLS-1$ //$NON-NLS-2$
        text.setText(content, true, false);
    }

}