01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.samples;
11:
12: import org.eclipse.jface.action.Action;
13: import org.eclipse.jface.preference.IPreferenceNode;
14: import org.eclipse.jface.preference.PreferenceDialog;
15: import org.eclipse.jface.preference.PreferenceManager;
16: import org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferenceNode;
17: import org.eclipse.swt.custom.BusyIndicator;
18: import org.eclipse.swt.widgets.Display;
19: import org.eclipse.swt.widgets.Shell;
20: import org.eclipse.ui.PlatformUI;
21:
22: public class ShowTargetPlatformAction extends Action {
23:
24: // Bring up Target Platform prefrences page
25: public void run() {
26: final IPreferenceNode targetNode = new TargetPlatformPreferenceNode();
27: PreferenceManager manager = new PreferenceManager();
28: manager.addToRoot(targetNode);
29: Shell shell = PlatformUI.getWorkbench()
30: .getActiveWorkbenchWindow().getShell();
31: final PreferenceDialog dialog = new PreferenceDialog(shell,
32: manager);
33: BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
34: public void run() {
35: dialog.create();
36: dialog.setMessage(targetNode.getLabelText());
37: dialog.open();
38: }
39: });
40: }
41:
42: }
|