org.eclipse.linuxtools.tmf.core;bundle-version="0.3.2",
org.eclipse.linuxtools.tmf.ui;bundle-version="0.3.2",
org.eclipse.linuxtools.lttng.core;bundle-version="0.3.2",
+ org.eclipse.tm.tcf.core;bundle-version="0.4.0",
org.eclipse.rse.core;bundle-version="3.2.0",
org.eclipse.rse.services;bundle-version="3.2.100",
org.eclipse.rse.subsystems.files.core;bundle-version="3.2.100",
- org.eclipse.rse.ui;bundle-version="3.2.0",
- org.eclipse.tm.tcf.core;bundle-version="0.4.0"
+ org.eclipse.rse.ui;bundle-version="3.2.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
point="org.eclipse.ui.perspectives">
<perspective
class="org.eclipse.linuxtools.lttng.ui.views.PerspectiveFactory"
- icon="icons/obj16/garland16.png"
+ icon="icons/obj16/tux.png"
id="org.eclipse.linuxtools.lttng.ui.perspective"
name="%perspective.category.name">
</perspective>
</category>
<wizard
category="org.eclipse.linuxtools.lttng.ui.wizards.new"
- class="org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewProjectWizard"
+ class="org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewLTTngProjectWizard"
descriptionImage="icons/obj16/garland16.png"
finalPerspective="org.eclipse.linuxtools.lttng.ui.perspective"
icon="icons/obj16/garland16.png"
<type
category="org.eclipse.linuxtools.lttng.ui.category.lttng"
event_type="org.eclipse.linuxtools.lttng.event.LttngEvent"
- icon="icons/obj16/garland16.gif"
+ icon="icons/obj16/tux2.png"
id="org.eclipse.linuxtools.lttng.tracetype.kernel"
name="%tracetype.type.kernel"
trace_type="org.eclipse.linuxtools.lttng.trace.LTTngTrace">
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
+
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+/**
+ * <b><u>NewProjectMainWizardPage</u></b>
+ * <p>
+ *
+ * TODO: Implement me. Please.
+ */
+public class NewLTTngProjectMainWizardPage extends WizardNewProjectCreationPage {
+
+ /**
+ * @param pageName
+ */
+ public NewLTTngProjectMainWizardPage(String pageName) {
+ super(pageName);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path
+ * Francois Chouinard - Rebase on TMF NewProjectWizard
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.linuxtools.lttng.LTTngProjectNature;
+import org.eclipse.linuxtools.lttng.TraceHelper;
+import org.eclipse.linuxtools.tmf.TmfProjectNature;
+import org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard;
+
+/**
+ * <b><u>NewLTTngProjectWizard</u></b>
+ * <p>
+ */
+public class NewLTTngProjectWizard extends NewTmfProjectWizard {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final String TRACE_LIBRARY_PATH = "traceLibraryPath"; //$NON-NLS-1$
+
+ // ------------------------------------------------------------------------
+ // Variables
+ // ------------------------------------------------------------------------
+
+ private TraceLibraryPathWizardPage traceLibraryPathPage;
+
+ // ------------------------------------------------------------------------
+ // Construction
+ // ------------------------------------------------------------------------
+
+ public NewLTTngProjectWizard() {
+ this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description);
+ }
+
+ public NewLTTngProjectWizard(String title, String desc) {
+ super(title, desc);
+ }
+
+ // ------------------------------------------------------------------------
+ // NewProjectWizard
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ traceLibraryPathPage = new TraceLibraryPathWizardPage(Messages.NewProjectWizard_Title);
+ traceLibraryPathPage.setTitle(Messages.TraceLibraryPathWizardPage_Title);
+ traceLibraryPathPage.setDescription(Messages.TraceLibraryPathWizardPage_Description);
+ addPage(traceLibraryPathPage);
+ }
+
+ @Override
+ public boolean performFinish() {
+ // Create the tracing project
+ super.performFinish();
+
+ // Add the LTTng nature
+ try {
+ IProjectDescription description = fProject.getDescription();
+ description.setNatureIds(new String[] { TmfProjectNature.ID, LTTngProjectNature.ID });
+ fProject.setDescription(description, null);
+ } catch (CoreException e) {
+ }
+
+ // Set the library path
+ String traceLibraryPath = traceLibraryPathPage.getPath();
+ if (traceLibraryPath != null) {
+ return TraceHelper.setProjectPreference(fProject, TRACE_LIBRARY_PATH, traceLibraryPath);
+ }
+
+ return true;
+ }
+
+ // ------------------------------------------------------------------------
+ // Operations
+ // ------------------------------------------------------------------------
+
+ public IProject getProject() {
+ return fProject;
+ }
+
+}
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
-
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * <b><u>NewProjectMainWizardPage</u></b>
- * <p>
- *
- * TODO: Implement me. Please.
- */
-public class NewProjectMainWizardPage extends WizardNewProjectCreationPage {
-
- /**
- * @param pageName
- */
- public NewProjectMainWizardPage(String pageName) {
- super(pageName);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson, MontaVista Software
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- * Yufen Kuo (ykuo@mvista.com) - add support to allow user specify trace library path
- *******************************************************************************/
-
-package org.eclipse.linuxtools.lttng.ui.views.project.dialogs;
-
-import java.net.URI;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.linuxtools.lttng.LTTngProjectNature;
-import org.eclipse.linuxtools.lttng.TraceHelper;
-import org.eclipse.linuxtools.lttng.ui.LTTngUiPlugin;
-import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectNode;
-import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
-/**
- * <b><u>NewProjectWizard</u></b>
- * <p>
- * TODO: Implement me. Please.
- */
-public class NewProjectWizard extends BasicNewResourceWizard {
-
- private String fTtitle;
- private String fDescription;
-
- protected NewProjectMainWizardPage fMainPage;
- protected String fProjectName;
- protected URI fProjectLocation;
- protected IConfigurationElement fConfigElement;
-
- protected IProject fProject;
- private TraceLibraryPathWizardPage traceLibraryPathPage;
-
- /**
- *
- */
- public NewProjectWizard() {
- this(Messages.NewProjectWizard_Title, Messages.NewProjectWizard_Description);
- }
-
- /**
- * @param title
- * @param desc
- */
- public NewProjectWizard(String title, String desc) {
- super();
- setDialogSettings(LTTngUiPlugin.getDefault().getDialogSettings());
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- setWindowTitle(title);
- fTtitle = title;
- fDescription = desc;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- @Override
- public void addPages() {
- fMainPage= new NewProjectMainWizardPage(Messages.NewProjectWizard_Title);
- fMainPage.setTitle(fTtitle);
- fMainPage.setDescription(fDescription);
- addPage(fMainPage);
- traceLibraryPathPage = new TraceLibraryPathWizardPage(Messages.NewProjectWizard_Title);
- traceLibraryPathPage.setTitle(Messages.TraceLibraryPathWizardPage_Title);
- traceLibraryPathPage.setDescription(Messages.TraceLibraryPathWizardPage_Description);
- addPage(traceLibraryPathPage);
-
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performCancel()
- */
- @Override
- public boolean performCancel() {
- return true;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- fProjectName = fMainPage.getProjectName();
- fProjectLocation = fMainPage.useDefaults() ? null : fMainPage.getLocationURI();
- fProject = createProject(fProjectName, fProjectLocation, new NullProgressMonitor());
- String traceLibraryPath = traceLibraryPathPage.getPath();
- if (traceLibraryPath != null){
- return TraceHelper.setProjectPreference(fProject, "traceLibraryPath", traceLibraryPath);
- }
- return true;
- }
-
- public IProject getProject() {
- return fProject;
- }
-
- /**
- * @param projectName
- * @param projectLocation
- * @param monitor
- * @return
- */
- private IProject createProject(String projectName, URI projectLocation, IProgressMonitor monitor) {
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IProject project = root.getProject(projectName);
-
- try {
- if (!project.exists()) {
- IProjectDescription description = workspace.newProjectDescription(project.getName());
- if (projectLocation != null)
- description.setLocationURI(projectLocation);
- project.create(description, monitor);
- }
-
- if (!project.isOpen())
- project.open(monitor);
-
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { LTTngProjectNature.ID } );
- project.setDescription(description, null);
-
- IFolder folder = project.getFolder(LTTngProjectNode.TRACE_FOLDER_NAME);
- if (!folder.exists())
- folder.create(true, true, null);
-
- folder = project.getFolder(LTTngProjectNode.EXPER_FOLDER_NAME);
- if (!folder.exists())
- folder.create(true, true, null);
-
- return project;
- }
- catch (CoreException e) {
- e.printStackTrace();
- }
- return null;
- }
-
-}
\ No newline at end of file
import org.eclipse.jface.window.Window;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.linuxtools.lttng.ui.views.project.ProjectView;
-import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewProjectWizard;
+import org.eclipse.linuxtools.lttng.ui.views.project.dialogs.NewLTTngProjectWizard;
import org.eclipse.linuxtools.lttng.ui.views.project.model.LTTngProjectRoot;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPart;
// Fire the New Project Wizard
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- NewProjectWizard wizard = new NewProjectWizard();
+ NewLTTngProjectWizard wizard = new NewLTTngProjectWizard();
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.open();
org.eclipse.linuxtools.tmf.ui.editors,
org.eclipse.linuxtools.tmf.ui.parsers,
org.eclipse.linuxtools.tmf.ui.project.model,
+ org.eclipse.linuxtools.tmf.ui.project.wizards,
org.eclipse.linuxtools.tmf.ui.signal,
org.eclipse.linuxtools.tmf.ui.viewers,
org.eclipse.linuxtools.tmf.ui.viewers.events,
</category>\r
<wizard\r
category="org.eclipse.linuxtools.tmf.ui.wizards.new"\r
- class="org.eclipse.linuxtools.tmf.ui.project.wizards.NewProjectWizard"\r
+ class="org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard"\r
icon="icons/elcl16/new_tracing_prj.gif"\r
id="org.eclipse.linuxtools.tmf.ui.views.ui.wizards.newProject"\r
name="%project.new.wizard.name"\r
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.project.wizards;
-
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-
-/**
- * <b><u>NewProjectMainWizardPage</u></b>
- * <p>
- *
- * TODO: Implement me. Please.
- */
-public class NewProjectMainWizardPage extends WizardNewProjectCreationPage {
-
- /**
- * @param pageName
- */
- public NewProjectMainWizardPage(String pageName) {
- super(pageName);
- }
-
-}
+++ /dev/null
-/*******************************************************************************
- * Copyright (c) 2009, 2011 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Francois Chouinard - Initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.linuxtools.tmf.ui.project.wizards;
-
-import java.net.URI;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.linuxtools.tmf.TmfProjectNature;
-import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
-import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentFolder;
-import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
-import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
-import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
-/**
- * <b><u>NewProjectWizard</u></b>
- * <p>
- */
-public class NewProjectWizard extends BasicNewResourceWizard implements IExecutableExtension {
-
- private final String fTtitle;
- private final String fDescription;
-
- protected NewProjectMainWizardPage fMainPage;
- protected String fProjectName;
- protected URI fProjectLocation;
- protected IConfigurationElement fConfigElement;
-
- protected IProject fProject;
-
- /**
- *
- */
- public NewProjectWizard() {
- this(Messages.NewProjectWizard_DialogHeader, Messages.NewProjectWizard_DialogMessage);
- }
-
- /**
- * @param title
- * @param desc
- */
- public NewProjectWizard(String title, String desc) {
- super();
- setDialogSettings(TmfUiPlugin.getDefault().getDialogSettings());
- setNeedsProgressMonitor(true);
- setForcePreviousAndNextButtons(true);
- setWindowTitle(title);
- fTtitle = title;
- fDescription = desc;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
- @Override
- public void addPages() {
- fMainPage = new NewProjectMainWizardPage(Messages.NewProjectWizard_DialogHeader);
- fMainPage.setTitle(fTtitle);
- fMainPage.setDescription(fDescription);
- addPage(fMainPage);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performCancel()
- */
- @Override
- public boolean performCancel() {
- return true;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
- @Override
- public boolean performFinish() {
- fProjectName = fMainPage.getProjectName();
- fProjectLocation = fMainPage.useDefaults() ? null : fMainPage.getLocationURI();
- fProject = createProject(fProjectName, fProjectLocation, new NullProgressMonitor());
- BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
- return true;
- }
-
- /**
- * @param projectName
- * @param projectLocation
- * @param monitor
- * @return
- */
- private IProject createProject(String projectName, URI projectLocation, IProgressMonitor monitor) {
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = workspace.getRoot();
- IProject project = root.getProject(projectName);
-
- try {
- if (!project.exists()) {
- IProjectDescription description = workspace.newProjectDescription(project.getName());
- if (projectLocation != null)
- description.setLocationURI(projectLocation);
- project.create(description, monitor);
- }
-
- if (!project.isOpen())
- project.open(monitor);
-
- IProjectDescription description = project.getDescription();
- description.setNatureIds(new String[] { TmfProjectNature.ID });
- project.setDescription(description, null);
-
- IFolder folder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
- if (!folder.exists())
- folder.create(true, true, null);
-
- folder = project.getFolder(TmfExperimentFolder.EXPER_FOLDER_NAME);
- if (!folder.exists())
- folder.create(true, true, null);
-
- return project;
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- // ------------------------------------------------------------------------
- // IExecutableExtension
- // ------------------------------------------------------------------------
-
- @Override
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- fConfigElement = config;
- }
-
-}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.project.wizards;
+
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+/**
+ * <b><u>NewProjectMainWizardPage</u></b>
+ * <p>
+ *
+ * TODO: Implement me. Please.
+ */
+public class NewTmfProjectMainWizardPage extends WizardNewProjectCreationPage {
+
+ /**
+ * @param pageName
+ */
+ public NewTmfProjectMainWizardPage(String pageName) {
+ super(pageName);
+ }
+
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Francois Chouinard - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.tmf.ui.project.wizards;
+
+import java.net.URI;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExecutableExtension;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.linuxtools.tmf.TmfProjectNature;
+import org.eclipse.linuxtools.tmf.ui.TmfUiPlugin;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfExperimentFolder;
+import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceFolder;
+import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
+import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
+
+/**
+ * <b><u>NewTmfProjectWizard</u></b>
+ * <p>
+ */
+public class NewTmfProjectWizard extends BasicNewResourceWizard implements IExecutableExtension {
+
+ private final String fTtitle;
+ private final String fDescription;
+
+ protected NewTmfProjectMainWizardPage fMainPage;
+ protected String fProjectName;
+ protected URI fProjectLocation;
+ protected IConfigurationElement fConfigElement;
+
+ protected IProject fProject;
+
+ /**
+ *
+ */
+ public NewTmfProjectWizard() {
+ this(Messages.NewProjectWizard_DialogHeader, Messages.NewProjectWizard_DialogMessage);
+ }
+
+ /**
+ * @param title
+ * @param desc
+ */
+ public NewTmfProjectWizard(String title, String desc) {
+ super();
+ setDialogSettings(TmfUiPlugin.getDefault().getDialogSettings());
+ setNeedsProgressMonitor(true);
+ setForcePreviousAndNextButtons(true);
+ setWindowTitle(title);
+ fTtitle = title;
+ fDescription = desc;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ fMainPage = new NewTmfProjectMainWizardPage(Messages.NewProjectWizard_DialogHeader);
+ fMainPage.setTitle(fTtitle);
+ fMainPage.setDescription(fDescription);
+ addPage(fMainPage);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performCancel()
+ */
+ @Override
+ public boolean performCancel() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.wizard.Wizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ fProjectName = fMainPage.getProjectName();
+ fProjectLocation = fMainPage.useDefaults() ? null : fMainPage.getLocationURI();
+ fProject = createProject(fProjectName, fProjectLocation, new NullProgressMonitor());
+ BasicNewProjectResourceWizard.updatePerspective(fConfigElement);
+ return true;
+ }
+
+ /**
+ * @param projectName
+ * @param projectLocation
+ * @param monitor
+ * @return
+ */
+ private IProject createProject(String projectName, URI projectLocation, IProgressMonitor monitor) {
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceRoot root = workspace.getRoot();
+ IProject project = root.getProject(projectName);
+
+ try {
+ if (!project.exists()) {
+ IProjectDescription description = workspace.newProjectDescription(project.getName());
+ if (projectLocation != null)
+ description.setLocationURI(projectLocation);
+ project.create(description, monitor);
+ }
+
+ if (!project.isOpen())
+ project.open(monitor);
+
+ IProjectDescription description = project.getDescription();
+ description.setNatureIds(new String[] { TmfProjectNature.ID });
+ project.setDescription(description, null);
+
+ IFolder folder = project.getFolder(TmfTraceFolder.TRACE_FOLDER_NAME);
+ if (!folder.exists())
+ folder.create(true, true, null);
+
+ folder = project.getFolder(TmfExperimentFolder.EXPER_FOLDER_NAME);
+ if (!folder.exists())
+ folder.create(true, true, null);
+
+ return project;
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ // ------------------------------------------------------------------------
+ // IExecutableExtension
+ // ------------------------------------------------------------------------
+
+ @Override
+ public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
+ fConfigElement = config;
+ }
+
+}