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

COVERAGE SUMMARY FOR SOURCE FILE [OpenDatasourceWizard.java]

nameclass, %method, %block, %line, %
OpenDatasourceWizard.java0%   (0/1)0%   (0/5)0%   (0/113)0%   (0/38)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OpenDatasourceWizard0%   (0/1)0%   (0/5)0%   (0/113)0%   (0/38)
OpenDatasourceWizard (): void 0%   (0/1)0%   (0/6)0%   (0/3)
addPages (): void 0%   (0/1)0%   (0/38)0%   (0/11)
canFinish (): boolean 0%   (0/1)0%   (0/12)0%   (0/4)
getNextPage (IWizardPage): IWizardPage 0%   (0/1)0%   (0/16)0%   (0/6)
performFinish (): boolean 0%   (0/1)0%   (0/41)0%   (0/14)

1/**
2 * 
3 */
4package de.uka.ipd.sdq.sensorframework.dialogs.dataset;
5 
6import org.eclipse.core.resources.IResource;
7import org.eclipse.core.runtime.IPath;
8import org.eclipse.core.runtime.IStatus;
9import org.eclipse.jface.dialogs.MessageDialog;
10import org.eclipse.jface.wizard.IWizardPage;
11import org.eclipse.jface.wizard.Wizard;
12 
13import de.uka.ipd.sdq.sensorframework.SensorFrameworkDataset;
14import de.uka.ipd.sdq.sensorframework.dao.file.FileDAOFactory;
15import de.uka.ipd.sdq.sensorframework.dialogs.SensorFrameworkDialogPlugin;
16import de.uka.ipd.sdq.sensorframework.entities.dao.IDAOFactory;
17 
18/**
19 * The OpenDatasourceWizard allows the user to choose which data source file to
20 * run.
21 * 
22 * @author Roman Andrej
23 */
24public class OpenDatasourceWizard extends Wizard {
25 
26        
27        private WizardDatasourceLoadPage db40DatasourceLoadPage, fileDatasourceLoadPage;
28        private WizardSelectDatasourcePage selectDatasourceTypePage;
29 
30        public OpenDatasourceWizard() {
31                super();
32                this.setWindowTitle("Load datastore...");
33        }
34 
35        /* (non-Javadoc)
36         * @see org.eclipse.jface.wizard.Wizard#addPages()
37         */
38        @Override
39        public void addPages() {
40                super.addPages();
41 
42                selectDatasourceTypePage = new WizardSelectDatasourcePage(
43                                "Select Type of Datasource to load", false, true, true);
44                this.addPage(selectDatasourceTypePage);
45 
46                db40DatasourceLoadPage = new WizardDatasourceLoadPage("Open the database file",
47                                IResource.FILE);
48                this.addPage(db40DatasourceLoadPage);
49 
50                fileDatasourceLoadPage = new WizardDatasourceLoadPage(
51                                "Open the database folder", IResource.FOLDER);
52                this.addPage(fileDatasourceLoadPage);
53        }
54 
55        
56        /* (non-Javadoc)
57         * @see org.eclipse.jface.wizard.Wizard#performFinish()
58         */
59        @Override
60        public boolean performFinish() {
61                IDAOFactory factory = null;
62                IPath path = null;
63 
64                if (selectDatasourceTypePage.getResult().equals(
65                                WizardSelectDatasourcePage.FILE_DATASRC)) {
66                        path = fileDatasourceLoadPage.getFileFullPath();
67 
68                        try {
69                                factory = new FileDAOFactory(path.toOSString());
70                                SensorFrameworkDataset.singleton().addDataSource(factory);
71                        } catch (Throwable e) {
72                                MessageDialog.openError(getShell(), "File DAO factory error.",
73                                                e.getMessage());
74                                SensorFrameworkDialogPlugin.log(IStatus.ERROR, e.getMessage());
75                                return false;
76                        }
77 
78                } else {
79                        return false;
80                }
81 
82                return true;
83        }
84 
85        
86        /* (non-Javadoc)
87         * @see org.eclipse.jface.wizard.Wizard#canFinish()
88         */
89        @Override
90        public boolean canFinish() {
91                if (selectDatasourceTypePage.getResult().equals(
92                                WizardSelectDatasourcePage.FILE_DATASRC)) {
93                        return fileDatasourceLoadPage.isPageComplete();
94                }
95                return false;
96        }
97        
98        
99        /* (non-Javadoc)
100         * @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
101         */
102        @Override
103        public IWizardPage getNextPage(IWizardPage page) {
104 
105                if (page instanceof WizardSelectDatasourcePage) {
106                        WizardSelectDatasourcePage data_type_page = (WizardSelectDatasourcePage) page;
107                        if (data_type_page.getResult().equals(
108                                        WizardSelectDatasourcePage.FILE_DATASRC)) {
109                                return fileDatasourceLoadPage;
110                        }
111                }
112                return null;
113        }
114}

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