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

COVERAGE SUMMARY FOR SOURCE FILE [DoubleClickListener.java]

nameclass, %method, %block, %line, %
DoubleClickListener.java0%   (0/1)0%   (0/3)0%   (0/103)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DoubleClickListener0%   (0/1)0%   (0/3)0%   (0/103)0%   (0/31)
DoubleClickListener (): void 0%   (0/1)0%   (0/3)0%   (0/1)
doubleClick (DoubleClickEvent): void 0%   (0/1)0%   (0/89)0%   (0/27)
hookDoubleClickAction (ConfigEditorInput, String): void 0%   (0/1)0%   (0/11)0%   (0/3)

1package de.uka.ipd.sdq.sensorframework.visualisation.views;
2 
3import org.eclipse.core.runtime.IConfigurationElement;
4import org.eclipse.jface.dialogs.MessageDialog;
5import org.eclipse.jface.viewers.DoubleClickEvent;
6import org.eclipse.jface.viewers.IDoubleClickListener;
7import org.eclipse.jface.viewers.IStructuredSelection;
8import org.eclipse.ui.PlatformUI;
9 
10import de.uka.ipd.sdq.sensorframework.entities.ExperimentRun;
11import de.uka.ipd.sdq.sensorframework.entities.Sensor;
12import de.uka.ipd.sdq.sensorframework.entities.SensorAndMeasurements;
13import de.uka.ipd.sdq.sensorframework.visualisation.dialogs.ViewAndAdapterFactory;
14import de.uka.ipd.sdq.sensorframework.visualisation.editor.ConfigEditorInput;
15import de.uka.ipd.sdq.sensorframework.visualisation.editor.ConfigEntry;
16import de.uka.ipd.sdq.sensorframework.visualisation.editor.SensorValidationToView;
17import de.uka.ipd.sdq.sensorframework.visualisation.menu.DoubleClickAction;
18 
19/** @author roman */
20public class DoubleClickListener implements IDoubleClickListener {
21 
22        private DoubleClickAction doubleClickAction;
23        
24        /* (non-Javadoc)
25         * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse.jface.viewers.DoubleClickEvent)
26         */
27        public void doubleClick(DoubleClickEvent event) {
28                if (event.getSelection() instanceof IStructuredSelection) {
29                        IStructuredSelection selection = (IStructuredSelection) event
30                                        .getSelection();
31                        Object object = selection.getFirstElement();
32 
33                        if (object instanceof TreeObject) {
34 
35                                TreeObject treeObject = (TreeObject) object;
36                                Object innerObject = treeObject.getObject();
37                                ExperimentRun run = treeObject.getRun();
38 
39                                /** Sensor */
40                                if (innerObject instanceof Sensor && run != null) {
41                                        Sensor sensor = (Sensor) innerObject;
42                                        SensorAndMeasurements sam = run.getMeasurementsOfSensor(sensor);
43                                        
44                                        if (sam.getMeasurements().size() != 0) {
45                                                /** return all view, which can represent the sensor */
46                                                Object[] viewers = SensorValidationToView.findViews(sam);
47        
48                                                ViewAndAdapterFactory selecedView = SensorValidationToView.getSelectedAction(event.getViewer().getControl()
49                                                                .getShell(), viewers);
50                                                if (selecedView != null) {
51                                                        ConfigEditorInput editorInput = new ConfigEditorInput(selecedView.getFactory().getAdapterFactoryID());
52                                                        ConfigEntry configEntry = new ConfigEntry(treeObject
53                                                                        .getDatasource(), treeObject.getRun(), treeObject
54                                                                        .getExperiment(), sensor);
55                                                        editorInput.addConfigEntry(configEntry);
56                                                        IConfigurationElement action = selecedView.getView();
57                                                        hookDoubleClickAction(editorInput, action.getAttribute("editorID"));
58                                                }
59                                        } else {
60                                                MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), 
61                                                                "Empty Sensor", 
62                                                                "The selected sensor does not contain measurements in the selected Experiment Run." +
63                                                                " Refused to open view.");
64                                        }
65                                }
66                        }
67                }
68        }
69        
70        private void hookDoubleClickAction(ConfigEditorInput editorInput,
71                        String editorID) {
72                doubleClickAction = new DoubleClickAction(editorInput, editorID);
73                doubleClickAction.run();
74        }
75}

[all classes][de.uka.ipd.sdq.sensorframework.visualisation.views]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov