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

COVERAGE SUMMARY FOR SOURCE FILE [OpenSchedulingPolicyDialog.java]

nameclass, %method, %block, %line, %
OpenSchedulingPolicyDialog.java0%   (0/1)0%   (0/2)0%   (0/51)0%   (0/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OpenSchedulingPolicyDialog0%   (0/1)0%   (0/2)0%   (0/51)0%   (0/16)
OpenSchedulingPolicyDialog (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getOpenCommand (Request): Command 0%   (0/1)0%   (0/48)0%   (0/15)

1package de.uka.ipd.sdq.pcm.dialogs.resource;
2 
3import org.eclipse.gef.Request;
4import org.eclipse.gef.commands.Command;
5import org.eclipse.gmf.runtime.common.core.command.ICommand;
6import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
7import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
8import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
9import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
10import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
11import org.eclipse.gmf.runtime.notation.View;
12import org.eclipse.ui.PlatformUI;
13 
14import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification;
15import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage;
16import de.uka.ipd.sdq.pcm.resourceenvironment.SchedulingPolicy;
17 
18public class OpenSchedulingPolicyDialog extends OpenEditPolicy {
19 
20        @Override
21        protected Command getOpenCommand(Request request) {
22                SchedulingPolicy policy;
23                
24                SelectSchedulingPolicyElementDialog dialog = new SelectSchedulingPolicyElementDialog(
25                                                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
26                dialog.open();
27                if (dialog.getResult() == null) {
28                        return null;
29                }
30 
31                if (!(dialog.getResult() instanceof SchedulingPolicy)){
32                        return null;
33                }
34                policy = dialog.getResult();
35                
36                ProcessingResourceSpecification specification = (ProcessingResourceSpecification)(((View) ((IGraphicalEditPart) getHost()).getModel()).getElement());
37                ICommand icmd = new SetValueCommand(
38                                new SetRequest(
39                                                specification, 
40                                                ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_SchedulingPolicy(),
41                                                policy));
42                return new ICommandProxy(icmd);
43        }
44 
45}

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