1 11 package org.eclipse.jdt.internal.ui.javadocexport; 12 13 import org.eclipse.core.resources.IFile; 14 15 import org.eclipse.swt.widgets.Shell; 16 17 import org.eclipse.jface.action.IAction; 18 import org.eclipse.jface.viewers.ISelection; 19 import org.eclipse.jface.viewers.IStructuredSelection; 20 21 import org.eclipse.ui.IObjectActionDelegate; 22 import org.eclipse.ui.IWorkbenchPart; 23 24 public class CreateJavadocActionDelegate implements IObjectActionDelegate { 25 26 private ISelection fCurrentSelection; 27 private Shell fCurrentShell; 28 29 32 public void setActivePart(IAction action, IWorkbenchPart targetPart) { 33 fCurrentShell= targetPart.getSite().getShell(); 34 } 35 36 39 public void run(IAction action) { 40 if (fCurrentSelection instanceof IStructuredSelection) { 41 IStructuredSelection structuredSelection= (IStructuredSelection) fCurrentSelection; 42 Object first= structuredSelection.getFirstElement(); 43 if (first instanceof IFile) { 44 JavadocWizard wizard= new JavadocWizard((IFile) first); 45 JavadocWizard.openJavadocWizard(wizard, fCurrentShell, structuredSelection); 46 } 47 } 48 } 49 50 53 public void selectionChanged(IAction action, ISelection selection) { 54 fCurrentSelection= selection; 55 } 56 57 } 58 | Popular Tags |