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

nameclass, %method, %block, %line, %
AcquireActionEditHelperAdvice.java0%   (0/1)0%   (0/3)0%   (0/88)0%   (0/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AcquireActionEditHelperAdvice0%   (0/1)0%   (0/3)0%   (0/88)0%   (0/29)
AcquireActionEditHelperAdvice (): void 0%   (0/1)0%   (0/3)0%   (0/1)
getAfterConfigureCommand (ConfigureRequest): ICommand 0%   (0/1)0%   (0/74)0%   (0/24)
searchBasicComponent (EObject): EObject 0%   (0/1)0%   (0/11)0%   (0/4)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.pcm.gmf.seff.helper;
5 
6import java.util.ArrayList;
7 
8import org.eclipse.emf.ecore.EObject;
9import org.eclipse.emf.ecore.EReference;
10import org.eclipse.gmf.runtime.common.core.command.ICommand;
11import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
12import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice;
13import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
14import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
15import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
16import org.eclipse.ui.PlatformUI;
17 
18import com.sun.corba.se.spi.activation.Repository;
19 
20import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
21import de.uka.ipd.sdq.pcm.repository.BasicComponent;
22import de.uka.ipd.sdq.pcm.repository.PassiveResource;
23import de.uka.ipd.sdq.pcm.seff.SeffPackage;
24 
25/**
26 * @author admin
27 *
28 */
29public class AcquireActionEditHelperAdvice extends AbstractEditHelperAdvice
30                implements IEditHelperAdvice {
31        
32        /* (non-Javadoc)
33         * @see org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice#getAfterConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest)
34         */
35        @Override
36        protected ICommand getAfterConfigureCommand(ConfigureRequest request) {
37                EObject resource = null;
38                ArrayList<Object> filterList = new ArrayList<Object>();
39                filterList.add(Repository.class);
40                filterList.add(BasicComponent.class);
41                filterList.add(PassiveResource.class);
42 
43                ArrayList<EReference> additionalReferences = new ArrayList<EReference>();
44                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog(
45                                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
46                                filterList, 
47                                additionalReferences,
48                                searchBasicComponent(request.getElementToConfigure()));
49                dialog.setProvidedService(PassiveResource.class);
50                dialog.open();
51                if (dialog.getResult() == null)
52                        return new CanceledCommand();
53                if (!(dialog.getResult() instanceof PassiveResource))
54                        return new CanceledCommand();
55                resource = (PassiveResource) dialog.getResult();
56                
57                ICommand cmd = new SetValueCommand(
58                                new SetRequest(
59                                                request.getElementToConfigure(), 
60                                                SeffPackage.eINSTANCE.getAcquireAction_Passiveresource_AcquireAction(),
61                                                resource));
62                return cmd;
63        }
64 
65        private EObject searchBasicComponent(EObject elementToConfigure) {
66                EObject o = elementToConfigure;
67                while (!(o instanceof BasicComponent))
68                        o = o.eContainer();
69                return o;
70        }
71 
72}

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