diff options
author | Francois Chouinard | 2011-10-19 04:59:03 +0000 |
---|---|---|
committer | Francois Chouinard | 2011-10-19 21:13:15 +0000 |
commit | 0036e37301ba910bc3b65e81f380cd5413e0f09f (patch) | |
tree | 405cffdbc14d7372d7f41b6d3960b4a53e71ab4b | |
parent | f82c45c97d423c2ace10caea5e6fbfc24867f9fb (diff) | |
download | org.eclipse.linuxtools-0036e37301ba910bc3b65e81f380cd5413e0f09f.tar.gz org.eclipse.linuxtools-0036e37301ba910bc3b65e81f380cd5413e0f09f.tar.xz org.eclipse.linuxtools-0036e37301ba910bc3b65e81f380cd5413e0f09f.zip |
Rebase NewLTTngProjectWizard on TMF
12 files changed, 117 insertions, 177 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF index b90284081e..62e48c39b0 100644 --- a/lttng/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF @@ -13,11 +13,11 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.7.0", 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 diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png b/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png Binary files differnew file mode 100644 index 0000000000..7cf4768a13 --- /dev/null +++ b/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png b/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png Binary files differnew file mode 100644 index 0000000000..79089b0707 --- /dev/null +++ b/lttng/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml b/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml index a72ff974d5..54b5773b2f 100644 --- a/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml +++ b/lttng/org.eclipse.linuxtools.lttng.ui/plugin.xml @@ -6,7 +6,7 @@ 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> @@ -99,7 +99,7 @@ </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" @@ -750,7 +750,7 @@ <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"> diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java index 48da18ecb4..2e9857ba09 100644 --- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java +++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java @@ -20,12 +20,12 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; * * TODO: Implement me. Please. */ -public class NewProjectMainWizardPage extends WizardNewProjectCreationPage { +public class NewLTTngProjectMainWizardPage extends WizardNewProjectCreationPage { /** * @param pageName */ - public NewProjectMainWizardPage(String pageName) { + public NewLTTngProjectMainWizardPage(String pageName) { super(pageName); } diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java new file mode 100644 index 0000000000..b7113bc1b0 --- /dev/null +++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * 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 diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java deleted file mode 100644 index 7f0ce58e33..0000000000 --- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * 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 diff --git a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java index ac001a7370..85ce652cfe 100644 --- a/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java +++ b/lttng/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java @@ -20,7 +20,7 @@ import org.eclipse.core.resources.IProject; 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; @@ -73,7 +73,7 @@ public class NewProjectHandler implements IHandler { // 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(); diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF index 0acbe2ceed..8023ba7b30 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF +++ b/lttng/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF @@ -20,6 +20,7 @@ Export-Package: org.eclipse.linuxtools.tmf.ui, 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, diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/plugin.xml b/lttng/org.eclipse.linuxtools.tmf.ui/plugin.xml index 167e6ac04f..ecaca74882 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/plugin.xml +++ b/lttng/org.eclipse.linuxtools.tmf.ui/plugin.xml @@ -93,7 +93,7 @@ </category>
<wizard
category="org.eclipse.linuxtools.tmf.ui.wizards.new"
- class="org.eclipse.linuxtools.tmf.ui.project.wizards.NewProjectWizard"
+ class="org.eclipse.linuxtools.tmf.ui.project.wizards.NewTmfProjectWizard"
icon="icons/elcl16/new_tracing_prj.gif"
id="org.eclipse.linuxtools.tmf.ui.views.ui.wizards.newProject"
name="%project.new.wizard.name"
diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectMainWizardPage.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectMainWizardPage.java index 9a40759b14..6e71cf8db1 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectMainWizardPage.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectMainWizardPage.java @@ -20,12 +20,12 @@ import org.eclipse.ui.dialogs.WizardNewProjectCreationPage; * * TODO: Implement me. Please. */ -public class NewProjectMainWizardPage extends WizardNewProjectCreationPage { +public class NewTmfProjectMainWizardPage extends WizardNewProjectCreationPage { /** * @param pageName */ - public NewProjectMainWizardPage(String pageName) { + public NewTmfProjectMainWizardPage(String pageName) { super(pageName); } diff --git a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectWizard.java b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java index a4e626e183..092ea3bf24 100644 --- a/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectWizard.java +++ b/lttng/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java @@ -33,15 +33,15 @@ import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard; import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard; /** - * <b><u>NewProjectWizard</u></b> + * <b><u>NewTmfProjectWizard</u></b> * <p> */ -public class NewProjectWizard extends BasicNewResourceWizard implements IExecutableExtension { +public class NewTmfProjectWizard extends BasicNewResourceWizard implements IExecutableExtension { private final String fTtitle; private final String fDescription; - protected NewProjectMainWizardPage fMainPage; + protected NewTmfProjectMainWizardPage fMainPage; protected String fProjectName; protected URI fProjectLocation; protected IConfigurationElement fConfigElement; @@ -51,7 +51,7 @@ public class NewProjectWizard extends BasicNewResourceWizard implements IExecuta /** * */ - public NewProjectWizard() { + public NewTmfProjectWizard() { this(Messages.NewProjectWizard_DialogHeader, Messages.NewProjectWizard_DialogMessage); } @@ -59,7 +59,7 @@ public class NewProjectWizard extends BasicNewResourceWizard implements IExecuta * @param title * @param desc */ - public NewProjectWizard(String title, String desc) { + public NewTmfProjectWizard(String title, String desc) { super(); setDialogSettings(TmfUiPlugin.getDefault().getDialogSettings()); setNeedsProgressMonitor(true); @@ -76,7 +76,7 @@ public class NewProjectWizard extends BasicNewResourceWizard implements IExecuta */ @Override public void addPages() { - fMainPage = new NewProjectMainWizardPage(Messages.NewProjectWizard_DialogHeader); + fMainPage = new NewTmfProjectMainWizardPage(Messages.NewProjectWizard_DialogHeader); fMainPage.setTitle(fTtitle); fMainPage.setDescription(fDescription); addPage(fMainPage); |