EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.seff.helper]

COVERAGE SUMMARY FOR SOURCE FILE [ConfigureMinimalSeffCommand.java]

nameclass, %method, %block, %line, %
ConfigureMinimalSeffCommand.java0%   (0/1)0%   (0/4)0%   (0/106)0%   (0/33)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigureMinimalSeffCommand0%   (0/1)0%   (0/4)0%   (0/106)0%   (0/33)
ConfigureMinimalSeffCommand (ConfigureRequest): void 0%   (0/1)0%   (0/10)0%   (0/4)
createControlFlow (StartAction, StopAction, IProgressMonitor): CommandResult 0%   (0/1)0%   (0/34)0%   (0/11)
createSEFFAction (IElementType, IProgressMonitor): CommandResult 0%   (0/1)0%   (0/28)0%   (0/9)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/34)0%   (0/9)

1package de.uka.ipd.sdq.pcm.gmf.seff.helper;
2 
3import org.eclipse.core.commands.ExecutionException;
4import org.eclipse.core.runtime.IAdaptable;
5import org.eclipse.core.runtime.IProgressMonitor;
6import org.eclipse.gmf.runtime.common.core.command.CommandResult;
7import org.eclipse.gmf.runtime.common.core.util.Log;
8import org.eclipse.gmf.runtime.emf.type.core.IElementType;
9import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
10import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
11import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
12import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
13import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
14import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
15 
16import de.uka.ipd.sdq.pcm.gmf.seff.providers.PalladioComponentModelElementTypes;
17import de.uka.ipd.sdq.pcm.seff.SeffPackage;
18import de.uka.ipd.sdq.pcm.seff.StartAction;
19import de.uka.ipd.sdq.pcm.seff.StopAction;
20 
21public class ConfigureMinimalSeffCommand  extends ConfigureElementCommand {
22 
23        private ConfigureRequest myRequest = null;
24        
25        public ConfigureMinimalSeffCommand(ConfigureRequest request) {
26                super(request);
27                myRequest = request;
28        }
29 
30        @Override
31        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
32                        IAdaptable info) throws ExecutionException {
33                StartAction startAction = null;
34                StopAction stopAction = null;
35                
36                CommandResult commandResult = createSEFFAction(PalladioComponentModelElementTypes.StartAction_2001,monitor);
37        if (!isOK(commandResult))
38        {
39                return CommandResult.newErrorCommandResult("Create StartAction for the new SEFF failed!");
40        }
41        startAction = (StartAction) commandResult.getReturnValue();
42                commandResult = createSEFFAction(PalladioComponentModelElementTypes.StopAction_2002,monitor);
43        if (!isOK(commandResult))
44        {
45                return CommandResult.newErrorCommandResult("Create StopAction for the new SEFF failed!");
46        }
47        stopAction = (StopAction) commandResult.getReturnValue();
48        // Removed due to recent CanonicalEditPolicy Bug in GMF
49        //commandResult = createControlFlow(startAction, stopAction, monitor);
50        //if (!isOK(commandResult))
51        //{
52        //        return CommandResult.newErrorCommandResult("Create ControlFlow for the new SEFF failed!");
53        //}
54                return CommandResult.newOKCommandResult();
55        }
56 
57        private CommandResult createControlFlow(StartAction startAction,
58                        StopAction stopAction, IProgressMonitor monitor) {
59                SetRequest setReq = new SetRequest(startAction, SeffPackage.eINSTANCE
60                                .getAbstractAction_Successor_AbstractAction(), stopAction);
61        SetValueCommand createControlFlowCommand = new SetValueCommand(setReq);
62        try {
63                        createControlFlowCommand.execute(monitor, null);
64                } catch (ExecutionException e) {
65            Log.error(SEFFHelperPlugin.getDefault(),
66                            -1, e
67                        .getLocalizedMessage());
68            return CommandResult.newErrorCommandResult(e.getLocalizedMessage());
69                }
70        CommandResult commandResult = createControlFlowCommand.getCommandResult();
71        return commandResult;
72        }
73 
74        private CommandResult createSEFFAction(IElementType typeId, IProgressMonitor monitor)
75                        throws ExecutionException {
76                CreateElementRequest startRequest = new CreateElementRequest(
77                                myRequest.getElementToConfigure(), 
78                                typeId, 
79                                SeffPackage.eINSTANCE.getResourceDemandingBehaviour_Steps_Behaviour()
80                                );
81                startRequest.setLabel("Create Action");
82                CreateElementCommand createStartCommand = new CreateElementCommand(startRequest);
83        createStartCommand.execute(monitor, null);
84        CommandResult commandResult = createStartCommand.getCommandResult();
85                return commandResult;
86        }
87}

[all classes][de.uka.ipd.sdq.pcm.gmf.seff.helper]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov