1 /*******************************************************************************
2 * Copyright (c) 2009, 2013 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Francois Chouinard - Initial API and implementation
11 * Bernd Hufmann - Moved project creation utility method to TmfProjectRegistry
12 *******************************************************************************/
14 package org
.eclipse
.linuxtools
.tmf
.ui
.project
.wizards
;
18 import org
.eclipse
.core
.resources
.IProject
;
19 import org
.eclipse
.core
.runtime
.CoreException
;
20 import org
.eclipse
.core
.runtime
.IConfigurationElement
;
21 import org
.eclipse
.core
.runtime
.IExecutableExtension
;
22 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
23 import org
.eclipse
.jface
.viewers
.IStructuredSelection
;
24 import org
.eclipse
.jface
.wizard
.Wizard
;
25 import org
.eclipse
.linuxtools
.internal
.tmf
.ui
.Activator
;
26 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfProjectRegistry
;
27 import org
.eclipse
.ui
.INewWizard
;
28 import org
.eclipse
.ui
.IWorkbench
;
29 import org
.eclipse
.ui
.wizards
.newresource
.BasicNewProjectResourceWizard
;
32 * Wizard implementation for creating a TMF tracing project.
35 * @author Francois Chouinard
37 public class NewTmfProjectWizard
extends Wizard
implements INewWizard
, IExecutableExtension
{
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
48 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.views.ui.wizards.newProject"; //$NON-NLS-1$
50 // ------------------------------------------------------------------------
52 // ------------------------------------------------------------------------
54 private final String fTtitle
;
55 private final String fDescription
;
60 protected NewTmfProjectMainWizardPage fMainPage
;
65 protected String fProjectName
;
68 * The project location
71 protected URI fProjectLocation
;
74 * The configuration element.
76 protected IConfigurationElement fConfigElement
;
79 * The project reference
81 protected IProject fProject
;
83 // ------------------------------------------------------------------------
85 // ------------------------------------------------------------------------
90 public NewTmfProjectWizard() {
91 this(Messages
.NewProjectWizard_DialogHeader
, Messages
.NewProjectWizard_DialogMessage
);
96 * @param title The tile string
97 * @param desc The description string
99 public NewTmfProjectWizard(String title
, String desc
) {
101 setDialogSettings(Activator
.getDefault().getDialogSettings());
102 setNeedsProgressMonitor(true);
103 setForcePreviousAndNextButtons(true);
104 setWindowTitle(title
);
109 // ------------------------------------------------------------------------
111 // ------------------------------------------------------------------------
114 public void addPages() {
115 fMainPage
= new NewTmfProjectMainWizardPage(Messages
.NewProjectWizard_DialogHeader
);
116 fMainPage
.setTitle(fTtitle
);
117 fMainPage
.setDescription(fDescription
);
122 public boolean performCancel() {
127 public boolean performFinish() {
128 fProjectName
= fMainPage
.getProjectName();
129 fProjectLocation
= fMainPage
.useDefaults() ?
null : fMainPage
.getLocationURI();
130 fProject
= TmfProjectRegistry
.createProject(fProjectName
, fProjectLocation
, new NullProgressMonitor());
131 BasicNewProjectResourceWizard
.updatePerspective(fConfigElement
);
135 // ------------------------------------------------------------------------
137 // ------------------------------------------------------------------------
140 public void init(IWorkbench iworkbench
, IStructuredSelection istructuredselection
) {
143 // ------------------------------------------------------------------------
144 // IExecutableExtension
145 // ------------------------------------------------------------------------
148 public void setInitializationData(IConfigurationElement config
, String propertyName
, Object data
) throws CoreException
{
149 fConfigElement
= config
;