View Javadoc

    1   /*
    2    *  soapUI, copyright (C) 2004-2007 eviware.com
    3    *
    4    *  soapUI is free software; you can redistribute it and/or modify it under the
    5    *  terms of version 2.1 of the GNU Lesser General Public License as published by
    6    *  the Free Software Foundation.
    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 com.eviware.soapui.SoapUI;
    16  import com.eviware.soapui.impl.wsdl.WsdlProject;
    17  import com.eviware.soapui.support.action.SoapUIActionGroup;
    18  import com.eviware.soapui.support.action.support.AbstractSoapUIActionGroup;
    19  import com.eviware.soapui.support.action.support.SoapUIActionMappingList;
    20
    21  /***
    22   * SoapUIActionGroup for WsdlProjects, returns different actions depending on if the project is
    23   * disabled or not.
    24   *
    25   * @author ole.matzura
    26   */
    27
    28  public class WsdlProjectSoapUIActionGroup extends AbstractSoapUIActionGroup<WsdlProject>
    29  {
    30  	public WsdlProjectSoapUIActionGroup( String id, String name )
    31  	{
    32  		super( id, name );
    33  	}
    34
    35  	public SoapUIActionMappingList<WsdlProject> getActionMappings( WsdlProject project )
    36  	{
    37  		if( project.isDisabled() )
    38  		{
    39  			SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup( "DisabledWsdlProjectActions" );
    40  			return actionGroup.getActionMappings( project );
    41  		}
    42  		else if( !project.isOpen() )
    43  		{
    44  			SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup( "ClosedWsdlProjectActions" );
    45  			return actionGroup.getActionMappings( project );
    46  		}
    47  		else
    48  		{
    49  			SoapUIActionGroup<WsdlProject> actionGroup = SoapUI.getActionRegistry().getActionGroup( "EnabledWsdlProjectActions" );
    50  			SoapUIActionMappingList<WsdlProject> mappings = actionGroup.getActionMappings( project );
    51
    52  			mappings.getMapping( SaveProjectAction.SOAPUI_ACTION_ID ).setEnabled( !project.isRemote() && project.getPath() != null );
    53
    54  			return mappings;
    55  		}
    56  	}
    57  }