[ooo-build-commit] ooeclipse: Branch 'master' - 3 commits

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Dec 11 05:33:41 PST 2009


 core/plugin.xml                                                                        |   10 
 core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java  |    2 
 core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties               |    2 
 core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java         |   28 
 core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java                    |   40 -
 core/source/org/openoffice/ide/eclipse/core/internal/office/TypesGetter.java           |    8 
 core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java                 |  155 +++++
 core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java           |  293 ++--------
 core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard2.java          |  119 ----
 core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties                |   23 
 core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java      |   55 +
 core/source/org/openoffice/ide/eclipse/core/wizards/pages/PackageExportWizardPage.java |  249 --------
 core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java    |  133 ++++
 java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java                           |    4 
 14 files changed, 460 insertions(+), 661 deletions(-)

New commits:
commit a55853b108f619427881ea398c8389cfdaf8bd48
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Fri Dec 11 14:29:06 2009 +0100

    [core]Moved to the new export wizard
    
    The export wizard is working but there are still some improvements to
    add:
        * Move the heavy tasks in a Job
        * Implement the build scripts creation

diff --git a/core/plugin.xml b/core/plugin.xml
index 77558da..4491ae0 100755
--- a/core/plugin.xml
+++ b/core/plugin.xml
@@ -289,13 +289,6 @@
             icon="/icons/export_package.gif"
             id="org.openoffice.ide.eclipse.core.export.package"
             name="OpenOffice.org package"/>
-      <wizard
-            category="org.openoffice.ide.eclipse.core.uno"
-            class="org.openoffice.ide.eclipse.core.wizards.PackageExportWizard2"
-            icon="icons/export_package.gif"
-            id="org.openoffice.ide.eclipse.core.wizard.test"
-            name="Test Wizard">
-      </wizard>
    </extension>
    <extension
          point="org.eclipse.ui.startup">
@@ -303,9 +296,10 @@
    </extension>
    <extension
          point="org.eclipse.core.contenttype.contentTypes">
+         <!-- The xba and xdl types should have their own editor someday -->
       <file-association
             content-type="org.eclipse.core.runtime.xml"
-            file-extensions="xcu,xcs">
+            file-extensions="xcu,xcs,xlb,xba,xdl">
       </file-association>
    </extension>
    <extension
diff --git a/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties b/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties
index d66335d..8f26962 100755
--- a/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties
+++ b/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties
@@ -21,7 +21,7 @@ EXCEPTION           = /icons/exception.gif
 PRJ_MODIFIER        = /icons/prj_modifier.gif
 DB_MODIFIER         = /icons/db_modifier.gif
 IDL_MODIFIER        = /icons/idl_modifier.gif
-PACKAGE_EXPORT_WIZ  = /icons/export_package_banner.gif
+PACKAGE_EXPORT_WIZ  = /icons/export_package_banner.png
 URE_APP_WIZ         = /icons/ure_app_wiz.png
 REFRESH             = /icons/refresh.gif
 ADD                 = /icons/add.gif
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java b/core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java
index 2e479f0..99ad0c3 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java
@@ -58,11 +58,15 @@ import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.swt.widgets.Display;
 import org.openoffice.ide.eclipse.core.PluginLogger;
 import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
 import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
 import org.openoffice.ide.eclipse.core.model.Messages;
 import org.openoffice.ide.eclipse.core.model.ProjectsManager;
+import org.openoffice.ide.eclipse.core.utils.FileHelper;
 import org.openoffice.ide.eclipse.core.utils.ZipContent;
 
 /**
@@ -82,6 +86,9 @@ public class UnoPackage {
     public static final String ZIP = "zip"; //$NON-NLS-1$
     public static final String UNOPKG = "uno.pkg"; //$NON-NLS-1$
     public static final String OXT = "oxt"; //$NON-NLS-1$
+
+    private static final String BASIC_LIBRARY_INDEX = "script.xlb"; //$NON-NLS-1$
+    private static final String DIALOG_LIBRARY_INDEX = "dialog.xlb"; //$NON-NLS-1$
     
     private IProject mPrj;
     private File mDestination;
@@ -89,6 +96,12 @@ public class UnoPackage {
     
     private HashMap<String, ZipContent> mZipEntries = new HashMap<String, ZipContent>();
     private ManifestModel mManifest = new ManifestModel();
+    private ArrayList< IPath > mToClean = new ArrayList<IPath>( );
+
+    private IFile mReadManifestFile;
+    private IFile mSaveManifestFile;
+
+    private Runnable mDeployJob;
     
     /**
      * Create a new package object. 
@@ -139,6 +152,40 @@ public class UnoPackage {
     }
     
     /**
+     * Set the manifest.xml file to use for the package: setting this value will
+     * skip the manifest.xml file automatic generation.
+     * 
+     * <p><strong>Setting this value to a non-existing file is the same as setting it with
+     * <code>null</code>: the default value will be used.</strong></p>
+     * 
+     * @param pFile the file to read.
+     * 
+     * @see #MANIFEST_PATH The default path value relative to the project
+     */
+    public void setReadManifestFile( IFile pFile ) {
+        if ( pFile != null && pFile.exists( ) ) {
+            mReadManifestFile = pFile;
+        }
+    }
+    
+    /**
+     * @param pFile the file where to save the manifest.xml
+     */
+    public void setSaveManifestFile( IFile pFile ) {
+        if ( pFile != null ) {
+            mSaveManifestFile = pFile;
+        }
+    }
+
+    /**
+     * @param pJob the job to run to deploy the package, <code>null</code> 
+     *          can be used to remove any previously set deploy job.
+     */
+    public void setDeployJob( Runnable pJob ) {
+        mDeployJob = pJob;
+    }
+    
+    /**
      * Add a file or directory to the package.
      * 
      * <p>This method doesn't know about the different languages
@@ -158,6 +205,10 @@ public class UnoPackage {
             } else {
                 addOtherFile( file );
             }
+        } else if ( isBasicLibrary( pContent ) ) {
+            addBasicLibraryFile( ( IFolder ) pContent );
+        } else if ( isDialogLibrary( pContent ) ) {
+            addDialogLibraryFile( ( IFolder ) pContent );
         } else if ( pContent instanceof IContainer ) {
             // Recurse on the directory
             IContainer container = (IContainer) pContent;
@@ -171,7 +222,7 @@ public class UnoPackage {
             }
         }
     }
-    
+
     /**
      * Add a uno component file, for example a jar, shared library or python file
      * containing the uno implementation. The type of the file defines the 
@@ -315,17 +366,20 @@ public class UnoPackage {
     /**
      * Writes the package on the disk and cleans up the data. The UnoPackage
      * instance cannot be used after this operation: it should unreferenced.
+     * 
+     * @param pMonitor the progress monitor
      *
      * @return the file of the package or <code>null</code> if nothing happened.
      */
