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 [EmitEventActionConfigureCommand.java]

nameclass, %method, %block, %line, %
EmitEventActionConfigureCommand.java0%   (0/1)0%   (0/4)0%   (0/92)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class EmitEventActionConfigureCommand0%   (0/1)0%   (0/4)0%   (0/92)0%   (0/27)
EmitEventActionConfigureCommand (ConfigureRequest, EventType, SourceRole): void 0%   (0/1)0%   (0/22)0%   (0/8)
doExecuteWithResult (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/26)0%   (0/9)
setEventTypeEmitEventAction (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/22)0%   (0/5)
setSourceRoleEmitEventAction (IProgressMonitor, IAdaptable): CommandResult 0%   (0/1)0%   (0/22)0%   (0/5)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.helper;
5 
6import org.eclipse.core.commands.ExecutionException;
7import org.eclipse.core.runtime.IAdaptable;
8import org.eclipse.core.runtime.IProgressMonitor;
9import org.eclipse.gmf.runtime.common.core.command.CommandResult;
10import org.eclipse.gmf.runtime.common.core.command.ICommand;
11import org.eclipse.gmf.runtime.emf.type.core.commands.ConfigureElementCommand;
12import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
13import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
14import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
15 
16import de.uka.ipd.sdq.pcm.repository.EventType;
17import de.uka.ipd.sdq.pcm.repository.SourceRole;
18import de.uka.ipd.sdq.pcm.seff.SeffPackage;
19 
20/**
21 * Command to Configure an emit event action with the appropriate event type and
22 * source role.
23 * 
24 * This configuration command takes use of the basic commands provided by the
25 * EMF environment like setValueCommand() etc.
26 * 
27 * @author Benjamin Klatt
28 */
29public class EmitEventActionConfigureCommand extends ConfigureElementCommand {
30 
31        /** The request send for the configuration */
32        private ConfigureRequest request = null;
33 
34        /** The event type to be emitted by the EmitEventAction */
35        private EventType eventType = null;
36 
37        /** The source role to be triggered by the emit event action */
38        private SourceRole sourceRole = null;
39 
40        /**
41         * Constructor to set the required configuration.
42         * 
43         * @param request
44         *            The request calling this command.
45         * @param eventType
46         *            The EventType the action should be able to emit.
47         * @param sourceRole
48         *            The source role to be triggered by the action.
49         */
50        public EmitEventActionConfigureCommand(ConfigureRequest request,
51                        EventType eventType, SourceRole sourceRole) {
52                super(request);
53                this.request = request;
54                this.eventType = eventType;
55                this.sourceRole = sourceRole;
56        }
57 
58        /**
59         * Execute the command and return the result of the configuration process.
60         * 
61         * @param monitor
62         *            The monitor to report the progress to.
63         * @param info
64         *            The adaptable information object of the environment.
65         * @return The result of the configuration process.
66         * 
67         * @see org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand#doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor,
68         *      org.eclipse.core.runtime.IAdaptable)
69         */
70        @Override
71        protected CommandResult doExecuteWithResult(IProgressMonitor monitor,
72                        IAdaptable info) throws ExecutionException {
73                CommandResult commandResult = setEventTypeEmitEventAction(monitor, info);
74                if (!isOK(commandResult)) {
75                        return CommandResult
76                                        .newErrorCommandResult("Set EventType for the EmitEventAction failed!");
77                }
78                commandResult = setSourceRoleEmitEventAction(monitor, info);
79                if (!isOK(commandResult)) {
80                        return CommandResult
81                                        .newErrorCommandResult("Set SourceRole for the EmitEventAction failed!");
82                }
83                return CommandResult.newOKCommandResult();
84        }
85 
86        /**
87         * Set the EventType in the EmitEventAction.
88         * 
89         * @param monitor
90         *            The monitor to report the progress to.
91         * @param info
92         *            The adaptable information object of the environment.
93         * @return The result of this processing step.
94         * 
95         * @throws ExecutionException
96         *             indicating any problems during the EmitEventAction
97         *             configuration.
98         */
99        private CommandResult setEventTypeEmitEventAction(IProgressMonitor monitor,
100                        IAdaptable info) throws ExecutionException {
101 
102                ICommand cmd = new SetValueCommand(new SetRequest(request
103                                .getElementToConfigure(), SeffPackage.eINSTANCE
104                                .getEmitEventAction_EventType__EmitEventAction(), eventType));
105 
106                cmd.execute(monitor, info);
107 
108                return cmd.getCommandResult();
109        }
110 
111        /**
112         * Set the SourceRole of the EmitEventAction.
113         * 
114         * @param monitor
115         *            The monitor to report the progress to.
116         * @param info
117         *            The adaptable information object of the environment.
118         * @return The result of this processing step.
119         * 
120         * @throws ExecutionException
121         *             indicating any problems during the EmitEventAction
122         *             configuration.
123         */
124        private CommandResult setSourceRoleEmitEventAction(
125                        IProgressMonitor monitor, IAdaptable info)
126                        throws ExecutionException {
127 
128                ICommand cmd = new SetValueCommand(new SetRequest(request
129                                .getElementToConfigure(), SeffPackage.eINSTANCE
130                                .getEmitEventAction_SourceRole__EmitEventAction(), sourceRole));
131 
132                cmd.execute(monitor, info);
133 
134                return cmd.getCommandResult();
135        }
136}

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