KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > debug > internal > ui > importexport > breakpoints > ExportBreakpoints


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 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.importexport.breakpoints;
13
14 import org.eclipse.debug.core.DebugException;
15 import org.eclipse.debug.core.DebugPlugin;
16 import org.eclipse.debug.internal.ui.DebugUIPlugin;
17 import org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate;
18 import org.eclipse.debug.ui.IDebugUIConstants;
19 import org.eclipse.jface.action.IAction;
20 import org.eclipse.jface.viewers.ISelection;
21 import org.eclipse.jface.viewers.IStructuredSelection;
22 import org.eclipse.jface.wizard.WizardDialog;
23 import org.eclipse.ui.IViewPart;
24
25 /**
26  * <p>
27  * This class provides the aciton event for both the context menu in breakpoints view
28  * and the drop down menu inn the breakpoints view.
29  * </p>
30  * <p>
31  * The action simply calls the wizard to export breakpoints.
32  * </p>
33  * @see WizardExportBreakpoints
34  * @see WizardExportBreakpointsPage
35  *
36  * @since 3.2
37  */

38 public class ExportBreakpoints extends AbstractDebugActionDelegate {
39
40     /**
41      * This method actually performs the execution of the action event
42      *
43      * @param action IAction the action
44      */

45     public void run(IAction action) {
46         IViewPart fViewpart = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage().findView(IDebugUIConstants.ID_BREAKPOINT_VIEW);
47         WizardExportBreakpoints wiz = new WizardExportBreakpoints();
48         wiz.init(DebugUIPlugin.getDefault().getWorkbench(), (IStructuredSelection)fViewpart.getViewSite().getSelectionProvider().getSelection());
49         WizardDialog wizdialog = new WizardDialog(DebugUIPlugin.getShell(), wiz);
50         wizdialog.setBlockOnOpen(true);
51         wizdialog.open();
52     }
53     
54     /* (non-Javadoc)
55      * @see org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate#update(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
56      */

57     protected void update(IAction action, ISelection s) {
58         getAction().setEnabled(DebugPlugin.getDefault().getBreakpointManager().hasBreakpoints());
59     }
60
61     /* (non-Javadoc)
62      * @see org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate#doAction(java.lang.Object)
63      */

64     protected void doAction(Object JavaDoc element) throws DebugException {}
65 }
66
Popular Tags