KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > ui > actions > DetailOptionsAction


1 /*******************************************************************************
2  * Copyright (c) 2004, 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 implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.debug.ui.actions;
12
13 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin;
14 import org.eclipse.jdt.internal.debug.ui.JavaDetailFormattersPreferencePage;
15 import org.eclipse.jface.action.IAction;
16 import org.eclipse.jface.preference.IPreferenceNode;
17 import org.eclipse.jface.preference.PreferenceDialog;
18 import org.eclipse.jface.preference.PreferenceManager;
19 import org.eclipse.jface.preference.PreferenceNode;
20 import org.eclipse.jface.viewers.ISelection;
21 import org.eclipse.jface.window.Window;
22 import org.eclipse.swt.custom.BusyIndicator;
23 import org.eclipse.ui.IViewActionDelegate;
24 import org.eclipse.ui.IViewPart;
25
26 /**
27  * Action which opens the Java Detail Formatters preference page.
28  */

29 public class DetailOptionsAction implements IViewActionDelegate {
30
31     /* (non-Javadoc)
32      * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
33      */

34     public void init(IViewPart view) {
35     }
36
37     /* (non-Javadoc)
38      * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
39      */

40     public void run(IAction action) {
41         final IPreferenceNode targetNode = new PreferenceNode("org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage", new JavaDetailFormattersPreferencePage()); //$NON-NLS-1$
42

43         PreferenceManager manager = new PreferenceManager();
44         manager.addToRoot(targetNode);
45         final PreferenceDialog dialog = new PreferenceDialog(JDIDebugUIPlugin.getActiveWorkbenchShell(), manager);
46         final boolean [] result = new boolean[] { false };
47         BusyIndicator.showWhile(JDIDebugUIPlugin.getStandardDisplay(), new Runnable JavaDoc() {
48             public void run() {
49                 dialog.create();
50                 dialog.setMessage(targetNode.getLabelText());
51                 result[0]= (dialog.open() == Window.OK);
52             }
53         });
54     }
55
56     /* (non-Javadoc)
57      * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
58      */

59     public void selectionChanged(IAction action, ISelection selection) {
60     }
61     
62 }
63
Popular Tags