1 11 package org.eclipse.jdt.internal.ui.preferences; 12 13 import org.eclipse.swt.custom.BusyIndicator; 14 import org.eclipse.swt.widgets.Shell; 15 16 import org.eclipse.jface.preference.IPreferenceNode; 17 import org.eclipse.jface.preference.IPreferencePage; 18 import org.eclipse.jface.preference.PreferenceDialog; 19 import org.eclipse.jface.preference.PreferenceManager; 20 import org.eclipse.jface.preference.PreferenceNode; 21 import org.eclipse.jface.window.Window; 22 23 26 public class PreferencePageSupport { 27 30 private PreferencePageSupport() { 31 super(); 32 } 33 34 42 public static boolean showPreferencePage(Shell shell, String id, IPreferencePage page) { 43 final IPreferenceNode targetNode = new PreferenceNode(id, page); 44 45 PreferenceManager manager = new PreferenceManager(); 46 manager.addToRoot(targetNode); 47 final PreferenceDialog dialog = new PreferenceDialog(shell, manager); 48 final boolean [] result = new boolean[] { false }; 49 BusyIndicator.showWhile(shell.getDisplay(), new Runnable () { 50 public void run() { 51 dialog.create(); 52 dialog.setMessage(targetNode.getLabelText()); 53 result[0]= (dialog.open() == Window.OK); 54 } 55 }); 56 return result[0]; 57 } 58 } 59 | Popular Tags |