1 /*******************************************************************************
2 * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
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 * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path
12 * Francois Chouinard - Rebase on TMF NewProjectWizard
13 *******************************************************************************/
15 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.project
.dialogs
;
17 import org
.eclipse
.core
.resources
.IProject
;
18 import org
.eclipse
.core
.resources
.IProjectDescription
;
19 import org
.eclipse
.core
.runtime
.CoreException
;
20 import org
.eclipse
.linuxtools
.lttng
.core
.LTTngProjectNature
;
21 import org
.eclipse
.linuxtools
.lttng
.core
.TraceHelper
;
22 import org
.eclipse
.linuxtools
.tmf
.core
.TmfProjectNature
;
23 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.wizards
.NewTmfProjectWizard
;
26 * <b><u>NewLTTngProjectWizard</u></b>
29 public class NewLTTngProjectWizard
extends NewTmfProjectWizard
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 private static final String TRACE_LIBRARY_PATH
= "traceLibraryPath"; //$NON-NLS-1$
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
41 private TraceLibraryPathWizardPage traceLibraryPathPage
;
43 // ------------------------------------------------------------------------
45 // ------------------------------------------------------------------------
47 public NewLTTngProjectWizard() {
48 this(Messages
.NewProjectWizard_Title
, Messages
.NewProjectWizard_Description
);
51 public NewLTTngProjectWizard(String title
, String desc
) {
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
60 public void addPages() {
62 traceLibraryPathPage
= new TraceLibraryPathWizardPage(Messages
.NewProjectWizard_Title
);
63 traceLibraryPathPage
.setTitle(Messages
.TraceLibraryPathWizardPage_Title
);
64 traceLibraryPathPage
.setDescription(Messages
.TraceLibraryPathWizardPage_Description
);
65 addPage(traceLibraryPathPage
);
69 public boolean performFinish() {
70 // Create the tracing project
71 super.performFinish();
73 // Add the LTTng nature
75 IProjectDescription description
= fProject
.getDescription();
76 description
.setNatureIds(new String
[] { TmfProjectNature
.ID
, LTTngProjectNature
.ID
});
77 fProject
.setDescription(description
, null);
78 } catch (CoreException e
) {
81 // Set the library path
82 String traceLibraryPath
= traceLibraryPathPage
.getPath();
83 if (traceLibraryPath
!= null) {
84 return TraceHelper
.setProjectPreference(fProject
, TRACE_LIBRARY_PATH
, traceLibraryPath
);
90 // ------------------------------------------------------------------------
92 // ------------------------------------------------------------------------
94 public IProject
getProject() {