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 [RepositoryProjectWizard.java]

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

COVERAGE BREAKDOWN BY CLASS AND METHOD

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

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