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

COVERAGE SUMMARY FOR SOURCE FILE [NewPalladioProjectWizard.java]

nameclass, %method, %block, %line, %
NewPalladioProjectWizard.java0%   (0/1)0%   (0/4)0%   (0/109)0%   (0/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class NewPalladioProjectWizard0%   (0/1)0%   (0/4)0%   (0/109)0%   (0/32)
NewPalladioProjectWizard (): void 0%   (0/1)0%   (0/6)0%   (0/3)
addPages (): void 0%   (0/1)0%   (0/32)0%   (0/9)
init (IWorkbench, IStructuredSelection): void 0%   (0/1)0%   (0/7)0%   (0/3)
performFinish (): boolean 0%   (0/1)0%   (0/64)0%   (0/17)

1package de.uka.ipd.sdq.pcmbench.wizards;
2 
3import org.eclipse.core.resources.IProject;
4import org.eclipse.core.resources.IProjectDescription;
5import org.eclipse.core.resources.IWorkspace;
6import org.eclipse.core.resources.ResourcesPlugin;
7import org.eclipse.core.runtime.CoreException;
8import org.eclipse.core.runtime.IStatus;
9import org.eclipse.jface.dialogs.IMessageProvider;
10import org.eclipse.jface.viewers.IStructuredSelection;
11import org.eclipse.jface.wizard.Wizard;
12import org.eclipse.ui.INewWizard;
13import org.eclipse.ui.IWorkbench;
14import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
15 
16import de.uka.ipd.sdq.pcmbench.PCMBenchActivator;
17 
18public class NewPalladioProjectWizard extends Wizard implements INewWizard {
19 
20        private IWorkbench workbench;
21        private IStructuredSelection selection;
22        private WizardNewProjectCreationPage page;
23        private IWorkspace workspace;
24 
25        public NewPalladioProjectWizard() {
26                workspace = ResourcesPlugin.getWorkspace();
27        }
28 
29        @Override
30        public boolean performFinish() {
31                IProject newProject = workspace.getRoot().getProject(page.getProjectName());
32                try {
33                        if (!newProject.exists())
34                                newProject.create(null);
35                        newProject.open(null);
36                        IProjectDescription description = newProject.getDescription();
37                        String[] natures = description.getNatureIds();
38                        String[] newNatures = new String[natures.length + 1];
39                        System.arraycopy(natures, 0, newNatures, 0, natures.length);
40                        newNatures[natures.length] = "de.uka.ipd.sdq.pcmbench.nature";
41                        IStatus status = workspace.validateNatureSet(natures);
42 
43                        // check the status and decide what to do
44                        if (status.getCode() == IStatus.OK) {
45                                description.setNatureIds(newNatures);
46                                newProject.setDescription(description, null);
47                        } else {
48                                // raise a user error
49                        }
50                } catch (CoreException e) {
51                        // TODO Auto-generated catch block
52                        e.printStackTrace();
53                        return false;
54                }
55                return true;
56        }
57 
58        public void init(IWorkbench workbench, IStructuredSelection selection) {
59                this.workbench = workbench;
60                this.selection = selection;
61        }
62 
63        /* (non-Javadoc)
64         * @see org.eclipse.jface.wizard.Wizard#addPages()
65         */
66        @Override
67        public void addPages() {
68                page = new WizardNewProjectCreationPage("Create New Palladio Project");
69                page.setDescription("Create a new Palladio Repository Modelling Project. "+
70                                "This type of project is used to specify component repositories.");
71                page.setMessage(page.getDescription(),IMessageProvider.INFORMATION);
72                page.setImageDescriptor(PCMBenchActivator.imageDescriptorFromPlugin(
73                                        PCMBenchActivator.PLUGIN_ID,
74                                        "icons/palladio-logo.gif"));
75                page.setTitle("Create a PCM Repository Modelling Project");
76                this.addPage(page);
77        }
78 
79}

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