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

COVERAGE SUMMARY FOR SOURCE FILE [ConfigurationTab.java]

nameclass, %method, %block, %line, %
ConfigurationTab.java0%   (0/4)0%   (0/24)0%   (0/564)0%   (0/156)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ConfigurationTab0%   (0/1)0%   (0/18)0%   (0/501)0%   (0/144)
ConfigurationTab (): void 0%   (0/1)0%   (0/3)0%   (0/1)
access$0 (ConfigurationTab, boolean): void 0%   (0/1)0%   (0/4)0%   (0/1)
access$1 (ConfigurationTab): void 0%   (0/1)0%   (0/3)0%   (0/1)
access$2 (ConfigurationTab, boolean): void 0%   (0/1)0%   (0/4)0%   (0/1)
activated (ILaunchConfigurationWorkingCopy): void 0%   (0/1)0%   (0/1)0%   (0/1)
createAccuracySection (Composite): void 0%   (0/1)0%   (0/77)0%   (0/18)
createControl (Composite): void 0%   (0/1)0%   (0/65)0%   (0/19)
createDeleteTemporaryDataAfterAnalysisSection (Composite): void 0%   (0/1)0%   (0/52)0%   (0/10)
createFurtherSections (Composite): void 0%   (0/1)0%   (0/1)0%   (0/1)
createTemporaryDataLocationSection (Composite): void 0%   (0/1)0%   (0/117)0%   (0/25)
deactivated (ILaunchConfigurationWorkingCopy): void 0%   (0/1)0%   (0/1)0%   (0/1)
getImage (): Image 0%   (0/1)0%   (0/4)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/2)0%   (0/1)
initializeFrom (ILaunchConfiguration): void 0%   (0/1)0%   (0/83)0%   (0/27)
isValid (ILaunchConfiguration): boolean 0%   (0/1)0%   (0/31)0%   (0/11)
performApply (ILaunchConfigurationWorkingCopy): void 0%   (0/1)0%   (0/25)0%   (0/11)
setDefaults (ILaunchConfigurationWorkingCopy): void 0%   (0/1)0%   (0/19)0%   (0/12)
setTemporaryLocationElementsEnabled (boolean): void 0%   (0/1)0%   (0/9)0%   (0/3)
     
class ConfigurationTab$10%   (0/1)0%   (0/2)0%   (0/14)0%   (0/5)
ConfigurationTab$1 (ConfigurationTab): void 0%   (0/1)0%   (0/6)0%   (0/2)
modifyText (ModifyEvent): void 0%   (0/1)0%   (0/8)0%   (0/3)
     
class ConfigurationTab$20%   (0/1)0%   (0/2)0%   (0/14)0%   (0/5)
ConfigurationTab$2 (ConfigurationTab): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/8)0%   (0/3)
     
class ConfigurationTab$30%   (0/1)0%   (0/2)0%   (0/35)0%   (0/8)
ConfigurationTab$3 (ConfigurationTab): void 0%   (0/1)0%   (0/6)0%   (0/2)
widgetSelected (SelectionEvent): void 0%   (0/1)0%   (0/29)0%   (0/6)

