Rebase NewLTTngProjectWizard on TMF
authorFrancois Chouinard <fchouinard@gmail.com>
Wed, 19 Oct 2011 04:59:03 +0000 (00:59 -0400)
committerFrancois Chouinard <fchouinard@gmail.com>
Wed, 19 Oct 2011 21:13:15 +0000 (17:13 -0400)
15 files changed:
org.eclipse.linuxtools.lttng.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/plugin.xml
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectWizard.java [new file with mode: 0644]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectMainWizardPage.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewProjectWizard.java [deleted file]
org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/handlers/NewProjectHandler.java
org.eclipse.linuxtools.tmf.ui/META-INF/MANIFEST.MF
org.eclipse.linuxtools.tmf.ui/plugin.xml
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectMainWizardPage.java [deleted file]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectWizard.java [deleted file]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectMainWizardPage.java [new file with mode: 0644]
org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java [new file with mode: 0644]

index b90284081e65e01894dc1f555ef3c635c2f48b6d..62e48c39b0da53d765ed40bb66c50c1b1581d198 100644 (file)
@@ -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 (file)
index 0000000..7cf4768
Binary files /dev/null and b/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux.png differ
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 (file)
index 0000000..79089b0
Binary files /dev/null and b/org.eclipse.linuxtools.lttng.ui/icons/obj16/tux2.png differ
index a72ff974d5775f21ed265dce6ab0a2b5593c8e5e..54b5773b2fe6c4c6b48198e17f214da2d0b3611c 100644 (file)
@@ -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"
       <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/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/project/dialogs/NewLTTngProjectMainWizardPage.java
new file mode 100644 (file)
index 0000000..2e9857b
--- /dev/null
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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);
+    }
+
+}
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 (file)
index 0000000..b7113bc
--- /dev/null
@@ -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/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/NewProjectMainWizardPage.java
deleted file mode 100644 (file)
index 48da18e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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);
-    }
-
-}
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 (file)
index 7f0ce58..0000000
+++ /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
index ac001a7370447c547d17c350816fd5ba1e6494ef..85ce652cfeaf09db3c3be7fa75ab12cd1e5e53dd 100644 (file)
@@ -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();
 
index 0acbe2ceed389cdf4a79f6a759a2fef61132e62a..8023ba7b30792915941ad1072abf98ce3d7fdc2b 100644 (file)
@@ -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,
index 167e6ac04f2d2f442f445dcc54f7eb3779b76edf..ecaca74882993f74dd9f5b4cc945832feffc3a79 100644 (file)
@@ -93,7 +93,7 @@
       </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
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectMainWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectMainWizardPage.java
deleted file mode 100644 (file)
index 9a40759..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * 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);
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectWizard.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewProjectWizard.java
deleted file mode 100644 (file)
index a4e626e..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * 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;
-    }
-
-}
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectMainWizardPage.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectMainWizardPage.java
new file mode 100644 (file)
index 0000000..6e71cf8
--- /dev/null
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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);
+    }
+
+}
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/wizards/NewTmfProjectWizard.java
new file mode 100644 (file)
index 0000000..092ea3b
--- /dev/null
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * 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;
+    }
+
+}
This page took 0.045677 seconds and 5 git commands to generate.