KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > ui > internal > samples > ShowTargetPlatformAction


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.ui.internal.samples;
12
13 import org.eclipse.jface.action.Action;
14 import org.eclipse.jface.preference.IPreferenceNode;
15 import org.eclipse.jface.preference.PreferenceDialog;
16 import org.eclipse.jface.preference.PreferenceManager;
17 import org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferenceNode;
18 import org.eclipse.swt.custom.BusyIndicator;
19 import org.eclipse.swt.widgets.Display;
20 import org.eclipse.swt.widgets.Shell;
21 import org.eclipse.ui.PlatformUI;
22
23 public class ShowTargetPlatformAction extends Action {
24     
25     // Bring up Target Platform prefrences page
26
public void run() {
27         final IPreferenceNode targetNode = new TargetPlatformPreferenceNode();
28         PreferenceManager manager = new PreferenceManager();
29         manager.addToRoot(targetNode);
30         Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
31         final PreferenceDialog dialog = new PreferenceDialog(shell, manager);
32         BusyIndicator.showWhile(Display.getCurrent(), new Runnable JavaDoc() {
33             public void run() {
34                 dialog.create();
35                 dialog.setMessage(targetNode.getLabelText());
36                 dialog.open();
37             }
38         });
39     }
40     
41 }
42
Popular Tags