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