EMMA Coverage Report (generated Sun Feb 05 10:43:15 CET 2012)
[all classes][de.uka.ipd.sdq.pcm.gmf.usage.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 (Start, Stop, 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.usage.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.usage.providers.PalladioComponentModelElementTypes;
17import de.uka.ipd.sdq.pcm.usagemodel.Start;
18import de.uka.ipd.sdq.pcm.usagemodel.Stop;
19import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage;
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                Start start = null;
34                Stop stop = null;
35                
36                CommandResult commandResult = createSEFFAction(PalladioComponentModelElementTypes.Start_3001,monitor);
37        if (!isOK(commandResult))
38        {
39                return CommandResult.newErrorCommandResult("Create StartAction for the new SEFF failed!");
40        }
41        start = (Start) commandResult.getReturnValue();
42                commandResult = createSEFFAction(PalladioComponentModelElementTypes.Stop_3002,monitor);
43        if (!isOK(commandResult))
44        {
45                return CommandResult.newErrorCommandResult("Create StopAction for the new SEFF failed!");
46        }
47        stop = (Stop) 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(Start start,
58                        Stop stop, IProgressMonitor monitor) {
59                SetRequest setReq = new SetRequest(start, UsagemodelPackage.eINSTANCE
60                                .getAbstractUserAction_Successor(), stop);
61        SetValueCommand createControlFlowCommand = new SetValueCommand(setReq);
62        try {
63                        createControlFlowCommand.execute(monitor, null);
64                } catch (ExecutionException e) {
65            Log.error(UsageHelperPlugin.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,
75                        IProgressMonitor monitor) throws ExecutionException {
76                CreateElementRequest startRequest = new CreateElementRequest(myRequest
77                                .getElementToConfigure(), typeId, UsagemodelPackage.eINSTANCE
78                                .getScenarioBehaviour_Actions_ScenarioBehaviour());
79                startRequest.setLabel("Create Action");
80                CreateElementCommand createStartCommand = new CreateElementCommand(
81                                startRequest);
82                createStartCommand.execute(monitor, null);
83                CommandResult commandResult = createStartCommand.getCommandResult();
84                return commandResult;
85        }
86}

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