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.MessageSupport;
19 import com.eviware.soapui.support.UISupport;
20 import com.eviware.soapui.support.action.support.AbstractSoapUIAction;
21
22 /***
23 * Actions for importing an existing remote soapUI project file into the current
24 * workspace
25 *
26 * @author Ole.Matzura
27 */
28
29 public class ImportRemoteWsdlProjectAction extends AbstractSoapUIAction<WorkspaceImpl>
30 {
31 public static final String SOAPUI_ACTION_ID = "ImportRemoteWsdlProjectAction";
32 public static final MessageSupport messages = MessageSupport.getMessages( ImportRemoteWsdlProjectAction.class );
33
34 public ImportRemoteWsdlProjectAction()
35 {
36 super( messages.get( "title" ), messages.get( "description" ) );
37 }
38
39 public void perform( WorkspaceImpl workspace, Object param )
40 {
41 ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
42 Thread.currentThread().setContextClassLoader( SoapUI.class.getClassLoader() );
43
44 try
45 {
46 String url = UISupport.prompt( messages.get( "prompt.text" ), messages.get( "prompt.title" ), "" );
47
48 if( url != null )
49 {
50 WsdlProject project = ( WsdlProject )workspace.importRemoteProject( url );
51 if( project != null )
52 UISupport.select( project );
53 }
54 }
55 catch( Exception ex )
56 {
57 UISupport.showErrorMessage( ex );
58 }
59 finally
60 {
61 Thread.currentThread().setContextClassLoader( contextClassLoader );
62 }
63 }
64 }