1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.actions;
14
15 import com.eviware.soapui.SoapUI;
16 import com.eviware.soapui.impl.WorkspaceImpl;
17 import com.eviware.soapui.impl.wsdl.WsdlProject;
18 import com.eviware.soapui.support.UISupport;
19 import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
20
21 /***
22 * Actions for importing an existing soapui-project file into the current workspace
23 *
24 * @author Ole.Matzura
25 */
26
27 public class ImportRemoteWsdlProjectAction extends AbstractSoapUIAction<WorkspaceImpl>
28 {
29 public static final String SOAPUI_ACTION_ID = "ImportRemoteWsdlProjectAction";
30
31 public ImportRemoteWsdlProjectAction()
32 {
33 super( "Import Remote Project", "Imports a remote project into this workspace" );
34 }
35
36 public void perform( WorkspaceImpl workspace, Object param )
37 {
38 ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
39 Thread.currentThread().setContextClassLoader( SoapUI.class.getClassLoader() );
40
41 try
42 {
43 String url = UISupport.prompt( "Specify remote URL to project file", "Import Remote Project", "" );
44 if( url != null )
45 {
46 WsdlProject project = (WsdlProject) workspace.importRemoteProject(url);
47 if( project != null )
48 UISupport.select(project);
49 }
50 }
51 catch (Exception ex)
52 {
53 UISupport.showErrorMessage( ex );
54 }
55 finally
56 {
57 Thread.currentThread().setContextClassLoader( contextClassLoader );
58 }
59 }
60 }