1 11 package org.eclipse.pde.internal.ui.wizards.imports; 12 13 import org.eclipse.jface.action.Action; 14 import org.eclipse.jface.preference.*; 15 import org.eclipse.jface.preference.IPreferenceNode; 16 import org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferenceNode; 17 import org.eclipse.swt.custom.BusyIndicator; 18 import org.eclipse.swt.widgets.Shell; 19 import org.eclipse.ui.PlatformUI; 20 21 25 public class ShowTargetPlatformAction extends Action { 26 public void run() { 27 IPreferenceNode targetNode = new TargetPlatformPreferenceNode(); 28 boolean result = showPreferencePage(targetNode); 29 notifyResult(result); 30 } 31 private boolean showPreferencePage(final IPreferenceNode targetNode) { 32 PreferenceManager manager = new PreferenceManager(); 33 manager.addToRoot(targetNode); 34 Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); 35 final PreferenceDialog dialog = 36 new PreferenceDialog(shell, manager); 37 final boolean[] result = new boolean[] { false }; 38 BusyIndicator.showWhile(shell.getDisplay(), new Runnable () { 39 public void run() { 40 dialog.create(); 41 dialog.setMessage(targetNode.getLabelText()); 42 if (dialog.open() == PreferenceDialog.OK) 43 result[0] = true; 44 } 45 }); 46 return result[0]; 47 } 48 } | Popular Tags |