View Javadoc

1   /*
2    *  soapUI, copyright (C) 2006 eviware.com 
3    *
4    *  soapUI is free software; you can redistribute it and/or modify it under the 
5    *  terms of the GNU Lesser General Public License as published by the Free Software Foundation; 
6    *  either version 2.1 of the License, or (at your option) any later version.
7    *
8    *  soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 
9    *  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 java.awt.event.ActionEvent;
16  
17  import javax.swing.JFileChooser;
18  
19  import com.eviware.soapui.impl.wsdl.WsdlProject;
20  import com.eviware.soapui.impl.wsdl.actions.iface.AbstractSwingAction;
21  import com.eviware.soapui.support.SoapUIException;
22  import com.eviware.soapui.support.UISupport;
23  
24  public class ReloadProjectAction extends AbstractSwingAction<WsdlProject>
25  {
26  	public ReloadProjectAction(WsdlProject project)
27  	{
28  		super( "Reload", "Reloads this project from file", project );
29  	}
30  	
31  	@Override
32  	public void actionPerformed( ActionEvent arg0, WsdlProject project )
33  	{
34  		JFileChooser fileChooser = new JFileChooser( project.getPath() );
35  		if( fileChooser.showOpenDialog( UISupport.getMainFrame()) == JFileChooser.APPROVE_OPTION )
36  		{
37  			try
38  			{
39  				project.reload( fileChooser.getSelectedFile());
40  			}
41  			catch( SoapUIException ex )
42  			{
43  				UISupport.showErrorMessage( ex );
44  				ex.printStackTrace();
45  			}
46  		}
47  	}
48  }