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

COVERAGE SUMMARY FOR SOURCE FILE [SimuConfigurationTab.java]

nameclass, %method, %block, %line, %
SimuConfigurationTab.java0%   (0/2)0%   (0/7)0%   (0/656)0%   (0/142)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SimuConfigurationTab0%   (0/1)0%   (0/5)0%   (0/646)0%   (0/139)
SimuConfigurationTab (): void 0%   (0/1)0%   (0/8)0%   (0/2)
createControl (Composite): void 0%   (0/1)0%   (0/355)0%   (0/63)
initializeFrom (ILaunchConfiguration): void 0%   (0/1)0%   (0/163)0%   (0/42)
performApply (ILaunchConfigurationWorkingCopy): void 0%   (0/1)0%   (0/61)0%   (0/17)
selectVariable (): void 0%   (0/1)0%   (0/59)0%   (0/15)
     
class SimuConfigurationTab$10%   (0/1)0%   (0/2)0%   (0/10)0%   (0/4)
SimuConfigurationTab$1 (SimuConfigurationTab): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/**
2 *
3 */
4package de.uka.ipd.sdq.codegen.simucontroller.runconfig;
5 
6import java.util.ArrayList;
7 
8import org.eclipse.core.runtime.CoreException;
9import org.eclipse.debug.core.ILaunchConfiguration;
10import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
11import org.eclipse.emf.common.util.URI;
12import org.eclipse.emf.ecore.EObject;
13import org.eclipse.emf.ecore.resource.ResourceSet;
14import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
15import org.eclipse.emf.ecore.util.EcoreUtil;
16import org.eclipse.swt.SWT;
17import org.eclipse.swt.events.SelectionAdapter;
18import org.eclipse.swt.events.SelectionEvent;
19import org.eclipse.swt.layout.GridData;
20import org.eclipse.swt.layout.GridLayout;
21import org.eclipse.swt.widgets.Button;
22import org.eclipse.swt.widgets.Composite;
23import org.eclipse.swt.widgets.Group;
24import org.eclipse.swt.widgets.Label;
25import org.eclipse.swt.widgets.Text;
26 
27import de.uka.ipd.sdq.pcm.dialogs.selection.PalladioSelectEObjectDialog;
28import de.uka.ipd.sdq.simulation.AbstractSimulationConfig;
29import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer;
30import de.uka.ipd.sdq.workflow.pcm.runconfig.ConfigurationTab;
31 
32/**
33 * The class extends ConfigurationTab by CheckBox. User can decide whether that
34 * generated instance of Palladio Component Model after simulating must be
35 * deleted.
36 *
37 * @see de.uka.ipd.sdq.workflow.pcm.runconfig.ConfigurationTab
38 *
39 * @author Roman Andrej
40 */
41public class SimuConfigurationTab extends ConfigurationTab {
42 
43        // Sensitivity Analysis
44        private Text variableText;
45        private Text minimumText;
46        private Text maximumText;
47        private Text stepWidthText;
48        private ArrayList<String> modelFiles = new ArrayList<String>();
49        // Random Number Generator Seed(s)
50        private Button fixedSeedButton;
51        private Text[] seedText;
52 
53        /* (non-Javadoc)
54         * @see de.uka.ipd.sdq.codegen.runconfig.tabs.ConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
55         */
56        @Override
57        public void createControl(Composite parent) {
58                super.createControl(parent);
59                Composite container = (Composite) getControl();
60 
61                final Group sensitivityAnalysisParametersGroup = new Group(container, SWT.NONE);
62                sensitivityAnalysisParametersGroup.setText("Sensitivity Analysis Parameters");
63                final GridData gd_sensitivityAnalysisParametersGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
64                sensitivityAnalysisParametersGroup.setLayoutData(gd_sensitivityAnalysisParametersGroup);
65                final GridLayout gridLayout_1 = new GridLayout();
66                gridLayout_1.numColumns = 3;
67                sensitivityAnalysisParametersGroup.setLayout(gridLayout_1);
68 
69                final Label variableToAdaptLabel = new Label(sensitivityAnalysisParametersGroup, SWT.NONE);
70                final GridData gd_variableToAdaptLabel = new GridData(SWT.RIGHT, SWT.CENTER, false, false);
71                variableToAdaptLabel.setLayoutData(gd_variableToAdaptLabel);
72                variableToAdaptLabel.setText("Variable:");
73 
74                variableText = new Text(sensitivityAnalysisParametersGroup, SWT.BORDER);
75                variableText.setEnabled(true);
76                variableText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
77                variableText.addModifyListener(modifyListener);
78 
79                final Button selectVariableButton = new Button(sensitivityAnalysisParametersGroup, SWT.NONE);
80                selectVariableButton.addSelectionListener(new SelectionAdapter() {
81                        public void widgetSelected(final SelectionEvent e) {
82                                selectVariable();
83                        }
84                });
85                selectVariableButton.setText("Select Variable...");
86 
87                final Composite composite = new Composite(sensitivityAnalysisParametersGroup, SWT.NONE);
88                final GridData gd_composite = new GridData(SWT.FILL, SWT.CENTER, false, false, 3, 1);
89                composite.setLayoutData(gd_composite);
90                final GridLayout gridLayout_2 = new GridLayout();
91                gridLayout_2.numColumns = 6;
92                composite.setLayout(gridLayout_2);
93 
94                final Label minimumLabel = new Label(composite, SWT.NONE);
95                minimumLabel.setText("Minimum:");
96 
97                minimumText = new Text(composite, SWT.BORDER);
98                minimumText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
99                minimumText.addModifyListener(modifyListener);
100 
101                final Label maximumLabel = new Label(composite, SWT.NONE);
102                maximumLabel.setText("Maximum:");
103 
104                maximumText = new Text(composite, SWT.BORDER);
105                maximumText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
106                maximumText.addModifyListener(modifyListener);
107 
108                final Label stepWidthLabel = new Label(composite, SWT.NONE);
109                stepWidthLabel.setText("Step Width:");
110 
111                stepWidthText = new Text(composite, SWT.BORDER);
112                stepWidthText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
113                stepWidthText.addModifyListener(modifyListener);
114 
115                final Group randomNumberGeneratorParametersGroup = new Group(container, SWT.NONE);
116                randomNumberGeneratorParametersGroup.setText("Random Number Generator Seed");
117                final GridData gd_randomNumberGeneratorParametersGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
118                randomNumberGeneratorParametersGroup.setLayoutData(gd_randomNumberGeneratorParametersGroup);
119                final GridLayout gridLayout_3 = new GridLayout();
120                gridLayout_3.numColumns = 12;
121                randomNumberGeneratorParametersGroup.setLayout(gridLayout_3);
122 
123                fixedSeedButton = new Button(randomNumberGeneratorParametersGroup,
124                                SWT.CHECK);
125                fixedSeedButton.setLayoutData( new GridData(SWT.LEFT, SWT.CENTER, false, false, 12, 1));
126                fixedSeedButton.setText("Use a fixed seed in simulation run");
127                fixedSeedButton.setSelection(false);
128                fixedSeedButton.addSelectionListener(selectionListener);
129 
130                seedText = new Text[6]; Label[] seedLabel = new Label[6];
131                for (int i = 0; i < 6; i++) {
132                        seedLabel[i] = new Label(randomNumberGeneratorParametersGroup,SWT.NONE);
133                        seedLabel[i].setText("Seed "+i);
134                        seedText[i] = new Text(randomNumberGeneratorParametersGroup,SWT.BORDER);
135                        seedText[i].setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
136                        seedText[i].addModifyListener(modifyListener);
137                        seedText[i].setText(i+"");
138                }
139        }
140 
141 
142        protected void selectVariable() {
143                ResourceSet rs = new ResourceSetImpl();
144                ArrayList<Object> filter = new ArrayList<Object>();
145                filter.add(EObject.class);
146                for (String file : modelFiles) {
147                        try {
148                                rs.getResource(URI.createURI(file), true);
149                        } catch (Exception ex) {
150                                rs.getResource(URI.createFileURI(file), true);
151                        }
152                }
153                EcoreUtil.resolveAll(rs);
154                PalladioSelectEObjectDialog dialog = new PalladioSelectEObjectDialog
155                        (this.getShell(),
156                         filter,
157                         rs);
158                if (dialog.open() == org.eclipse.jface.dialogs.Dialog.OK) {
159                        variableText.setText(EcoreUtil.getURI(dialog.getResult()).toString());
160                }
161        }
162 
163 
164        /* (non-Javadoc)
165         * @see de.uka.ipd.sdq.codegen.runconfig.tabs.ConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
166         */
167        @Override
168        public void initializeFrom(ILaunchConfiguration configuration) {
169                super.initializeFrom(configuration);
170 
171                try {
172                        clearButton.setSelection(configuration.getAttribute(
173                                        ConstantsContainer.DELETE_TEMPORARY_DATA_AFTER_ANALYSIS, true));
174                } catch (CoreException e) {
175                        clearButton.setSelection(true);
176                }
177 
178                try {
179                        fixedSeedButton.setSelection(configuration.getAttribute(
180                                        AbstractSimulationConfig.USE_FIXED_SEED, false));
181                } catch (CoreException e) {
182                        fixedSeedButton.setSelection(false);
183                }
184 
185                for (int i=0; i<6; i++) {
186                        try {
187                                seedText[i].setText(configuration.getAttribute(
188                                                AbstractSimulationConfig.FIXED_SEED_PREFIX+i, i+""));
189                        } catch (CoreException e) {
190                                seedText[i].setText(i+"");
191                        }
192                }
193 
194                try {
195                        variableText.setText(configuration.getAttribute(
196                                        ConstantsContainer.VARIABLE_TEXT, ""));
197                } catch (CoreException e) {
198                        variableText.setText("");
199                }
200 
201                try {
202                        minimumText.setText(configuration.getAttribute(
203                                        ConstantsContainer.MINIMUM_TEXT, ""));
204                } catch (CoreException e) {
205                        minimumText.setText("");
206                }
207 
208                try {
209                        maximumText.setText(configuration.getAttribute(
210                                        ConstantsContainer.MAXIMUM_TEXT, ""));
211                } catch (CoreException e) {
212                        maximumText.setText("");
213                }
214 
215                try {
216                        stepWidthText.setText(configuration.getAttribute(
217                                        ConstantsContainer.STEP_WIDTH_TEXT, ""));
218                } catch (CoreException e) {
219                        stepWidthText.setText("");
220                }
221 
222                try {
223                        modelFiles.clear();
224                        modelFiles.add(configuration.getAttribute(
225                                        ConstantsContainer.REPOSITORY_FILE, ""));
226                        modelFiles.add(configuration.getAttribute(
227                                        ConstantsContainer.SYSTEM_FILE, ""));
228                        modelFiles.add(configuration.getAttribute(
229                                        ConstantsContainer.ALLOCATION_FILE, ""));
230                        modelFiles.add(configuration.getAttribute(
231                                        ConstantsContainer.USAGE_FILE, ""));
232                } catch (CoreException e) {
233                        stepWidthText.setText("");
234                }
235        }
236 
237        /* (non-Javadoc)
238         * @see de.uka.ipd.sdq.codegen.runconfig.tabs.ConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
239         */
240        @Override
241        public void performApply(ILaunchConfigurationWorkingCopy configuration) {
242                super.performApply(configuration);
243 
244                configuration.setAttribute(ConstantsContainer.DELETE_TEMPORARY_DATA_AFTER_ANALYSIS,
245                                clearButton.getSelection());
246                configuration.setAttribute(AbstractSimulationConfig.USE_FIXED_SEED,
247                                fixedSeedButton.getSelection());
248                for (int i=0; i<6; i++){
249                        configuration.setAttribute(AbstractSimulationConfig.FIXED_SEED_PREFIX+i,
250                                        seedText[i].getText());
251                }
252                configuration.setAttribute(ConstantsContainer.VARIABLE_TEXT,
253                                variableText.getText());
254                configuration.setAttribute(ConstantsContainer.MINIMUM_TEXT,
255                                minimumText.getText());
256                configuration.setAttribute(ConstantsContainer.MAXIMUM_TEXT,
257                                maximumText.getText());
258                configuration.setAttribute(ConstantsContainer.STEP_WIDTH_TEXT,
259                                stepWidthText.getText());
260 
261        }
262}

[all classes][de.uka.ipd.sdq.codegen.simucontroller.runconfig]
EMMA 2.0.9414 (unsupported private build) (C) Vladimir Roubtsov