KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > views > memory > renderings > TableRenderingPrefAction


1 /*******************************************************************************
2  * Copyright (c) 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
12 package org.eclipse.debug.internal.ui.views.memory.renderings;
13
14 import org.eclipse.debug.internal.ui.DebugUIMessages;
15 import org.eclipse.debug.internal.ui.DebugUIPlugin;
16 import org.eclipse.jface.action.IAction;
17 import org.eclipse.jface.preference.IPreferenceNode;
18 import org.eclipse.jface.preference.IPreferencePage;
19 import org.eclipse.jface.preference.PreferenceDialog;
20 import org.eclipse.jface.preference.PreferenceManager;
21 import org.eclipse.jface.preference.PreferenceNode;
22 import org.eclipse.jface.window.Window;
23 import org.eclipse.swt.custom.BusyIndicator;
24 import org.eclipse.ui.IViewActionDelegate;
25 import org.eclipse.ui.IViewPart;
26 import org.eclipse.ui.actions.ActionDelegate;
27
28 public class TableRenderingPrefAction extends ActionDelegate implements IViewActionDelegate {
29
30     /* (non-Javadoc)
31      * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
32      */

33     public void run(IAction action) {
34         IPreferencePage page = new TableRenderingPreferencePage(DebugUIMessages.TableRenderingPrefAction_0);
35         showPreferencePage("org.eclipse.debug.ui.tableRenderingPreferencepage", page); //$NON-NLS-1$
36
}
37
38     /* (non-Javadoc)
39      * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
40      */

41     public void init(IViewPart view) {
42     }
43     
44     protected void showPreferencePage(String JavaDoc id, IPreferencePage page) {
45         final IPreferenceNode targetNode = new PreferenceNode(id, page);
46         
47         PreferenceManager manager = new PreferenceManager();
48         manager.addToRoot(targetNode);
49         final PreferenceDialog dialog = new PreferenceDialog(DebugUIPlugin.getShell(), manager);
50         final boolean [] result = new boolean[] { false };
51         BusyIndicator.showWhile(DebugUIPlugin.getStandardDisplay(), new Runnable JavaDoc() {
52             public void run() {
53                 dialog.create();
54                 dialog.setMessage(targetNode.getLabelText());
55                 result[0]= (dialog.open() == Window.OK);
56             }
57         });
58     }
59
60 }
61
Popular Tags