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

nameclass, %method, %block, %line, %
OpenActiveResourceSpecificationDialog.java0%   (0/1)0%   (0/2)0%   (0/86)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OpenActiveResourceSpecificationDialog0%   (0/1)0%   (0/2)0%   (0/86)0%   (0/27)
OpenActiveResourceSpecificationDialog (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getOpenCommand (Request): Command 0%   (0/1)0%   (0/83)0%   (0/26)

1package de.uka.ipd.sdq.pcm.dialogs.resource;
2 
3import java.util.ArrayList;
4 
5import org.eclipse.emf.ecore.EObject;
6import org.eclipse.emf.ecore.EReference;
7import org.eclipse.emf.ecore.resource.ResourceSet;
8import org.eclipse.gef.Request;
9import org.eclipse.gef.commands.Command;
10import org.eclipse.gmf.runtime.common.core.command.ICommand;
11import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
12import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
13import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
14import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
15import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
16import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
17import org.eclipse.gmf.runtime.notation.View;
18import org.eclipse.ui.PlatformUI;
19 
20import de.uka.ipd.sdq.pcm.core.PCMRandomVariable;
21import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
22import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification;
23import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage;
24import de.uka.ipd.sdq.pcm.resourceenvironment.impl.ProcessingResourceSpecificationImpl;
25import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType;
26import de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository;
27 
28public class OpenActiveResourceSpecificationDialog extends OpenEditPolicy{
29        
30 
31        @Override
32        protected Command getOpenCommand(Request request) {
33                ProcessingResourceSpecification specification = (ProcessingResourceSpecification)(((View) ((IGraphicalEditPart) getHost()).getModel()).getElement());
34                ResourceSet set = (specification.getResourceContainer_ProcessingResourceSpecification()).eResource().getResourceSet(); 
35                EObject resourceType = null;
36                ArrayList<Object> filterList = new ArrayList<Object>(); // positive filter
37                // Set types to show and their super types
38                filterList.add(ProcessingResourceType.class);
39                filterList.add(ResourceRepository.class);
40                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
41                // set EReference that should be set (in this case: active resource type)
42                additionalReferences.add(ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_ActiveResourceType_ActiveResourceSpecification());
43                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(
44                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
45                                filterList, 
46                                additionalReferences,
47                                set);
48                dialog.setProvidedService(ProcessingResourceType.class);
49                dialog.open();
50                if (dialog.getResult() == null) {
51                        return null;
52                }
53 
54                if (!(dialog.getResult() instanceof ProcessingResourceType)){
55                        return null;
56                }
57                resourceType = (ProcessingResourceType) dialog.getResult();
58                
59 
60                ICommand icmd = new SetValueCommand(
61                                new SetRequest(
62                                                specification, 
63                                                ResourceenvironmentPackage.eINSTANCE.getProcessingResourceSpecification_ActiveResourceType_ActiveResourceSpecification(),
64                                                resourceType));
65                return new ICommandProxy(icmd);
66        }
67 
68}

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