01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * 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.teststep;
14:
15: import java.util.ArrayList;
16: import java.util.List;
17:
18: import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
19: import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepFactory;
20: import com.eviware.soapui.impl.wsdl.teststeps.registry.WsdlTestStepRegistry;
21: import com.eviware.soapui.support.action.SoapUIActionMapping;
22: import com.eviware.soapui.support.action.support.DefaultActionMapping;
23: import com.eviware.soapui.support.action.support.DefaultSoapUIActionGroup;
24:
25: /**
26: * SoapUIAction group for dynamically creating the "Insert TestStep" popup menu
27: *
28: * @author ole.matzura
29: */
30:
31: public class WsdlTestStepInsertStepSoapUIActionGroup extends
32: DefaultSoapUIActionGroup<WsdlTestStep> {
33: public WsdlTestStepInsertStepSoapUIActionGroup(String id,
34: String name) {
35: super (id, name);
36: }
37:
38: public List<SoapUIActionMapping<WsdlTestStep>> getActionMappings(
39: WsdlTestStep modelItem) {
40: List<SoapUIActionMapping<WsdlTestStep>> actions = new ArrayList<SoapUIActionMapping<WsdlTestStep>>();
41:
42: WsdlTestStepRegistry registry = WsdlTestStepRegistry
43: .getInstance();
44: WsdlTestStepFactory[] factories = (WsdlTestStepFactory[]) registry
45: .getFactories();
46:
47: for (int c = 0; c < factories.length; c++) {
48: WsdlTestStepFactory factory = factories[c];
49: if (factory.canCreate()) {
50: DefaultActionMapping<WsdlTestStep> actionMapping = new DefaultActionMapping<WsdlTestStep>(
51: InsertWsdlTestStepAction.SOAPUI_ACTION_ID,
52: null, factory.getTestStepIconPath(), false,
53: factory);
54:
55: actionMapping.setName(factory.getTestStepName());
56: actionMapping.setDescription(factory
57: .getTestStepDescription());
58:
59: actions.add(actionMapping);
60: }
61: }
62:
63: return actions;
64: }
65: }
|