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

nameclass, %method, %block, %line, %
ParameterCollectionIteratorActionEditHelperAdvice.java0%   (0/1)0%   (0/3)0%   (0/152)0%   (0/53)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ParameterCollectionIteratorActionEditHelperAdvice0%   (0/1)0%   (0/3)0%   (0/152)0%   (0/53)
ParameterCollectionIteratorActionEditHelperAdvice (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAfterConfigureCommand (ConfigureRequest): ICommand 0%   (0/1)0%   (0/130)0%   (0/45)
getSEFF (EObject): ResourceDemandingSEFF 0%   (0/1)0%   (0/19)0%   (0/7)

1package de.uka.ipd.sdq.pcm.gmf.seff.helper;
2 
3import java.util.ArrayList;
4 
5import org.eclipse.emf.ecore.EObject;
6import org.eclipse.emf.ecore.EReference;
7import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
8import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
9import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
10import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
11import org.eclipse.gmf.runtime.common.core.command.ICommand;
12import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
13import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
14import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
15import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
16import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
17import org.eclipse.ui.PlatformUI;
18 
19import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
20import de.uka.ipd.sdq.pcm.repository.DataType;
21import de.uka.ipd.sdq.pcm.repository.OperationSignature;
22import de.uka.ipd.sdq.pcm.repository.Parameter;
23import de.uka.ipd.sdq.pcm.repository.RepositoryPackage;
24import de.uka.ipd.sdq.pcm.repository.Signature;
25import de.uka.ipd.sdq.pcm.repository.provider.RepositoryItemProviderAdapterFactory;
26import de.uka.ipd.sdq.pcm.seff.ResourceDemandingSEFF;
27import de.uka.ipd.sdq.pcm.seff.SeffPackage;
28import de.uka.ipd.sdq.pcmbench.ui.provider.PalladioItemProviderAdapterFactory;
29 
30/** @author roman */
31public class ParameterCollectionIteratorActionEditHelperAdvice extends
32                AbstractEditHelperAdvice implements IEditHelperAdvice {
33 
34        @Override
35        protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
36                EObject parameter = null;
37                OperationSignature signature = null;
38                ResourceDemandingSEFF seff = null;
39 
40                seff = getSEFF(request.getElementToConfigure());
41                signature = (OperationSignature) seff.getDescribedService__SEFF();
42 
43                ArrayList<Object> filterList = new ArrayList<Object>();
44                filterList.add(ResourceDemandingSEFF.class);
45                filterList.add(OperationSignature.class);
46                filterList.add(Parameter.class);
47                filterList.add(DataType.class);
48                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
49                additionalReferences.add(RepositoryPackage.eINSTANCE
50                                .getParameter_DataType__Parameter());
51                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(
52                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
53                                filterList, additionalReferences, signature
54                                                .getInterface__OperationSignature());
55                dialog
56                                .setViewerContentProvider(new CollectionIteratorContentProvider());
57                ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory();
58                adapterFactory
59                                .addAdapterFactory(new ResourceItemProviderAdapterFactory());
60                adapterFactory
61                                .addAdapterFactory(new RepositoryItemProviderAdapterFactory());
62                adapterFactory
63                                .addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
64                /**
65                 * set a LabelProvider for dialog TreeViewer
66                 */
67                dialog
68                                .setViewerLabelProvider(new AdapterFactoryLabelProvider(
69                                                new CollectionIteratorItemProviderAdapterFactory(
70                                                                new PalladioItemProviderAdapterFactory(
71                                                                                adapterFactory))));
72                dialog.setProvidedService(Parameter.class);
73                dialog.open();
74                if (dialog.getResult() == null)
75                        return new CanceledCommand();
76                if (!(dialog.getResult() instanceof Parameter))
77                        return new CanceledCommand();
78                parameter = (Parameter) dialog.getResult();
79 
80                ICommand cmd = new SetValueCommand(
81                                new SetRequest(
82                                                request.getElementToConfigure(),
83                                                SeffPackage.eINSTANCE
84                                                                .getCollectionIteratorAction_Parameter_CollectionIteratorAction(),
85                                                parameter));
86                return cmd;
87        }
88        
89        private ResourceDemandingSEFF getSEFF(EObject a) {
90                EObject container = a;
91                while (!(container instanceof ResourceDemandingSEFF))
92                        container = container.eContainer();
93                if (!(container instanceof ResourceDemandingSEFF)) 
94                        return null;
95                ResourceDemandingSEFF seff = (ResourceDemandingSEFF) container;
96                return seff;
97        }
98 
99}

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