01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
11: */
12:
13: package com.eviware.soapui.impl.wsdl.actions.project;
14:
15: import com.eviware.soapui.impl.wsdl.WsdlProject;
16: import com.eviware.soapui.model.iface.Interface;
17: import com.eviware.soapui.support.UISupport;
18: import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
19:
20: /**
21: * Adds a WsdlInterface to a WsdlProject from a URL
22: *
23: * @author Ole.Matzura
24: */
25:
26: public class AddInterfaceActionFromURL extends
27: AbstractSoapUIAction<WsdlProject> {
28: public static final String SOAPUI_ACTION_ID = "AddInterfaceActionFromURL";
29:
30: public AddInterfaceActionFromURL() {
31: super ("Add WSDL from URL",
32: "Adds all interfaces in a specified WSDL URL to the current project");
33: }
34:
35: public void perform(WsdlProject project, Object param) {
36: String url = UISupport.prompt("Enter WSDL URL",
37: "Add WSDL from URL", "");
38: if (url == null)
39: return;
40:
41: try {
42: Boolean createRequests = UISupport.confirmOrCancel(
43: "Create default requests for all operations",
44: "Import WSDL");
45: if (createRequests == null)
46: return;
47:
48: Interface[] ifaces = project
49: .importWsdl(url, createRequests);
50: if (ifaces != null && ifaces.length > 0)
51: UISupport.select(ifaces[0]);
52: } catch (Exception ex) {
53: UISupport.showErrorMessage(ex.getMessage() + ":"
54: + ex.getCause());
55: }
56: }
57: }
|