-    public File close() {
+    public File close( IProgressMonitor pMonitor ) {
         File result = null;
         
         if (mBuilding) {
             try {
-                // Write the manifest if it doesn't exist
-                IFile manifestFile = mPrj.getFile( MANIFEST_PATH );
-                if ( !manifestFile.exists() ) {
+                IFile manifestFile = mReadManifestFile;
+                if ( manifestFile == null ) {
+                    // Write the manifest if it doesn't exist
+                    manifestFile = getSaveManifestFile();
                     FileOutputStream writer = new FileOutputStream( manifestFile.getLocation().toFile() );
                     mManifest.write( writer );
                     writer.close();
@@ -356,11 +410,24 @@ public class UnoPackage {
             
             result = mDestination;
     
+            cleanResources();
+            
+            // Deploy the package if a job is set
+            if ( mDeployJob != null ) {
+                Display.getDefault().asyncExec( mDeployJob );
+            }
+            
+            // Refresh the project and return the status
+            try {
+                mPrj.refreshLocal( IResource.DEPTH_INFINITE, pMonitor );
+            } catch ( Exception e ) {
+            }
+            
             dispose();
         }
         return result;
     }
-    
+
     /**
      * @return a list of the files that are already queued for addition 
      *         to the package.
@@ -435,6 +502,16 @@ public class UnoPackage {
     }
     
     /**
+     * Add the path to a resource to clean after having exported the package.
+     * The resource won't be cleaned if the package isn't exported.
+     * 
+     * @param pPath the path to the resource to clean.
+     */
+    public void addToClean( IPath pPath ) {
+        mToClean.add( pPath );
+    }
+    
+    /**
      * Creates the main elements for the package creation. 
      * 
      * <p>After this step, the extension cannot be changed. Calling this 
@@ -468,4 +545,70 @@ public class UnoPackage {
             }
         }
     }
+    
+    /**
+     * Clean the resources added using {@link #addToClean(IPath)}.
+     */
+    private void cleanResources() {
+        for ( IPath path : mToClean ) {
+            FileHelper.remove( new File( path.toOSString() ) );
+        }
+        
+        // Remove the default manifest file if needed
+        IFile manifestFile = getSaveManifestFile();
+        if ( mSaveManifestFile == null && 
+                !manifestFile.equals( mReadManifestFile ) && 
+                manifestFile.exists() ) {
+            try {
+                manifestFile.delete( true, null );
+            } catch ( Exception e ) {
+            }
+        }
+    }
+    
+    /**
+     * Checks if the resource is a dialog library.
+     * 
+     * @param pRes the resource to check
+     * 
+     * @return <code>true</code> if the resource is a dialog library, 
+     *          <code>false</code> in any other case
+     */
+    private boolean isDialogLibrary( IResource pRes ) {
+        boolean result = false;
+        if ( pRes instanceof IFolder ) {
+            IFolder folder = ( IFolder ) pRes;
+            result = folder.getFile( DIALOG_LIBRARY_INDEX ).exists();
+        }
+        return result;
+    }
+
+    /**
+     * Checks if the resource is a basic library.
+     * 
+     * @param pRes the resource to check
+     * 
+     * @return <code>true</code> if the resource is a basic library, 
+     *          <code>false</code> in any other case
+     */
+    private boolean isBasicLibrary( IResource pRes ) {
+        boolean result = false;
+        if ( pRes instanceof IFolder ) {
+            IFolder folder = ( IFolder ) pRes;
+            result = folder.getFile( BASIC_LIBRARY_INDEX ).exists();
+        }
+        return result;
+    }
+    
+    /**
+     * @return the manifest file to write either defined by the setter or 
+     *          the default value.
+     */
+    private IFile getSaveManifestFile( ) {
+        IFile file = mSaveManifestFile;
+        if ( file == null ) {
+            file = mPrj.getFile( MANIFEST_PATH );
+        }
+        return file;
+    }
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java b/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
index c64e3c3..38d7c7d 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
@@ -1,21 +1,11 @@
 /*************************************************************************
  *
- * $RCSfile: PackageExportWizard.java,v $
- *
- * $Revision: 1.11 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:42:49 $
- *
  * The Contents of this file are made available subject to the terms of
  * the GNU Lesser General Public License Version 2.1
  *
- * Sun Microsystems Inc., October, 2000
- *
- *
  * GNU Lesser General Public License Version 2.1
  * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ * Copyright 2009 by Cédric Bosdonnat
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -31,258 +21,117 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  * MA 02111-1307 USA
  * 
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ * The Initial Developer of the Original Code is: Cédric Bosdonnat.
  *
- * Copyright: 2002 by Sun Microsystems, Inc.
+ * Copyright: 2009 by Cédric Bosdonnat
  *
  * All Rights Reserved.
- *
- * Contributor(s): Cedric Bosdonnat
- *
- *
+ * 
  ************************************************************************/
 package org.openoffice.ide.eclipse.core.wizards;
 
 import java.io.File;
 import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
 
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.IExportWizard;
 import org.eclipse.ui.IWorkbench;
 import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
-import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
 import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
 import org.openoffice.ide.eclipse.core.model.ProjectsManager;
-import org.openoffice.ide.eclipse.core.model.config.IOOo;
-import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
-import org.openoffice.ide.eclipse.core.model.pack.PackagePropertiesModel;
 import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
-import org.openoffice.ide.eclipse.core.utils.FileHelper;
-import org.openoffice.ide.eclipse.core.wizards.pages.PackageExportWizardPage;
+import org.openoffice.ide.eclipse.core.wizards.pages.ManifestExportPage;
+import org.openoffice.ide.eclipse.core.wizards.pages.UnoPackageExportPage;
 
 /**
- * A wizard to export the project as a UNO package.
+ * Class for the new OXT export wizard.
+ * 
+ * @author Cédric Bosdonnat
  * 
- * @author cedricbosdo
- *
  */
 public class PackageExportWizard extends Wizard implements IExportWizard {
 
-    private IStructuredSelection mSelection;
-    private PackageExportWizardPage mPage;
+    private static final String DIALOG_SETTINGS_KEY = "oxt.export"; //$NON-NLS-1$
     
+    private UnoPackageExportPage mMainPage;
+    private ManifestExportPage mManifestPage;
+
+    private boolean mHasNewDialogSettings;
+
     /**
-     * {@inheritDoc}
+     * Constructor.
      */
+    public PackageExportWizard() {
+        IDialogSettings workbenchSettings = OOEclipsePlugin.getDefault().getDialogSettings();
+        IDialogSettings section = workbenchSettings.getSection( DIALOG_SETTINGS_KEY );
+        if ( section == null ) {
+            mHasNewDialogSettings = true;
+        } else {
+            mHasNewDialogSettings = false;
+            setDialogSettings( section );
+        }
+    }
+    
     @Override
     public boolean performFinish() {
+        boolean finished = false;
+        UnoPackage model = mMainPage.getPackageModel( );
+        if ( model != null ) {
+            // Configure the manifest.xml for the model
+            mManifestPage.configureManifest( model );
+            
+            // TODO Run the next operations in a job
+            
+            // Write the build scripts if needed
+            mManifestPage.createBuildScripts( model );
+            
+            // Export the package
+            File out = model.close( null );
+            finished = out != null;
+            
+            if ( mHasNewDialogSettings ) {
+                IDialogSettings workbenchSettings = OOEclipsePlugin.getDefault().getDialogSettings();
+                IDialogSettings section = workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
+                section = workbenchSettings.addNewSection(DIALOG_SETTINGS_KEY);
+                setDialogSettings(section);
+            }
+
+            mMainPage.saveWidgetValues();
+            
+        }
         
-        IUnoidlProject prj = mPage.getProject();
-        String extension = mPage.getPackageExtension();
-        File outputDir = mPage.getOutputPath();
-    
-        new PackageExportJob(prj, extension, outputDir).schedule();
-        return true;
+        return finished;
     }
 
     /**
      * {@inheritDoc}
      */
     public void init(IWorkbench pWorkbench, IStructuredSelection pSelection) {
-        mSelection = pSelection;
-        
-        boolean canExport = false;
-        
-        Iterator<?> iter = mSelection.iterator();
-        while (iter.hasNext()) {
-            Object o = iter.next();
+        // Try hard to find a selected UNO project
+        IUnoidlProject prj = null;
+        Iterator<?> it = pSelection.iterator();
+        while (it.hasNext() && prj == null) {
+            Object o = it.next();
             if (o instanceof IAdaptable) {
-                IAdaptable adaptable = (IAdaptable)o;
-                IResource res = (IResource)adaptable.getAdapter(IResource.class);
-                if (res != null && ProjectsManager.getProject(res.getProject().getName()) != null) {
-                    canExport = true;
+                IResource res = (IResource) ((IAdaptable) o)
+                        .getAdapter(IResource.class);
+                if (res != null) {
+                    prj = ProjectsManager
+                            .getProject(res.getProject().getName());
                 }
             }
         }
         
-        if (canExport) {
-            mPage = new PackageExportWizardPage("main", mSelection); //$NON-NLS-1$
-            addPage(mPage);
-        }
-    }
+        setWindowTitle( Messages.getString("PackageExportWizard2.DialogTitle") ); //$NON-NLS-1$
 
-    /**
-     * The class performing the package export task.
-     * 
-     * <p>This job doesn't perform the deployment into OpenOffice.org.</p>
-     * 
-     * @author cedricbosdo
-     */
-    private class PackageExportJob extends Job {
-
-        private IUnoidlProject mPrj;
-        private String mExtension;
-        private File mOutputDir;
-        
-        /**
-         * Constructor.
-         * 
-         * @param pPrj the project for which to create the package
-         * @param pVersion the package version
-         * @param pOutput the directory where to create the package.
-         */
-        public PackageExportJob(IUnoidlProject pPrj, String pVersion, File pOutput) {
-            super(Messages.getString("PackageExportWizard.JobTitle")); //$NON-NLS-1$
-            setPriority(Job.INTERACTIVE);
-            
-            mPrj = pPrj;
-            mExtension = pVersion;
-            mOutputDir = pOutput;
-        }
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        protected IStatus run(IProgressMonitor pMonitor) {
-            
-            IStatus status = new Status(IStatus.ERROR, 
-                    OOEclipsePlugin.OOECLIPSE_PLUGIN_ID, 
-                    IStatus.ERROR, 
-                    Messages.getString("PackageExportWizard.EXPORT_ERROR_MSG"), //$NON-NLS-1$
-                    null);
-            
-            try {
-                // Export the library
-                IPath libraryPath = null;
-                ILanguageBuilder langBuilder = mPrj.getLanguage().getLanguageBuidler();
-                libraryPath = langBuilder.createLibrary(mPrj);
-                
-                // Create the package
-                IPath prjPath = mPrj.getProjectPath();
-                File dir = new File(prjPath.toOSString());
-                File dest = new File(mOutputDir, 
-                        mPrj.getName().replace(" ", "") //$NON-NLS-1$ //$NON-NLS-2$ 
-                            + "." + mExtension); //$NON-NLS-1$
-                UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(mPrj, dest);      
-
-                /*
-                 *  Read the package.properties files to add user selected files.
-                 *  Recognize the following types from their extensions:
-                 *      - .xcu, xcs
-                 *      - .rdb
-                 */
-                IFile pkgProperties = mPrj.getFile("package.properties"); //$NON-NLS-1$
-                if (pkgProperties.exists()) {
-                    PackagePropertiesModel pkgModel = new PackagePropertiesModel(pkgProperties);
-
-                    List<IFolder> basicLibs = pkgModel.getBasicLibraries();
-                    for (IFolder lib : basicLibs) {
-                        unoPackage.addBasicLibraryFile(lib);
-                    }
-
-                    List<IFolder> dialogLibs = pkgModel.getDialogLibraries();
-                    for (IFolder lib : dialogLibs) {
-                        unoPackage.addDialogLibraryFile(lib);
-                    }
-
-                    List<IResource> contents = pkgModel.getContents();
-                    for (IResource res : contents) {
-                        unoPackage.addContent(res);
-                    }
-
-                    Map<Locale, IFile> descriptions = pkgModel.getDescriptionFiles();
-                    Iterator<Entry<Locale, IFile>> iter = descriptions.entrySet().iterator();
-                    while (iter.hasNext()) {
-                        Entry<Locale, IFile> entry = iter.next();
-                        unoPackage.addPackageDescription(entry.getValue(), 
-                                entry.getKey());
-                    }
-                }
-
-                // Close and write the package
-                dest = unoPackage.close();
-
-                // Clean up the library file and META-INF directory
-                FileHelper.remove(new File(dir, "META-INF")); //$NON-NLS-1$
-                File libFile = new File(libraryPath.toOSString());
-                FileHelper.remove(libFile);
-
-                // Refresh the project and return the status
-                UnoidlProjectHelper.refreshProject(mPrj, pMonitor);
-
-                // Propose to update the package in OpenOffice.org instance
-                Display.getDefault().asyncExec(new DeployerJob(mPrj.getOOo(), dest));
-
-                status = new Status(IStatus.OK, 
-                        OOEclipsePlugin.OOECLIPSE_PLUGIN_ID, 
-                        IStatus.OK, 
-                        Messages.getString("PackageExportWizard.ExportedMessage"), //$NON-NLS-1$
-                        null);
-                
-            } catch (Exception e) {
-                // the error status is already defined at the beginning of the method  
-                status = new Status(IStatus.ERROR, 
-                        OOEclipsePlugin.OOECLIPSE_PLUGIN_ID, 
-                        IStatus.ERROR, 
-                        Messages.getString("PackageExportWizard.EXPORT_ERROR_MSG"), //$NON-NLS-1$
-                        e );
-            }
-                
-            return status;
-        }
-    }
-    
-    /**
-     * Thread performing the package deployment into OpenOffice.org.
-     * 
-     * @author cedricbosdo
-     *
-     */
-    class DeployerJob implements Runnable {
-        
-        private IOOo mOOo;
-        private File mDest;
-        
-        /**
-         * Constructor.
-         * 
-         * @param pOoo the OpenOffice.org where to deploy
-         * @param pDest the package to deploy
-         */
-        DeployerJob(IOOo pOoo, File pDest) {
-            mOOo = pOoo;
-            mDest = pDest;
-        }
-        
-        /**
-         * {@inheritDoc}
-         */
-        public void run() {
-            if (mOOo.canManagePackages()) {
-                // Ask to update the package
-                if (MessageDialog.openQuestion(Display.getDefault().getActiveShell(), 
-                        Messages.getString("PackageExportWizard.DeployPackageTitle"),  //$NON-NLS-1$
-                        Messages.getString("PackageExportWizard.DeployPackageMessage"))) { //$NON-NLS-1$
-                    mOOo.updatePackage(mDest);
-                }
-            }
-        }
+        mManifestPage = new ManifestExportPage("page2", prj); //$NON-NLS-1$
+        mMainPage = new UnoPackageExportPage("page1", prj, //$NON-NLS-1$
+                mManifestPage);
+        addPage(mMainPage);
+        addPage(mManifestPage);
     }
-}
\ No newline at end of file
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard2.java b/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard2.java
deleted file mode 100644
index c5740f0..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard2.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*************************************************************************
- *
- * The Contents of this file are made available subject to the terms of
- * the GNU Lesser General Public License Version 2.1
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2009 by Cédric Bosdonnat
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- * 
- * The Initial Developer of the Original Code is: Cédric Bosdonnat.
- *
- * Copyright: 2009 by Cédric Bosdonnat
- *
- * All Rights Reserved.
- * 
- ************************************************************************/
-package org.openoffice.ide.eclipse.core.wizards;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
-import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
-import org.openoffice.ide.eclipse.core.model.ProjectsManager;
-import org.openoffice.ide.eclipse.core.wizards.pages.ManifestExportPage;
-import org.openoffice.ide.eclipse.core.wizards.pages.UnoPackageExportPage;
-
-/**
- * Class for the new OXT export wizard.
- * 
- * @author Cédric Bosdonnat
- * 
- */
-public class PackageExportWizard2 extends Wizard implements IExportWizard {
-
-    private static final String DIALOG_SETTINGS_KEY = "oxt.export"; //$NON-NLS-1$
-    
-    private UnoPackageExportPage mMainPage;
-    private ManifestExportPage mManifestPage;
-
-    private boolean mHasNewDialogSettings;
-
-    /**
-     * Constructor.
-     */
-    public PackageExportWizard2() {
-        IDialogSettings workbenchSettings = OOEclipsePlugin.getDefault().getDialogSettings();
-        IDialogSettings section = workbenchSettings.getSection( DIALOG_SETTINGS_KEY );
-        if ( section == null ) {
-            mHasNewDialogSettings = true;
-        } else {
-            mHasNewDialogSettings = false;
-            setDialogSettings( section );
-        }
-    }
-    
-    @Override
-    public boolean performFinish() {
-        // TODO Auto-generated method stub
-        if ( mHasNewDialogSettings ) {
-            IDialogSettings workbenchSettings = OOEclipsePlugin.getDefault().getDialogSettings();
-            IDialogSettings section = workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
-            section = workbenchSettings.addNewSection(DIALOG_SETTINGS_KEY);
-            setDialogSettings(section);
-        }
-        
-        mMainPage.saveWidgetValues();
-        
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void init(IWorkbench pWorkbench, IStructuredSelection pSelection) {
-        // Try hard to find a selected UNO project
-        IUnoidlProject prj = null;
-        Iterator<?> it = pSelection.iterator();
-        while (it.hasNext() && prj == null) {
-            Object o = it.next();
-            if (o instanceof IAdaptable) {
-                IResource res = (IResource) ((IAdaptable) o)
-                        .getAdapter(IResource.class);
-                if (res != null) {
-                    prj = ProjectsManager
-                            .getProject(res.getProject().getName());
-                }
-            }
-        }
-        
-        setWindowTitle( "OXT Export" );
-
-        mManifestPage = new ManifestExportPage("page2", prj); //$NON-NLS-1$
-        mMainPage = new UnoPackageExportPage("page1", prj, //$NON-NLS-1$
-                mManifestPage);
-        addPage(mMainPage);
-        addPage(mManifestPage);
-    }
-}
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties b/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties
index db3a8d8..a866e83 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties
@@ -22,8 +22,6 @@ NewUnoProjectPage.RootPackageTooltip=Defines the vendor package name for the pro
 NewUnoProjectPage.CompExtension=Implementation package extension
 NewUnoProjectPage.CustomIdlLabel=IDL files
 NewUnoProjectPage.CompExtensionTooltip=Defines the extension package name, usually comp.\nIt means that the implementation classes should\nbe in the <root.package>.comp package
-NewUnoFilePage.UnoProjectError=Not a UNO project
-NewUnoFilePage.NoIdlFolderError=Not a UNO-IDL capable folder
 NewServiceWizard.JobName=Service creation Job
 NewServiceWizardPage.Title=Service creation page
 NewServiceWizard.DefaultName=MyService
@@ -51,7 +49,6 @@ NewScopedElementWizardPage.Published=Published. Defines wether the type is stabl
         enough to be used by client code.
 NewUnoProjectPage.InvalidCompError=Implementation extension is a single word which begin with a letter and can contain numbers
 NewUnoProjectPage.UnoGroupTitle=UNO Project parameters
-NewUnoFilePage.WrongExtensionError=A UNO-IDL file has the .idl extension
 NewScopedElementWizardPage.Package=Module: 
 NewScopedElementWizardPage.PackageTooltip=Defines the sub-modules name which will contain the new type,\neg: "sub::module". This value is optional.
 NewServiceWizard.CreateServiceError=Service creation failed
@@ -76,22 +73,8 @@ InterfaceMemberDialog.ArgumentNameColumnTitle=Name
 InterfaceMemberDialog.ArgumentTypeColumnTitle=Type
 InterfaceMemberDialog.EditAttributeDescription=Change the attribute definition.
 InterfaceMemberDialog.ArgumentDirectionColumnTitle=In/Out
-PackageExportWizard.JobTitle=Package export Job
-PackageExportWizardPage.Title=OpenOffice.org package export
-PackageExportWizard.ExportedMessage=Package exported
-PackageExportWizard.EXPORT_ERROR_MSG=Failed to create extension package
-PackageExportWizardPage.Description=Export a UNO Project as an OpenOffice.org package
-PackageExportWizardPage.PackageLabel=Package to export
-PackageExportWizardPage.ChooserTitle=UNO project chooser
-PackageExportWizard.DeployPackageTitle=Export to UNO package
-PackageExportWizard.DeployPackageMessage=Deploy the UNO package into OpenOffice.org ?
-PackageExportWizardPage.ChooserDescription=Select the UNO project to export
-PackageExportWizardPage.DestinationLabel=Destination directory
-PackageExportWizardPage.DestinationTooltip=Directory where the package archive will be created
-PackageExportWizardPage.OOoVersionLabel=OpenOffice.org minimum version
-PackageExportWizardPage.OOoVersionTooltip=The minimum OOo version will define the package extension and structure
-PackageExportWizardPage.SelectProjectError=Select a UNO project to export
-PackageExportWizardPage.WrongDestinationError=Invalid or missing destination directory
+
+PackageExportWizard2.DialogTitle=OXT Export
 ServiceWizardSet.WrongInitDataWarning=Wrong data for service page set initizalization
 ServiceWizardSet.ServiceCreationError=Error happened during service creation
 ServiceWizardSet.IsIdlTypeExistingWarning=Error determining if the idl file exists: {0}
@@ -115,7 +98,9 @@ ManifestExportPage.UserManifestText=Use existing manifest file from the workspac
 UnoPackageExportPage.AutoDeploy=Automatically deploy on associated OpenOffice.org installation
 UnoPackageExportPage.Browse=Browse
 UnoPackageExportPage.Description=Define which resources should be exported in the OXT
+UnoPackageExportPage.LibraryCreationError=Couldn't create the library to export
 UnoPackageExportPage.Options=Options:
+UnoPackageExportPage.OverwriteQuestion=Overwrite the existing file {0}
 UnoPackageExportPage.OverwriteWithoutWarning=Overwrite files without warning
 UnoPackageExportPage.OxtFile=OXT file:
 UnoPackageExportPage.Project=Project to export:
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
index a92b8b9..b5280d0 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
@@ -34,7 +34,9 @@ import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerFilter;
@@ -58,6 +60,7 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
 import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
 import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
 import org.openoffice.ide.eclipse.core.model.language.LanguageExportPart;
+import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
 import org.openoffice.ide.eclipse.core.wizards.Messages;
 
 /**
@@ -111,6 +114,33 @@ public class ManifestExportPage extends WizardPage {
     }
 
     /**
+     * Set the proper manifest.xml file to the package model from the user selection.
+     * 
+     * @param pModel the model to change
+     */
+    public void configureManifest(UnoPackage pModel) {
+        IFile saveFile = getSaveManifestFile( );
+        if ( saveFile != null ) {
+            pModel.setSaveManifestFile( saveFile );
+        }
+        
+        IFile readFile = getReadManifestFile( );
+        if ( readFile != null ) {
+            pModel.setReadManifestFile( readFile );
+        }
+    }
+
+    /**
+     * Create the build scripts for the package model if required by the user.
+     * 
+     * @param pModel the model to export
+     */
+    public void createBuildScripts(UnoPackage pModel) {
+        // TODO Auto-generated method stub
+        
+    }
+    
+    /**
      * {@inheritDoc}
      */
     public void createControl(Composite pParent) {
@@ -342,4 +372,29 @@ public class ManifestExportPage extends WizardPage {
             }
         }
     }
+
+    /**
+     * @return the selected file to reuse or <code>null</code>
+     */
+    private IFile getReadManifestFile() {
+        IFile file = null;
+        if ( mReuseManifestBtn.getSelection() ) {
+            IPath path = new Path( mLoadRowTxt.getText().trim() );
+            file = ResourcesPlugin.getWorkspace().getRoot().getFile( path );
+        }
+        
+        return file;
+    }
+
+    /**
+     * @return the selected file to generate or <code>null</code>
+     */
+    private IFile getSaveManifestFile() {
+        IFile file = null;
+        if ( mGenerateManifestBtn.getSelection() && mSaveManifestBtn.getSelection() ) {
+            IPath path = new Path( mSaveRowTxt.getText().trim() );
+            file = ResourcesPlugin.getWorkspace().getRoot().getFile( path );
+        }
+        return file;
+    }
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/PackageExportWizardPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/PackageExportWizardPage.java
deleted file mode 100644
index e75dbc6..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/PackageExportWizardPage.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: PackageExportWizardPage.java,v $
- *
- * $Revision: 1.3 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:42:47 $
- *
- * The Contents of this file are made available subject to the terms of
- * the GNU Lesser General Public License Version 2.1
- *
- * Sun Microsystems Inc., October, 2000
- *
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2000 by Sun Microsystems, Inc.
- * 901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- * 
- * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
- *
- * Copyright: 2002 by Sun Microsystems, Inc.
- *
- * All Rights Reserved.
- *
- * Contributor(s): Cedric Bosdonnat
- *
- *
- ************************************************************************/
-package org.openoffice.ide.eclipse.core.wizards.pages;
-
-import java.io.File;
-import java.util.Iterator;
-
-import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
-import org.openoffice.ide.eclipse.core.gui.UnoProjectLabelProvider;
-import org.openoffice.ide.eclipse.core.gui.rows.ChoiceRow;
-import org.openoffice.ide.eclipse.core.gui.rows.DialogRow;
-import org.openoffice.ide.eclipse.core.gui.rows.FieldEvent;
-import org.openoffice.ide.eclipse.core.gui.rows.FileRow;
-import org.openoffice.ide.eclipse.core.gui.rows.IFieldChangedListener;
-import org.openoffice.ide.eclipse.core.gui.rows.LabeledRow;
-import org.openoffice.ide.eclipse.core.i18n.ImagesConstants;
-import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
-import org.openoffice.ide.eclipse.core.model.ProjectsManager;
-import org.openoffice.ide.eclipse.core.wizards.Messages;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.ElementListSelectionDialog;
-
-/**
- * Page of the OpenOffice.org package export wizard.
- * 
- * @author cedricbosdo
- *
- */
-public class PackageExportWizardPage extends WizardPage {
-
-    public static final String LAST_EXPORT_DIR = "__last_export_dir"; //$NON-NLS-1$
-    
-    private static final String DESTDIR = "__destdir"; //$NON-NLS-1$
-    private static final String OOVERSION = "__oooversion"; //$NON-NLS-1$
-    
-    private DialogRow mProjectRow;
-    private IUnoidlProject mProject;
-    private FileRow mOutputdirRow;
-    private ChoiceRow mOOoVersion;
-
-    /**
-     * Constructor.
-     * 
-     * @param pPageName the wizard page name
-     * @param pSelection the selection to export.
-     */
-    public PackageExportWizardPage(String pPageName, IStructuredSelection pSelection) {
-        super(pPageName);
-        setImageDescriptor(OOEclipsePlugin.getImageDescriptor(ImagesConstants.PACKAGE_EXPORT_WIZ));
-        setDescription(Messages.getString("PackageExportWizardPage.Description")); //$NON-NLS-1$
-        setTitle(Messages.getString("PackageExportWizardPage.Title")); //$NON-NLS-1$
-        
-        Iterator<?> iter = pSelection.iterator();
-        while (mProject == null && iter.hasNext()) {
-            Object o = iter.next();
-            
-            if (o instanceof IAdaptable) {
-                IAdaptable adaptable = (IAdaptable)o;
-                IResource res = (IResource)adaptable.getAdapter(IResource.class);
-                
-                try {
-                    String prjName = res.getProject().getName();
-                    IUnoidlProject project = ProjectsManager.getProject(prjName);
-                    if (project != null) {
-                        mProject = project;
-                    }
-                } catch (Exception e) {
-                }
-            }
-        }
-    }
-    
-    /**
-     * @return the project to export. 
-     */
-    public IUnoidlProject getProject() {
-        return mProject;
-    }
-    
-    /**
-     * @return the path where to export the project.
-     */
-    public File getOutputPath() {
-        IPreferenceStore store = OOEclipsePlugin.getDefault().getPreferenceStore();
-        store.setValue(LAST_EXPORT_DIR, mOutputdirRow.getValue());
-        return new File(mOutputdirRow.getValue());
-    }
-    
-    /**
-     * @return the extension of the package to generate.
-     */
-    public String getPackageExtension() {
-        return mOOoVersion.getValue();
-    }
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void createControl(Composite pParent) {
-        
-        Composite body = new Composite(pParent, SWT.NONE);
-        body.setLayoutData(new GridData(GridData.FILL_BOTH));
-        body.setLayout(new GridLayout(LabeledRow.LAYOUT_COLUMNS, false));
-        
-        mProjectRow = new DialogRow(body, "",  //$NON-NLS-1$
-                Messages.getString("PackageExportWizardPage.PackageLabel"), false) { //$NON-NLS-1$
-            @Override
-            public String doOpenDialog() {
-                String result = getValue();
-                
-                // Open the project selection dialog
-                ILabelProvider labelProvider = new UnoProjectLabelProvider();
-                ElementListSelectionDialog dialog = new ElementListSelectionDialog(
-                        getShell(), labelProvider);
-                dialog.setTitle(Messages.getString("PackageExportWizardPage.ChooserTitle")); //$NON-NLS-1$
-                dialog.setMessage(Messages.getString("PackageExportWizardPage.ChooserDescription")); //$NON-NLS-1$
-                dialog.setElements(ProjectsManager.getProjects());
-
-                if (dialog.open() == Window.OK) {
-                    mProject = (IUnoidlProject)dialog.getFirstResult();
-                    result = mProject.getName();
-                }
-                checkPageComplete();
-                return result;
-            }
-        };
-        if (mProject != null) {
-            mProjectRow.setValue(mProject.getName());
-        }
-        mProjectRow.setFieldChangedListener(new IFieldChangedListener() {
-            public void fieldChanged(FieldEvent pEvent) {
-                IUnoidlProject project = ProjectsManager.getProject(pEvent.getValue());
-                mProject = project;
-                    
-                checkPageComplete();
-            }
-        });
-        
-        mOutputdirRow = new FileRow(body, DESTDIR, 
-                Messages.getString("PackageExportWizardPage.DestinationLabel"), true); //$NON-NLS-1$
-        mOutputdirRow.setTooltip(Messages.getString("PackageExportWizardPage.DestinationTooltip")); //$NON-NLS-1$
-        
-        // Set the user dir or the latest dir if any
-        IPreferenceStore store = OOEclipsePlugin.getDefault().getPreferenceStore();
-        String lastDir = store.getString(LAST_EXPORT_DIR);
-        if ("".equals(lastDir)) { //$NON-NLS-1$
-            // Get the user home
-            lastDir = System.getProperty("user.home"); //$NON-NLS-1$
-        }
-        mOutputdirRow.setValue(lastDir);
-        
-        mOutputdirRow.setFieldChangedListener(new IFieldChangedListener() {
-            public void fieldChanged(FieldEvent pEvent) {
-                checkPageComplete();
-            }
-        });
-        
-        mOOoVersion = new ChoiceRow(body, OOVERSION, 
-                Messages.getString("PackageExportWizardPage.OOoVersionLabel"), null, false); //$NON-NLS-1$
-        mOOoVersion.setTooltip(Messages.getString("PackageExportWizardPage.OOoVersionTooltip")); //$NON-NLS-1$
-
-        mOOoVersion.add("1.x", "zip"); //$NON-NLS-1$ //$NON-NLS-2$
-        mOOoVersion.add("2.0", "uno.pkg"); //$NON-NLS-1$ //$NON-NLS-2$
-        mOOoVersion.add("2.0.4", "oxt"); //$NON-NLS-1$ //$NON-NLS-2$
-        mOOoVersion.select(1);
-        
-        setControl(body);
-    }
-    
-    /**
-     * Checks if the page is valid or not.
-     */
-    private void checkPageComplete() {
-        if (mProject == null) {
-            setErrorMessage(Messages.getString("PackageExportWizardPage.SelectProjectError")); //$NON-NLS-1$
-        }
-        
-        String outPath = mOutputdirRow.getValue();
-        boolean outputExists = false;
-        try {
-            outputExists = new File(outPath).exists();
-            if (!outputExists) {
-                setErrorMessage(Messages.getString("PackageExportWizardPage.WrongDestinationError")); //$NON-NLS-1$
-            }
-        } catch (Exception e) {
-            outputExists = false;
-            setErrorMessage(Messages.getString("PackageExportWizardPage.WrongDestinationError")); //$NON-NLS-1$
-        }
-        
-        if (mProject != null && outputExists) {
-            setPageComplete(true);
-            setErrorMessage(null);
-        } else {
-            setPageComplete(false);
-        }
-    }
-}
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
index fe6147b..9b4c99d 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
@@ -30,6 +30,8 @@
  ************************************************************************/
 package org.openoffice.ide.eclipse.core.wizards.pages;
 
+import java.io.File;
+import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -39,7 +41,9 @@ import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.SWT;
@@ -58,8 +62,15 @@ import org.eclipse.ui.internal.ide.DialogUtil;
 import org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup;
 import org.eclipse.ui.model.WorkbenchContentProvider;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.i18n.ImagesConstants;
+import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
 import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
 import org.openoffice.ide.eclipse.core.model.ProjectsManager;
+import org.openoffice.ide.eclipse.core.model.config.IOOo;
+import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
+import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
 import org.openoffice.ide.eclipse.core.wizards.Messages;
 
 /**
@@ -101,6 +112,7 @@ public class UnoPackageExportPage extends WizardPage {
         
         setTitle( Messages.getString("UnoPackageExportPage.Title") ); //$NON-NLS-1$
         setDescription( Messages.getString("UnoPackageExportPage.Description") ); //$NON-NLS-1$
+        setImageDescriptor( OOEclipsePlugin.getImageDescriptor( ImagesConstants.PACKAGE_EXPORT_WIZ ) );
         
         mSelectedProject = pPrj;
         mManifestPage = pManifestPage;
@@ -120,8 +132,9 @@ public class UnoPackageExportPage extends WizardPage {
         createDestinationGroup( );
         createOptionsGroup( );
         
+        setPageComplete( checkPageCompletion() );
+        
         // Load the data into the fields
-        restoreWidgetValues();
         loadData( );
     }
 
@@ -143,9 +156,7 @@ public class UnoPackageExportPage extends WizardPage {
             i++;
         }
         
-        // TODO Load the previously selected paths
-        
-        // TODO Load the saved checkboxes states
+        restoreWidgetValues();
     }
 
     /**
@@ -180,6 +191,7 @@ public class UnoPackageExportPage extends WizardPage {
                 if ( id != -1 ) {
                     String name = mProjectsList.getItem( id );
                     IUnoidlProject unoprj = ProjectsManager.getProject( name );
+                    mSelectedProject = unoprj;
                     
                     // Change the project in the manifest page
                     mManifestPage.setProject( unoprj );
@@ -188,6 +200,8 @@ public class UnoPackageExportPage extends WizardPage {
                     input.addAll( getFilteredChildren( unoprj ) );
                     mResourceGroup.setRoot( input );
                 }
+                
+                setPageComplete( checkPageCompletion() );
             }
         });
     }
@@ -232,6 +246,12 @@ public class UnoPackageExportPage extends WizardPage {
         
         mDestinationCombo = new Combo( rowBody, SWT.DROP_DOWN );
         mDestinationCombo.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
+        mDestinationCombo.addModifyListener( new ModifyListener() {
+            
+            public void modifyText(ModifyEvent pE) {
+                setPageComplete( checkPageCompletion() );
+            }
+        });
         
         Button btn = new Button( rowBody, SWT.PUSH );
         btn.setText( Messages.getString("UnoPackageExportPage.Browse") ); //$NON-NLS-1$
@@ -278,6 +298,13 @@ public class UnoPackageExportPage extends WizardPage {
         mAutodeployBox.setLayoutData( new GridData( SWT.BEGINNING, SWT.BEGINNING, false, false ) );
     }
     
+    /**
+     * @return <code>true</code> if the page is complete, <code>false</code> otherwise.
+     */
+    private boolean checkPageCompletion() {
+        return !mDestinationCombo.getText().isEmpty() && mProjectsList.getSelectionIndex() != -1;
+    }
+    
     /*
      * Data handling and filtering methods
      */
@@ -329,6 +356,7 @@ public class UnoPackageExportPage extends WizardPage {
         hidden |= pRes.getName().equals( "description.xml" ); //$NON-NLS-1$
         hidden |= pRes.getName().equals( "MANIFEST.MF" ); //$NON-NLS-1$
         hidden |= pRes.getName().equals( "manifest.xml" ); //$NON-NLS-1$
+        hidden |= pRes.getName().equals( "types.rdb" ); //$NON-NLS-1$
         
         return hidden;
     }
@@ -381,11 +409,18 @@ public class UnoPackageExportPage extends WizardPage {
             settings.put( AUTODEPLOY, mAutodeployBox.getSelection() );
             
             String[] topItems = new String[ MAX_DESTINATION_STORED ];
-            topItems[0] = mDestinationCombo.getText();
-            int i = 0;
+            String firstItem = mDestinationCombo.getText().trim();
+            topItems[0] = firstItem;
+            int items_i = 0;
+            int top_i = 0;
             int count = mDestinationCombo.getItemCount();
-            while ( i < count && i < MAX_DESTINATION_STORED - 1 ) {
-                topItems[i + 1] = mDestinationCombo.getItem( i );
+            while ( top_i < MAX_DESTINATION_STORED - 1 && items_i < count ) {
+                String item = mDestinationCombo.getItem( items_i ).trim( );
+                if ( mDestinationCombo.getSelectionIndex() != items_i ) {
+                    topItems[ top_i + 1 ] = item;
+                    top_i++;
+                }
+                items_i++;
             }
             settings.put( DESTINATION_HISTORY, topItems );
         }
@@ -407,4 +442,86 @@ public class UnoPackageExportPage extends WizardPage {
             }
         }
     }
+
+    /**
+     * @return the package model built from the data provided by the user or <code>null</code> if 
+     *          something blocked the process.
+     */
+    public UnoPackage getPackageModel() {
+        UnoPackage pack = null;
+        
+        try {
+            // Test the existence of the destination: warning may be needed
+            boolean doit = true;
+            File destFile = new File( mDestinationCombo.getText() );
+            if ( destFile.exists() && !mOverwriteBox.getSelection() ) {
+                String msg = MessageFormat.format( 
+                        Messages.getString("UnoPackageExportPage.OverwriteQuestion"), //$NON-NLS-1$ 
+                        destFile.getPath() );
+                doit = MessageDialog.openQuestion( getShell(), getTitle(), msg);
+            }
+
+            if ( doit ) {
+                // Export the library
+                IPath libraryPath = null;
+                ILanguageBuilder langBuilder = mSelectedProject.getLanguage().getLanguageBuidler();
+                libraryPath = langBuilder.createLibrary( mSelectedProject );
+
+                // Create the package model
+                pack = UnoidlProjectHelper.createMinimalUnoPackage( mSelectedProject, destFile );
+                pack.addToClean( libraryPath );
+
+                // Add the additional content to the package
+                List<?> items = mResourceGroup.getAllWhiteCheckedItems();
+                for (Object item : items) {
+                    if ( item instanceof IResource ) {
+                        IResource res = (IResource)item;
+                        pack.addContent( res );
+                    }
+                }
+                
+                // Create the deployer instance
+                if ( mAutodeployBox.getSelection() ) {
+                    DeployerJob job = new DeployerJob( mSelectedProject.getOOo(), destFile );
+                    pack.setDeployJob( job );
+                }
+            }
+        } catch ( Exception e ) {
+            PluginLogger.error( Messages.getString("UnoPackageExportPage.LibraryCreationError"), e ); //$NON-NLS-1$
+        }
+        
+        return pack;
+    }
+    
+    /**
+     * Thread performing the package deployment into OpenOffice.org.
+     * 
+     * @author Cédric Bosdonnat
+     *
+     */
+    class DeployerJob implements Runnable {
+        
+        private IOOo mOOo;
+        private File mDest;
+        
+        /**
+         * Constructor.
+         * 
+         * @param pOoo the OpenOffice.org where to deploy
+         * @param pDest the package to deploy
+         */
+        DeployerJob(IOOo pOoo, File pDest) {
+            mOOo = pOoo;
+            mDest = pDest;
+        }
+        
+        /**
+         * {@inheritDoc}
+         */
+        public void run() {
+            if (mOOo.canManagePackages()) {
+                mOOo.updatePackage(mDest);
+            }
+        }
+    }
 }
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
index 0cea493..65cfd05 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
@@ -111,8 +111,8 @@ public class JavaBuilder implements ILanguageBuilder {
         getRegistrationClassName(pUnoProject);
         description.setManifestProvider( new UnoManifestProvider( regClassname ) );
         description.setManifestLocation( pUnoProject.getFile( "MANIFEST.MF" ).getFullPath() ); //$NON-NLS-1$
-        description.setSaveManifest( true );
-        description.setReuseManifest( true );
+        description.setSaveManifest( false );
+        description.setReuseManifest( false );
         description.setExportOutputFolders( true );
         description.setExportClassFiles( true );
         description.setExportWarnings( true );
commit 14120737802e73e974e243c3d66d64dc03316178
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Dec 1 12:12:26 2009 +0100

    Regview tool wasn't run: fixed the paths

diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java b/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java
index 3064b23..6da6359 100755
--- a/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/registry/RegDocumentProvider.java
@@ -94,7 +94,7 @@ public class RegDocumentProvider extends FileDocumentProvider {
             
             // Try to run regview on the file
         
-            String command = "regview " + file.getProjectRelativePath().toOSString();  //$NON-NLS-1$
+            String command = "regview " + file.getLocation().toOSString();  //$NON-NLS-1$
                     
             Process process = unoproject.getSdk().runTool(unoproject, command, null);
                         
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java
index 910ae12..511867c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java
@@ -50,6 +50,7 @@ import java.util.Iterator;
 import java.util.Set;
 import java.util.Map.Entry;
 
+import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Platform;
 import org.openoffice.ide.eclipse.core.PluginLogger;
 
@@ -61,6 +62,8 @@ import org.openoffice.ide.eclipse.core.PluginLogger;
  */
 public class SystemHelper {
     
+    public static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$
+    
     private static final int COMMAND_ARGS_LENGTH = 3;
 
     /**
@@ -70,6 +73,31 @@ public class SystemHelper {
      *         new variable
      * @param pName the name of the variable to add
      * @param pValue    the value of the variable to add
+     * 
+     * @return the completed array
+     */
+    public static String[] addPathEnv( String[] pEnv, String pName, String[] pValue ) {
+        
+        String values = new String();
+        for (int i = 0; i < pValue.length; i++) {
+            String path = pValue[i];
+            String tmpValue = new Path(path).toOSString();
+            if (i < pValue.length - 1) {
+                tmpValue += PATH_SEPARATOR;
+            }
+            values += tmpValue;
+        }
+        
+        return addEnv( pEnv, pName, values, PATH_SEPARATOR );
+    }
+    
+    /**
+     * Add an environment variable to an array of existing variables.
+     * 
+     * @param pEnv the array of existing environment variables where to add the
+     *         new variable
+     * @param pName the name of the variable to add
+     * @param pValue    the value of the variable to add
      * @param pSeparator the separator to use if there is already a variable with
      *         the same name. If <code>null</code>, the old variable will be replaced
      * 
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
index 26a338e..46b79a3 100755
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
@@ -91,8 +91,6 @@ public class SDK implements ISdk, ITableElement {
      */
     private static final String F_DK_CONFIG = "dk.mk"; //$NON-NLS-1$
 
-    private static final String PATH_SEPARATOR = System.getProperty("path.separator"); //$NON-NLS-1$
-
     private static final String INCLUDE = "include"; //$NON-NLS-1$
     private static final String LIB = "lib"; //$NON-NLS-1$
 
@@ -397,7 +395,7 @@ public class SDK implements ISdk, ITableElement {
             if (m.matches()) {
                 String name = m.group(1);
                 String value = m.group(2);
-                vars = SystemHelper.addEnv(pBaseEnv, name, value, PATH_SEPARATOR);
+                vars = SystemHelper.addEnv(pBaseEnv, name, value, SystemHelper.PATH_SEPARATOR);
             }
         }
         return vars;
@@ -420,42 +418,34 @@ public class SDK implements ISdk, ITableElement {
      *      OpenOffice.org SDK is available.
      */
     private String[] updateEnvironment(String[] pVars, IOOo pOoo) throws Exception {
-        String binPath = getBinPath().toOSString();
+        String[] oooBinPaths = pOoo.getBinPath();
+        String[] binPaths = new String[ oooBinPaths.length + 1 ];
+        binPaths[ 0 ] = getBinPath().toOSString();
+        System.arraycopy( oooBinPaths, 0, binPaths, 1, oooBinPaths.length );
         
-        // Extract the libraries paths
-        String[] paths = pOoo.getLibsPath();
-        String oooLibs = ""; //$NON-NLS-1$
-        for (int i = 0; i < paths.length; i++) {
-            String path = paths[i];
-            String oooLibsPath = new Path(path).toOSString();
-            if (i < paths.length - 1) {
-                oooLibsPath += PATH_SEPARATOR;
-            }
-            oooLibs += oooLibsPath;
-        }
+        String[] oooLibs = pOoo.getLibsPath();
         
         // Create the exec parameters depending on the OS
         if (Platform.getOS().equals(Platform.OS_WIN32)) {
             
             // Definining path variables
-            pVars = SystemHelper.addEnv(pVars, "PATH", binPath + PATH_SEPARATOR +  //$NON-NLS-1$
-                    oooLibs, PATH_SEPARATOR);
+            pVars = SystemHelper.addPathEnv(pVars, "PATH", binPaths); //$NON-NLS-1$
             
         } else if (Platform.getOS().equals(Platform.OS_LINUX) ||
                 Platform.getOS().equals(Platform.OS_SOLARIS)) {
             
             // An UN*X platform   
-            String[] tmpVars = SystemHelper.addEnv(pVars, "PATH",  //$NON-NLS-1$
-                    binPath, PATH_SEPARATOR);
-            pVars = SystemHelper.addEnv(tmpVars, "LD_LIBRARY_PATH", //$NON-NLS-1$
-                    oooLibs, PATH_SEPARATOR);
+            String[] tmpVars = SystemHelper.addPathEnv(pVars, "PATH",  //$NON-NLS-1$
+                    binPaths );
+            pVars = SystemHelper.addPathEnv(tmpVars, "LD_LIBRARY_PATH", //$NON-NLS-1$
+                    oooLibs );
             
         } else if (Platform.getOS().equals(Platform.OS_MACOSX)) { 
             
-            String[] tmpVars = SystemHelper.addEnv(pVars, "PATH",  //$NON-NLS-1$
-                    binPath, PATH_SEPARATOR);
-            pVars = SystemHelper.addEnv(tmpVars, "DYLD_LIBRARY_PATH", //$NON-NLS-1$
-                    oooLibs, PATH_SEPARATOR);
+            String[] tmpVars = SystemHelper.addPathEnv(pVars, "PATH",  //$NON-NLS-1$
+                    binPaths );
+            pVars = SystemHelper.addPathEnv(tmpVars, "DYLD_LIBRARY_PATH", //$NON-NLS-1$
+                    oooLibs);
             
         } else {
             // Unmanaged OS
commit af8c861e38b05780973fb9401b900770053406e8
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Tue Dec 1 12:11:11 2009 +0100

    Missing URE types in the UNO types selector

diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/office/TypesGetter.java b/core/source/org/openoffice/ide/eclipse/core/internal/office/TypesGetter.java
index 19939b2..a48e3cd 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/office/TypesGetter.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/office/TypesGetter.java
@@ -43,6 +43,7 @@
  ************************************************************************/
 package org.openoffice.ide.eclipse.core.internal.office;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -208,7 +209,12 @@ public class TypesGetter {
             String url = mConnection.convertToUrl(path);
             if (url != null) {
                 String oooKey = mConnection.getOOo().getName();
-                results.put(oooKey, getTypesFromRegistry(url, false));
+                List<InternalUnoType> types = results.get( oooKey );
+                if ( types == null ) {
+                    types = new ArrayList<InternalUnoType>();
+                    results.put( oooKey, types );
+                }
+                types.addAll( getTypesFromRegistry(url, false) );
             }
         }
 


More information about the ooo-build-commit mailing list