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

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

Introduction

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

Prototype

public void setErrorMessage(String newErrorMessage) 

Source Link

Document

Display the given error message.

Usage

From source file:com.vectrace.MercurialEclipse.team.MercurialUtilities.java

License:Open Source License

/**
 * Starts the configuration for Mercurial executable by opening the preference page.
 *//*from  w ww .  j  a  v  a2  s  . c o m*/
public static void configureHgExecutable() {
    final String jobName = Messages
            .getString("MercurialUtilities.openingPreferencesForConfiguringMercurialEclipse");
    SafeUiJob job = new SafeUiJob(jobName) {

        @Override
        protected IStatus runSafe(IProgressMonitor monitor) {
            String pageId = "com.vectrace.MercurialEclipse.prefspage"; //$NON-NLS-1$
            PreferenceDialog dlg = PreferencesUtil.createPreferenceDialogOn(getDisplay().getActiveShell(),
                    pageId, null, null);
            dlg.setErrorMessage(Messages.getString("MercurialUtilities.errorNotConfiguredCorrectly") //$NON-NLS-1$
                    + Messages.getString("MercurialUtilities.runDebugInstall")); //$NON-NLS-1$
            dlg.open();
            return super.runSafe(monitor);
        }

        @Override
        public boolean belongsTo(Object family) {
            return jobName.equals(family);
        }
    };
    IJobManager jobManager = Job.getJobManager();
    jobManager.cancel(jobName);
    Job[] jobs = jobManager.find(jobName);
    if (jobs.length == 0) {
        job.schedule(50);
    }
}