1package de.uka.ipd.sdq.workflow.pcm.runconfig;
2 
3 
4import org.eclipse.core.runtime.CoreException;
5import org.eclipse.debug.core.ILaunchConfiguration;
6import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
7import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
8import org.eclipse.swt.SWT;
9import org.eclipse.swt.custom.ScrolledComposite;
10import org.eclipse.swt.events.ModifyEvent;
11import org.eclipse.swt.events.ModifyListener;
12import org.eclipse.swt.events.SelectionAdapter;
13import org.eclipse.swt.events.SelectionEvent;
14import org.eclipse.swt.events.SelectionListener;
15import org.eclipse.swt.graphics.Image;
16import org.eclipse.swt.layout.GridData;
17import org.eclipse.swt.layout.GridLayout;
18import org.eclipse.swt.widgets.Button;
19import org.eclipse.swt.widgets.Composite;
20import org.eclipse.swt.widgets.Group;
21import org.eclipse.swt.widgets.Label;
22import org.eclipse.swt.widgets.Text;
23 
24import de.uka.ipd.sdq.workflow.launchconfig.RunConfigImages;
25import de.uka.ipd.sdq.workflow.launchconfig.RunConfigPlugin;
26import de.uka.ipd.sdq.workflow.launchconfig.tabs.TabHelper;
27import de.uka.ipd.sdq.workflow.pcm.ConstantsContainer;
28 
29/**Configuration of an analysis method.
30 * Represents configuration settings which are independent of the solving method.
31 *
32 * @author groenda
33 * @author Roman Andrej
34 */
35public class ConfigurationTab extends AbstractLaunchConfigurationTab {
36 
37        /** The id of this plug-in. */
38        public static final String PLUGIN_ID = "de.uka.ipd.sdq.workflow.pcm";
39        /** The path to the image file for the tab icon. */
40        public static final String CONFIGURATION_TAB_IMAGE_PATH         = "icons/configuration_tab.gif";
41 
42        /** Title of the accuracy information group. */
43        private static final String GROUP_ACCURACY_LABEL = "Accuracy influence analysis";
44        /** Label for the accuracy influence analysis setting. */
45        private static final String BUTTON_SIMULATE_ACCURACY_LABEL = "Analyse accuracy influence";
46        /** Label of the file selection field for the accuracy information model file. */
47        private static final String DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE_LABEL = "Quality Annotation File";
48 
49        /** Text field for name of the plug-in project containing temporary data. */
50        protected Text temporaryLocationField;
51        /** Label for the temporary data plug-in project name field. */
52        private Label temporaryLocationLabel;
53        /** Button stating if the default location should be selected. */
54        protected Button defaultLocationButton;
55        /** Button stating if the temporary data should be deleted after an analysis. */
56        protected Button clearButton;
57        /** Button used to enable/disable accuracy influence checking. */
58        private Button simulateAccuracyButton;
59        /** Text containing the location of the file containing quality annotations for PCM specifications. */
60        private Text  textAccuracyQualityAnnotationFile;
61 
62        protected ModifyListener modifyListener;
63        protected SelectionListener selectionListener;
64 
65        /* (non-Javadoc)
66         * @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getImage()
67         */
68        public Image getImage() {
69                return RunConfigImages.getTabImage(PLUGIN_ID,CONFIGURATION_TAB_IMAGE_PATH);
70        }
71 
72        /* (non-Javadoc)
73         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
74         */
75        public void createControl(Composite parent) {
76 
77                modifyListener = new ModifyListener(){
78 
79                        /* (non-Javadoc)
80                         * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
81                         */
82                        public void modifyText(ModifyEvent e) {
83                                ConfigurationTab.this.setDirty(true);
84                                ConfigurationTab.this.updateLaunchConfigurationDialog();
85                        }
86                };
87                selectionListener = new SelectionAdapter() {
88 
89                        /* (non-Javadoc)
90                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
91                         */
92                        public void widgetSelected(SelectionEvent e) {
93                                ConfigurationTab.this.setDirty(true);
94                                ConfigurationTab.this.updateLaunchConfigurationDialog();
95                        }
96                };
97 
98                // Create a new Composite to hold the page's controls.
99                // The composite will show scroll bars if the size of
100                // the dialog decreases below the minimum size of the
101                // contained controls:
102                ScrolledComposite container = new ScrolledComposite(parent,
103                                SWT.H_SCROLL | SWT.V_SCROLL);
104                container.setExpandHorizontal(true);
105                container.setExpandVertical(true);
106                Composite contentContainer = new Composite(container, SWT.NONE);
107                container.setContent(contentContainer);
108                GridLayout layout = new GridLayout();
109                contentContainer.setLayout(layout);
110 
111                // Sets the scrolled composite to be the displayed
112                // top-level control in this tab:
113                setControl(container);
114 
115                // Create temporary data location section
116                createTemporaryDataLocationSection(contentContainer);
117                createDeleteTemporaryDataAfterAnalysisSection(contentContainer);
118                createAccuracySection(contentContainer);
119 
120                // Create further sections as required:
121                createFurtherSections(contentContainer);
122 
123                // disabled widget
124                setTemporaryLocationElementsEnabled(false);
125 
126 
127                // After all internal controls have been created,
128                // calculate the minimal size of the contentContainer.
129                // Scrollbars will be shown if the dialog size decreases
130                // below the calculated min size:
131                container.setMinSize(contentContainer.computeSize(SWT.DEFAULT,
132                                SWT.DEFAULT));
133        }
134 
135        /**Creates the section for the accuracy analysis.
136         * @param container Container in which teh elements are created.
137         */
138        protected void createAccuracySection(Composite container) {
139                // Create accuracy section
140                final Group accuracyGroup = new Group(container, SWT.NONE);
141                accuracyGroup.setText(GROUP_ACCURACY_LABEL);
142                final GridData gd_accuracyGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
143                accuracyGroup.setLayoutData(gd_accuracyGroup);
144                accuracyGroup.setLayout(new GridLayout());
145                simulateAccuracyButton = new Button(accuracyGroup, SWT.CHECK);
146                simulateAccuracyButton.setLayoutData(gd_accuracyGroup);
147                simulateAccuracyButton.setText(BUTTON_SIMULATE_ACCURACY_LABEL);
148                simulateAccuracyButton.setSelection(false);
149                simulateAccuracyButton.addSelectionListener(selectionListener);
150                textAccuracyQualityAnnotationFile = new Text(accuracyGroup, SWT.SINGLE | SWT.BORDER);
151                textAccuracyQualityAnnotationFile.setLayoutData(gd_accuracyGroup);
152                textAccuracyQualityAnnotationFile.addModifyListener(modifyListener);
153                TabHelper.createFileInputSection(accuracyGroup, modifyListener,
154                                DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE_LABEL,
155                                ConstantsContainer.ACCURACY_QUALITY_ANNOTATION_EXTENSION,
156                                textAccuracyQualityAnnotationFile, getShell(), ConstantsContainer.DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE);
157        }
158 
159        /**Creates the section for the deletion of temporary data.
160         * @param container Container in which the elements are created.
161         */
162        protected void createDeleteTemporaryDataAfterAnalysisSection(Composite container) {
163                final Group clearGroup = new Group(container, SWT.NONE);
164                clearGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
165                clearGroup.setText("Temporary Data");
166                clearGroup.setLayout(new GridLayout());
167                clearButton = new Button(clearGroup,
168                                SWT.CHECK);
169                clearButton.setLayoutData( new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
170                clearButton.setText("Delete temporary data after analysis");
171                clearButton.addSelectionListener(selectionListener);
172        }
173 
174        /**Creates the section for the selection of the temporary data location.
175         * @param container Container in which the elements are created.
176         * @param modifyListener The lister to use on modifications.
177         */
178        protected void createTemporaryDataLocationSection(Composite container) {
179                final Group outputPathGroup = new Group(container, SWT.NONE);
180                outputPathGroup.setText("Location of temporary data");
181                final GridLayout gridLayout = new GridLayout();
182                gridLayout.numColumns = 4;
183                outputPathGroup.setLayout(gridLayout);
184                final GridData gd_outputPathGroup = new GridData(SWT.FILL, SWT.CENTER, true, false);
185                outputPathGroup.setLayoutData(gd_outputPathGroup);
186 
187                /** default temporary location button */
188                defaultLocationButton = new Button(outputPathGroup,
189                                SWT.CHECK);
190                final GridData gridData_dl = new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1);
191                defaultLocationButton.setLayoutData(gridData_dl);
192                defaultLocationButton.setText("Use default location");
193                defaultLocationButton.setSelection(true);
194                defaultLocationButton.addSelectionListener(new SelectionAdapter() {
195 
196                        /* (non-Javadoc)
197                         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
198                         */
199                        public void widgetSelected(SelectionEvent e) {
200                                setTemporaryLocationElementsEnabled(!defaultLocationButton.getSelection());
201 
202                                if (defaultLocationButton.getSelection() == true) {
203                                        temporaryLocationField.setText(ConstantsContainer.DEFAULT_TEMPORARY_DATA_LOCATION);
204                                }
205                                ConfigurationTab.this.setDirty(true);
206                                ConfigurationTab.this.updateLaunchConfigurationDialog();
207                        }
208                });
209 
210                temporaryLocationLabel = new Label(outputPathGroup, SWT.NONE);
211                temporaryLocationLabel.setLayoutData(new GridData(48, SWT.DEFAULT));
212                temporaryLocationLabel.setText("Location:");
213 
214                temporaryLocationField = new Text(outputPathGroup, SWT.BORDER);
215                final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true,
216                                false);
217                gridData.widthHint = 20;
218                temporaryLocationField.setLayoutData(gridData);
219                temporaryLocationField.setText(ConstantsContainer.DEFAULT_TEMPORARY_DATA_LOCATION);
220                temporaryLocationField.addModifyListener(modifyListener);
221        }
222 
223        /**
224         * Derived classes may add further sections here.
225         * @param container Container in which the elements are created.
226         */
227        protected void createFurtherSections(Composite container) {
228        }
229 
230        /**Set the enable-state for the elements in the temporary location section.
231         * @param enable
232         */
233        private void setTemporaryLocationElementsEnabled(boolean enable) {
234                temporaryLocationLabel.setEnabled(enable);
235                temporaryLocationField.setEnabled(enable);
236        }
237 
238        /**
239        /* (non-Javadoc)
240         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName()
241         */
242        public String getName() {
243                return "Analysis Configuration";
244        }
245 
246        /* (non-Javadoc)
247         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration)
248         */
249        public void initializeFrom(ILaunchConfiguration configuration) {
250                try {
251                        temporaryLocationField.setText(configuration.getAttribute(
252                                        ConstantsContainer.TEMPORARY_DATA_LOCATION, ConstantsContainer.DEFAULT_TEMPORARY_DATA_LOCATION));
253                        // set default selection button state
254                        if (temporaryLocationField.getText().equals(ConstantsContainer.DEFAULT_TEMPORARY_DATA_LOCATION)) {
255                                defaultLocationButton.setSelection(true);
256                                setTemporaryLocationElementsEnabled(false);
257                        } else {
258                                defaultLocationButton.setSelection(false);
259                                setTemporaryLocationElementsEnabled(true);
260                        }
261                } catch (CoreException e) {
262                        RunConfigPlugin.errorLogger(getName(),"Temporary Location Settings", e.getMessage());
263                        defaultLocationButton.setSelection(true);
264                }
265                try {
266                        clearButton
267                                        .setSelection(configuration
268                                                        .getAttribute(
269                                                                        ConstantsContainer.DELETE_TEMPORARY_DATA_AFTER_ANALYSIS,
270                                                                        ConstantsContainer.DEFAULT_DELETE_TEMPORARY_DATA_AFTER_ANALYSIS));
271                } catch (CoreException e) {
272                        RunConfigPlugin.errorLogger(getName(), "Delete temporaray data after analysis.", e.getMessage());
273                }
274                try {
275                        simulateAccuracyButton.setSelection(configuration.getAttribute(
276                                        ConstantsContainer.ANALYSE_ACCURACY,
277                                        ConstantsContainer.DEFAULT_ANALYSE_ACCURACY));
278                        textAccuracyQualityAnnotationFile.setText(configuration.getAttribute(
279                                        ConstantsContainer.ACCURACY_QUALITY_ANNOTATION_FILE,
280                                        ConstantsContainer.DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE));
281                } catch (CoreException e) {
282                        simulateAccuracyButton.setSelection(ConstantsContainer.DEFAULT_ANALYSE_ACCURACY);
283                        textAccuracyQualityAnnotationFile.setText(ConstantsContainer.DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE);
284                }
285        }
286 
287        /* (non-Javadoc)
288         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
289         */
290        public void performApply(ILaunchConfigurationWorkingCopy configuration) {
291                configuration.setAttribute(ConstantsContainer.TEMPORARY_DATA_LOCATION,
292                                temporaryLocationField.getText());
293                configuration.setAttribute(
294                                ConstantsContainer.DELETE_TEMPORARY_DATA_AFTER_ANALYSIS,
295                                clearButton.getSelection());
296                configuration.setAttribute(ConstantsContainer.ANALYSE_ACCURACY,
297                                this.simulateAccuracyButton.getSelection());
298                configuration.setAttribute(
299                                ConstantsContainer.ACCURACY_QUALITY_ANNOTATION_FILE,
300                                this.textAccuracyQualityAnnotationFile.getText());
301        }
302 
303        /* (non-Javadoc)
304         * @see org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug.core.ILaunchConfigurationWorkingCopy)
305         */
306        public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
307                configuration.setAttribute(ConstantsContainer.TEMPORARY_DATA_LOCATION,
308                                ConstantsContainer.DEFAULT_TEMPORARY_DATA_LOCATION);
309                configuration
310                                .setAttribute(
311                                                ConstantsContainer.DELETE_TEMPORARY_DATA_AFTER_ANALYSIS,
312                                                ConstantsContainer.DEFAULT_DELETE_TEMPORARY_DATA_AFTER_ANALYSIS);
313                configuration.setAttribute(ConstantsContainer.ANALYSE_ACCURACY,
314                                ConstantsContainer.DEFAULT_ANALYSE_ACCURACY);
315                configuration.setAttribute(
316                                ConstantsContainer.ACCURACY_QUALITY_ANNOTATION_FILE,
317                                ConstantsContainer.DEFAULT_ACCURACY_QUALITY_ANNOTATION_FILE);
318        }
319 
320        public boolean isValid(ILaunchConfiguration launchConfig) {
321                setErrorMessage(null);
322 
323                if (temporaryLocationField.getText().equals("")){
324                        setErrorMessage("The location for temporary data is missing.");
325                        return false;
326                }
327                if (simulateAccuracyButton.getSelection() == true
328                                && !TabHelper.validateFilenameExtension(
329                                                textAccuracyQualityAnnotationFile.getText(),
330                                                ConstantsContainer.ACCURACY_QUALITY_ANNOTATION_EXTENSION)) {
331                        setErrorMessage("Quality Annotation File must be present for accuracy influence analysis.");
332                        return false;
333                }
334                return true;
335        }
336 
337        @Override
338        public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
339                // Leave this method empty to prevent unnecessary invocation of
340                // initializeFrom() and multiple resulting invocations of
341                // performApply().
342        }
343 
344        @Override
345        public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) {
346                // intentionally left blank
347        }
348 
349}

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