Package org.nodeclipse.common.preferences

Source Code of org.nodeclipse.common.preferences.CommonDialogs

package org.nodeclipse.common.preferences;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;

/**
* Dialogs used in .enide.maven, .enide.gradle
* @author Paul Verest, Pushkar Gupte
*/
public class CommonDialogs {

 
  public static void showPreferencesDialog(final String preferencesPage, final String message) {
    Display.getDefault().syncExec(new Runnable() {
      public void run() {
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();

        MessageDialog dialog = new MessageDialog(shell, "Nodeclipse", null, message,
            MessageDialog.ERROR, new String[] { "Open Prefrences ...", "Cancel" }, 0);
        int result = dialog.open();
        if (result == 0) {
          PreferenceDialog pref = PreferencesUtil.createPreferenceDialogOn(shell,
              preferencesPage, null, null); //+
          if (pref != null)
            pref.open();
        }
      }
    });
  }
 
 
}
TOP

Related Classes of org.nodeclipse.common.preferences.CommonDialogs

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.