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.jdt.internal.ui.actions;
11:
12: import org.eclipse.swt.widgets.Shell;
13:
14: import org.eclipse.jface.action.IAction;
15: import org.eclipse.jface.viewers.ISelection;
16: import org.eclipse.jface.viewers.IStructuredSelection;
17: import org.eclipse.jface.viewers.StructuredSelection;
18:
19: import org.eclipse.ui.IWorkbenchWindow;
20: import org.eclipse.ui.IWorkbenchWindowActionDelegate;
21:
22: import org.eclipse.jdt.internal.ui.javadocexport.JavadocWizard;
23:
24: public class GenerateJavadocAction implements
25: IWorkbenchWindowActionDelegate {
26:
27: private ISelection fSelection;
28: private Shell fCurrentShell;
29:
30: public void dispose() {
31: }
32:
33: public void init(IWorkbenchWindow window) {
34: fCurrentShell = window.getShell();
35: }
36:
37: public void run(IAction action) {
38: JavadocWizard wizard = new JavadocWizard();
39: IStructuredSelection selection = null;
40: if (fSelection instanceof IStructuredSelection) {
41: selection = (IStructuredSelection) fSelection;
42: } else {
43: selection = new StructuredSelection();
44: }
45: JavadocWizard.openJavadocWizard(wizard, fCurrentShell,
46: selection);
47: }
48:
49: public void selectionChanged(IAction action, ISelection selection) {
50: fSelection = selection;
51: }
52: }
|