From 9501fb5824ca5bd8347e56513e30d97e371ae80c Mon Sep 17 00:00:00 2001 From: Francois Chouinard Date: Wed, 19 Oct 2011 00:59:03 -0400 Subject: [PATCH] Rebase NewLTTngProjectWizard on TMF --- .../META-INF/MANIFEST.MF | 4 +- .../icons/obj16/tux.png | Bin 0 -> 268 bytes .../icons/obj16/tux2.png | Bin 0 -> 280 bytes org.eclipse.linuxtools.lttng.ui/plugin.xml | 6 +- ...ava => NewLTTngProjectMainWizardPage.java} | 4 +- .../dialogs/NewLTTngProjectWizard.java | 98 +++++++++++ .../project/dialogs/NewProjectWizard.java | 159 ------------------ .../project/handlers/NewProjectHandler.java | 4 +- .../META-INF/MANIFEST.MF | 1 + org.eclipse.linuxtools.tmf.ui/plugin.xml | 2 +- ....java => NewTmfProjectMainWizardPage.java} | 4 +- ...ctWizard.java => NewTmfProjectWizard.java} | 12 +- 12 files changed, 117 insertions(+), 177 deletions(-) create mode 100644 org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png create mode 100644 org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png rename org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/{NewProjectMainWizardPage.java => NewLTTngProjectMainWizardPage.java} (85%) create mode 100644 org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java delete mode 100644 org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java rename org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/{NewProjectMainWizardPage.java => NewTmfProjectMainWizardPage.java} (85%) rename org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/{NewProjectWizard.java => NewTmfProjectWizard.java} (93%) diff --git a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF index b90284081e..62e48c39b0 100644 --- a/org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF +++ b/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/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png b/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png new file mode 100644 index 0000000000000000000000000000000000000000..7cf4768a137b0a0d63a8fd595fd7dad010194e93 GIT binary patch literal 268 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=s=o-U3d7QIV@0>zpQIJm7P&4u%ioqfdqsB2nY{^R9hP8=%_%vbD| z+JCT=)vqY{&FbW`??wNXG_bf_yAj41>0ds7?bnpj@>N+A*R7f_a{VEL$E0`Xco^P< zOnJ#Eqx^Zs{&SNPa%4o$gop^Y$A&wf`m1DMJgGra;ZpTgK1)uIrjKWDYh~tLx&4e` zfj~;~QI^g} L`njxgN@xNATmxnt literal 0 HcmV?d00001 diff --git a/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png b/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png new file mode 100644 index 0000000000000000000000000000000000000000..79089b0707a30dab92a39600d9c88b5ff1745e17 GIT binary patch literal 280 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf4nJ z@ErkR#;MwT(m=soo-U3d7QIU+ISMf=a @@ -99,7 +99,7 @@ diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java similarity index 85% rename from org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java rename to org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java index 48da18ecb4..2e9857ba09 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java +++ b/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/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java b/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/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; + +/** + * NewLTTngProjectWizard + *

+ */ +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/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java deleted file mode 100644 index 7f0ce58e33..0000000000 --- a/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; - -/** - * NewProjectWizard - *

- * 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/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java index ac001a7370..85ce652cfe 100644 --- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java +++ b/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/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF b/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF index 0acbe2ceed..8023ba7b30 100644 --- a/org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF +++ b/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/org.eclipse.linuxtools.tmf.ui/plugin.xml b/org.eclipse.linuxtools.tmf.ui/plugin.xml index 167e6ac04f..ecaca74882 100644 --- a/org.eclipse.linuxtools.tmf.ui/plugin.xml +++ b/org.eclipse.linuxtools.tmf.ui/plugin.xml @@ -93,7 +93,7 @@ NewProjectWizard + * NewTmfProjectWizard *

*/ -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); -- 2.34.1