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

COVERAGE SUMMARY FOR SOURCE FILE [DeleteComponentParameterAction.java]

nameclass, %method, %block, %line, %
DeleteComponentParameterAction.java0%   (0/2)0%   (0/7)0%   (0/84)0%   (0/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DeleteComponentParameterAction0%   (0/1)0%   (0/5)0%   (0/63)0%   (0/23)
DeleteComponentParameterAction (): void 0%   (0/1)0%   (0/6)0%   (0/2)
notifyObservers (Object): void 0%   (0/1)0%   (0/6)0%   (0/3)
selectionChanged (SelectionChangedEvent): void 0%   (0/1)0%   (0/12)0%   (0/4)
widgetDefaultSelected (SelectionEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/38)0%   (0/13)
     
class DeleteComponentParameterAction$10%   (0/1)0%   (0/2)0%   (0/21)0%   (0/5)
DeleteComponentParameterAction$1 (DeleteComponentParameterAction, Transaction... 0%   (0/1)0%   (0/13)0%   (0/2)
doExecute (): void 0%   (0/1)0%   (0/8)0%   (0/3)

1package de.uka.ipd.sdq.pcmbench.tabs.parameters;
2 
3import java.util.Observable;
4 
5import org.eclipse.core.runtime.Assert;
6import org.eclipse.emf.ecore.EObject;
7import org.eclipse.emf.transaction.RecordingCommand;
8import org.eclipse.emf.transaction.TransactionalEditingDomain;
9import org.eclipse.emf.transaction.util.TransactionUtil;
10import org.eclipse.jface.viewers.ISelectionChangedListener;
11import org.eclipse.jface.viewers.IStructuredSelection;
12import org.eclipse.jface.viewers.SelectionChangedEvent;
13import org.eclipse.swt.events.SelectionEvent;
14import org.eclipse.swt.events.SelectionListener;
15 
16import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext;
17import de.uka.ipd.sdq.pcm.parameter.VariableUsage;
18 
19public class DeleteComponentParameterAction extends Observable implements
20                SelectionListener, ISelectionChangedListener {
21 
22        private EObject selectedElement = null;
23 
24        /* (non-Javadoc)
25         * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
26         */
27        public void selectionChanged(SelectionChangedEvent event) {
28                IStructuredSelection sel = (IStructuredSelection) event.getSelection();
29                Object selection = (Object) sel.getFirstElement();
30                this.selectedElement = (EObject) selection;
31        }
32 
33        /* (non-Javadoc)
34         * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
35         */
36        public void widgetSelected(SelectionEvent e) {
37                final VariableUsageWrapper wrapper = (VariableUsageWrapper) selectedElement;
38                final VariableUsage variableUsage = wrapper.getVariableUsage();
39                final AssemblyContext context = (AssemblyContext) variableUsage
40                                .eContainer();
41 
42                Assert.isNotNull(context);
43 
44                TransactionalEditingDomain editingDomain = TransactionUtil
45                                .getEditingDomain(context);
46 
47                RecordingCommand recCommand = new RecordingCommand(editingDomain) {
48                        @Override
49                        protected void doExecute() {
50                                context.getConfigParameterUsages__AssemblyContext().remove(
51                                                variableUsage);
52                        }
53                };
54 
55                recCommand.setDescription("Delete ...");
56                editingDomain.getCommandStack().execute(recCommand);
57                
58                // set TabelItem not edited
59                wrapper.setEdited(false);
60                // update observer
61                notifyObservers(wrapper);
62 
63        }
64        
65        /* (non-Javadoc)
66         * @see java.util.Observable#notifyObservers(java.lang.Object)
67         */
68        @Override
69        public void notifyObservers(Object arg) {
70                setChanged();
71                super.notifyObservers(arg);
72        }
73 
74        /* (non-Javadoc)
75         * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent)
76         */
77        public void widgetDefaultSelected(SelectionEvent e) {
78                // The implementation is not necessary.
79        }
80}

[all classes][de.uka.ipd.sdq.pcmbench.tabs.parameters]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov