1 /*******************************************************************************
2 * Copyright (c) 2009, 2014 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
.tracecompass
.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
.tracecompass
.internal
.tmf
.ui
.Activator
;
26 import org
.eclipse
.tracecompass
.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.
34 * @author Francois Chouinard
36 public class NewTmfProjectWizard
extends Wizard
implements INewWizard
, IExecutableExtension
{
38 // ------------------------------------------------------------------------
40 // ------------------------------------------------------------------------
45 public static final String ID
= "org.eclipse.linuxtools.tmf.ui.views.ui.wizards.newProject"; //$NON-NLS-1$
47 // ------------------------------------------------------------------------
49 // ------------------------------------------------------------------------
51 private final String fTtitle
;
52 private final String fDescription
;
57 protected NewTmfProjectMainWizardPage fMainPage
;
62 protected String fProjectName
;
65 * The project location
68 protected URI fProjectLocation
;
71 * The configuration element.
73 protected IConfigurationElement fConfigElement
;
76 * The project reference
78 protected IProject fProject
;
80 // ------------------------------------------------------------------------
82 // ------------------------------------------------------------------------
87 public NewTmfProjectWizard() {
88 this(Messages
.NewProjectWizard_DialogHeader
, Messages
.NewProjectWizard_DialogMessage
);
93 * @param title The tile string
94 * @param desc The description string
96 public NewTmfProjectWizard(String title
, String desc
) {
98 setDialogSettings(Activator
.getDefault().getDialogSettings());
99 setNeedsProgressMonitor(true);
100 setForcePreviousAndNextButtons(true);
101 setWindowTitle(title
);
106 // ------------------------------------------------------------------------
108 // ------------------------------------------------------------------------
111 public void addPages() {
112 fMainPage
= new NewTmfProjectMainWizardPage(Messages
.NewProjectWizard_DialogHeader
);
113 fMainPage
.setTitle(fTtitle
);
114 fMainPage
.setDescription(fDescription
);
119 public boolean performCancel() {
124 public boolean performFinish() {
125 fProjectName
= fMainPage
.getProjectName();
126 fProjectLocation
= fMainPage
.useDefaults() ?
null : fMainPage
.getLocationURI();
127 fProject
= TmfProjectRegistry
.createProject(fProjectName
, fProjectLocation
, new NullProgressMonitor());
128 BasicNewProjectResourceWizard
.updatePerspective(fConfigElement
);
132 // ------------------------------------------------------------------------
134 // ------------------------------------------------------------------------
137 public void init(IWorkbench iworkbench
, IStructuredSelection istructuredselection
) {
140 // ------------------------------------------------------------------------
141 // IExecutableExtension
142 // ------------------------------------------------------------------------
145 public void setInitializationData(IConfigurationElement config
, String propertyName
, Object data
) throws CoreException
{
146 fConfigElement
= config
;