From 6858d6bd125b4576ca12436aec2da8de4452efaf Mon Sep 17 00:00:00 2001 From: bchilds Date: Thu, 14 Jun 2007 13:54:25 +0000 Subject: minor enhancements for actions. --- .../jsdt/web/ui/actions/AddJavaDocStubAction.java | 48 +++++++--- .../web/ui/actions/AddJavaDocStubOperation.java | 100 +++++++++++++++++++-- .../jsdt/web/ui/actions/SimpleJSDTActionProxy.java | 22 +++++ .../web/ui/views/contentoutline/JsJfaceNode.java | 3 +- 4 files changed, 156 insertions(+), 17 deletions(-) (limited to 'bundles/org.eclipse.wst.jsdt.web.ui/src/org') diff --git a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubAction.java b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubAction.java index 374d0a12fe..02afc249ab 100644 --- a/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubAction.java +++ b/bundles/org.eclipse.wst.jsdt.web.ui/src/org/eclipse/wst/jsdt/web/ui/actions/AddJavaDocStubAction.java @@ -4,20 +4,26 @@ package org.eclipse.wst.jsdt.web.ui.actions; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; import org.eclipse.jface.action.IAction; import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IObjectActionDelegate; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.PlatformUI; import org.eclipse.wst.jsdt.core.ICompilationUnit; +import org.eclipse.wst.jsdt.core.IJavaElement; import org.eclipse.wst.jsdt.core.IMember; import org.eclipse.wst.jsdt.internal.ui.actions.ActionMessages; import org.eclipse.wst.jsdt.internal.ui.actions.WorkbenchRunnableAdapter; import org.eclipse.wst.jsdt.internal.ui.util.ExceptionHandler; +import org.eclipse.wst.jsdt.web.ui.views.contentoutline.JsJfaceNode; /** * @author childsb @@ -26,30 +32,50 @@ import org.eclipse.wst.jsdt.internal.ui.util.ExceptionHandler; public class AddJavaDocStubAction implements IObjectActionDelegate{ private IWorkbenchPart targetPart; + private ISelection selection; public void setActivePart(IAction action, IWorkbenchPart targetPart) { this.targetPart = targetPart; } public void run(IAction action) { - // TODO Auto-generated method stub - System.out.println("Unimplemented method:AddJavaDocStubAction.run"); + + IJavaElement[] elements = JsElementActionProxy.getJsElementsFromSelection(selection); + if(elements==null || elements.length<1) return; + + IJavaElement parent = elements[0].getParent(); + /* find the cu */ + while(parent!=null && !(parent instanceof ICompilationUnit)); + + + + if(parent!=null) { + ArrayList members = new ArrayList(); + for(int i = 0;i