Author: bfitzpat
Date: 2012-01-09 15:16:29 -0500 (Mon, 09 Jan 2012)
New Revision: 37729
Added:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/RunWSTesterAction.java
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
Log:
JBIDE-10485 - Initial integration on context menu for WSDL files to launch the WS Tester
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties 2012-01-09 19:24:00 UTC (rev
37728)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.properties 2012-01-09 20:16:29 UTC (rev
37729)
@@ -11,4 +11,5 @@
ws_bottom_up.wizard.name = Simple Web Service
ws_bottom_up.wizard.description = Create a Web Service from existing class
jbossws.page.name = JBossWS Runtime
-jaxrs.annotation.category=JAX-RS
\ No newline at end of file
+jaxrs.annotation.category=JAX-RS
+RunWSTesterAction.label = Test in JBoss Web Service Tester
\ No newline at end of file
Modified: trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml
===================================================================
--- trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml 2012-01-09 19:24:00 UTC (rev 37728)
+++ trunk/ws/plugins/org.jboss.tools.ws.ui/plugin.xml 2012-01-09 20:16:29 UTC (rev 37729)
@@ -241,5 +241,20 @@
class="javax.ws.rs.ext.Provider"
name="Provider">
</annotation>
+ </extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.jboss.tools.ws.tester.enablement"
+ nameFilter="*.wsdl"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ class="org.jboss.tools.ws.ui.actions.RunWSTesterAction"
+ id="org.jboss.tools.ws.tester.enablement.action"
+ label="%RunWSTesterAction.label"
+
menubarPath="org.eclipse.wst.ws.ui.webservice.category.popupMenu/popupActions">
+ </action>
+ </objectContribution>
</extension>
</plugin>
Added:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/RunWSTesterAction.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/RunWSTesterAction.java
(rev 0)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/RunWSTesterAction.java 2012-01-09
20:16:29 UTC (rev 37729)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.actions;
+
+import java.net.MalformedURLException;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.ws.ui.JBossWSUIPlugin;
+import org.jboss.tools.ws.ui.views.JAXRSWSTestView2;
+
+/**
+ * Action to fire up the WS Tester from a WSDL in a navigator view
+ * @author bfitzpat
+ *
+ */
+public class RunWSTesterAction implements IObjectActionDelegate {
+
+ private ISelection selection = null;
+
+ public RunWSTesterAction() {
+ // empty
+ }
+
+ @Override
+ public void run(final IAction action) {
+ if (this.selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) this.selection;
+ if (ssel.getFirstElement() instanceof IFile) {
+ IFile wsdlFile = (IFile) ssel.getFirstElement();
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ IWorkbenchPage page = win.getActivePage();
+ String id = JAXRSWSTestView2.ID;
+ try {
+ IViewPart part = page.showView(id);
+ if (part instanceof JAXRSWSTestView2) {
+ JAXRSWSTestView2 testerView = (JAXRSWSTestView2) part;
+ String url = wsdlFile.getRawLocationURI().toURL().toExternalForm();
+ testerView.setWSDLURL(url);
+ }
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ JBossWSUIPlugin.log(e);
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ JBossWSUIPlugin.log(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ @Override
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ // empty
+ }
+
+}
Property changes on:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/actions/RunWSTesterAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2012-01-09
19:24:00 UTC (rev 37728)
+++
trunk/ws/plugins/org.jboss.tools.ws.ui/src/org/jboss/tools/ws/ui/views/JAXRSWSTestView2.java 2012-01-09
20:16:29 UTC (rev 37729)
@@ -193,6 +193,32 @@
*/
public JAXRSWSTestView2() {
}
+
+ public void setWSDLURL( String url ) {
+ this.urlCombo.setText(url);
+ this.methodCombo.setText(JAX_WS);
+ setControlsForWSType(JAX_WS);
+ setControlsForMethodType(methodCombo.getText());
+ setControlsForSelectedURL();
+ }
+
+ public void setJAXRS ( String url, String method ) {
+ this.urlCombo.setText(url);
+ String uCaseMethod = method.toUpperCase();
+ if (uCaseMethod.equalsIgnoreCase(GET))
+ this.methodCombo.setText(GET);
+ else if (uCaseMethod.equalsIgnoreCase(POST))
+ this.methodCombo.setText(POST);
+ else if (uCaseMethod.equalsIgnoreCase(PUT))
+ this.methodCombo.setText(PUT);
+ else if (uCaseMethod.equalsIgnoreCase(DELETE))
+ this.methodCombo.setText(DELETE);
+ else if (uCaseMethod.equalsIgnoreCase(OPTIONS))
+ this.methodCombo.setText(OPTIONS);
+ setControlsForWSType(JAX_RS);
+ setControlsForMethodType(methodCombo.getText());
+ setControlsForSelectedURL();
+ }
private void getImages() {
mImageRegistry = new ImageRegistry();