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

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Nov 16 12:24:24 PST 2009


 core/META-INF/MANIFEST.MF                                                             |    8 
 core/plugin.properties                                                                |    6 
 core/plugin.xml                                                                       |   38 -
 core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java      |  120 ++++
 core/source/org/openoffice/ide/eclipse/core/actions/Messages.java                     |   22 
 core/source/org/openoffice/ide/eclipse/core/actions/NewUnoFileAction.java             |   96 ---
 core/source/org/openoffice/ide/eclipse/core/actions/messages.properties               |    1 
 core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties              |    1 
 core/source/org/openoffice/ide/eclipse/core/i18n/ImagesConstants.java                 |    1 
 core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java |    8 
 core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java                  |  116 ++++
 core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java             |  260 ++++++++
 core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java                |  290 ++--------
 core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java                     |   16 
 core/source/org/openoffice/ide/eclipse/core/wizards/NewUnoFileWizard.java             |   95 ---
 core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java          |   25 
 core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties               |    2 
 core/source/org/openoffice/ide/eclipse/core/wizards/pages/NewUnoFilePage.java         |  236 --------
 dev/null                                                                              |binary
 java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java                          |  122 +---
 java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java                   |    7 
 java/source/org/openoffice/ide/eclipse/java/build/FilesVisitor.java                   |   39 +
 java/source/org/openoffice/ide/eclipse/java/build/UnoManifestProvider.java            |   56 +
 java/source/org/openoffice/ide/eclipse/java/utils/ZipContentHelper.java               |  121 ----
 24 files changed, 788 insertions(+), 898 deletions(-)

New commits:
commit 27da4dca00f2f5ae2e0d6b42e4bd8802ae3eef8a
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Mon Nov 16 21:22:04 2009 +0100

    [core]Export refactoring
    
     * Created a model for the manifest.xml file.
     * Use that model in the uno package model
     * Rewrote the export code to use JDT Jar creation classes and the new
       manifest.xml model.
    
    There are still some bugs in the generated manifest.xml: the jar and
    types.rdg files are forgotten...

diff --git a/core/META-INF/MANIFEST.MF b/core/META-INF/MANIFEST.MF
index 0eced6f..c30f0a0 100755
--- a/core/META-INF/MANIFEST.MF
+++ b/core/META-INF/MANIFEST.MF
@@ -26,16 +26,24 @@ Export-Package: org.openoffice.ide.eclipse.core,
  org.openoffice.ide.eclipse.core.builders,
  org.openoffice.ide.eclipse.core.editors,
  org.openoffice.ide.eclipse.core.editors.description,
+ org.openoffice.ide.eclipse.core.editors.idl,
+ org.openoffice.ide.eclipse.core.editors.pack,
+ org.openoffice.ide.eclipse.core.editors.registry,
  org.openoffice.ide.eclipse.core.editors.syntax,
+ org.openoffice.ide.eclipse.core.editors.utils,
  org.openoffice.ide.eclipse.core.gui,
  org.openoffice.ide.eclipse.core.gui.rows,
  org.openoffice.ide.eclipse.core.i18n,
+ org.openoffice.ide.eclipse.core.internal.helpers;x-internal:=true,
+ org.openoffice.ide.eclipse.core.internal.model;x-internal:=true,
+ org.openoffice.ide.eclipse.core.internal.office;x-internal:=true,
  org.openoffice.ide.eclipse.core.launch,
  org.openoffice.ide.eclipse.core.model,
  org.openoffice.ide.eclipse.core.model.config,
  org.openoffice.ide.eclipse.core.model.description,
  org.openoffice.ide.eclipse.core.model.language,
  org.openoffice.ide.eclipse.core.model.pack,
+ org.openoffice.ide.eclipse.core.model.utils,
  org.openoffice.ide.eclipse.core.office,
  org.openoffice.ide.eclipse.core.preferences,
  org.openoffice.ide.eclipse.core.unittests,
diff --git a/core/icons/newunofile.gif b/core/icons/newunofile.gif
deleted file mode 100644
index baf1cea..0000000
Binary files a/core/icons/newunofile.gif and /dev/null differ
diff --git a/core/icons/newunofile_wiz.gif b/core/icons/newunofile_wiz.gif
deleted file mode 100644
index ba118c5..0000000
Binary files a/core/icons/newunofile_wiz.gif and /dev/null differ
diff --git a/core/plugin.properties b/core/plugin.properties
index d51b704..ea13d76 100755
--- a/core/plugin.properties
+++ b/core/plugin.properties
@@ -23,19 +23,13 @@ newactions.name          = Uno idl creation wizards
 newactions.description   = Quick access to the file and project creation wizards
 newactions.newproject.name     = New UNO-IDL project
 newactions.newproject.tooltip  = Launch the new UNO-IDL project wizard
-newactions.newfile.name        = New UNO-IDL file
-newactions.newfile.tooltip     = Launch the new UNO-IDL file wizard
 
 idlcerrormarker.name           = Marker for idlc errors 
 
 cheatsheets.name                 = OpenOffice.org extensions
-cheatsheets.starting.name        = Starting to use the plugin
-cheatsheets.starting.description = This tutorial will guide you trough the differents necessary steps \
-                                   to start a new component for the first time.
                                    
 project.propertypage.name        = UNO properties
 
-contenttype.name                 = UNO-IDL content type
 Bundle-Name = OOo eclipse integration
 
 wizard.file.description = Create a new UNO specification file. Please use this wizard with care: you should better run the type-specific wizards if they exists.
diff --git a/core/plugin.xml b/core/plugin.xml
index 90c9ffa..5cd2931 100755
--- a/core/plugin.xml
+++ b/core/plugin.xml
@@ -60,19 +60,6 @@
    	        name="%wizards">
    	  </category>
       <wizard
-            canFinishEarly="true"
-            category="org.openoffice.ide.eclipse.core"
-            class="org.openoffice.ide.eclipse.core.wizards.NewUnoFileWizard"
-            hasPages="true"
-            icon="icons/newunofile.gif"
-            id="org.openoffice.ide.eclipse.core.newunofile"
-            name="%wizards.unoidlfile"
-            project="false">
-         <description>
-            %wizard.file.description
-         </description>
-      </wizard>
-      <wizard
             canFinishEarly="false"
             category="org.openoffice.ide.eclipse.core"
             hasPages="true"
@@ -165,16 +152,6 @@
                style="pulldown"
                toolbarPath="uno"
                tooltip="%action.service.tooltip"/>
-         <!--
-         <action
-               class="org.openoffice.ide.eclipse.core.actions.NewUnoFileAction"
-               icon="icons/newunofile.gif"
-               id="org.openoffice.ide.eclipse.core.newactions.newfile"
-               label="%newactions.newfile.name"
-               style="push"
-               toolbarPath="uno"
-               tooltip="%newactions.newfile.tooltip"/>
-         -->
       </actionSet>
    </extension>
    <extension
@@ -321,4 +298,19 @@
             file-extensions="xcu,xcs">
       </file-association>
    </extension>
+   <extension
+         point="org.eclipse.ui.popupMenus">
+      <objectContribution
+            adaptable="false"
+            id="org.openoffice.ide.eclipse.core.objectContribution1"
+            nameFilter="package.properties"
+            objectClass="org.eclipse.core.resources.IFile">
+         <action
+               class="org.openoffice.ide.eclipse.core.actions.ConvertToManifestAction"
+               enablesFor="1"
+               id="org.openoffice.ide.eclipse.core.actions.create_manifest"
+               label="Convert to manifest">
+         </action>
+      </objectContribution>
+   </extension>
 </plugin>
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java b/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java
new file mode 100644
index 0000000..c1984c7
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java
@@ -0,0 +1,120 @@
+/*************************************************************************
+ *
+ * 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.actions;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.Locale;
+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.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.model.pack.ManifestModel;
+import org.openoffice.ide.eclipse.core.model.pack.PackagePropertiesModel;
+import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+
+public class ConvertToManifestAction implements IObjectActionDelegate {
+
+    private IFile mPackageFile;
+
+    public void setActivePart(IAction pAction, IWorkbenchPart pTargetPart) {
+        // No need of the target part
+    }
+
+    public void run( IAction pAction ) {
+        PackagePropertiesModel propsModel = new PackagePropertiesModel( mPackageFile );
+        ManifestModel manifestModel = new ManifestModel();
+        
+        for (IFolder lib : propsModel.getBasicLibraries()) {
+            manifestModel.addBasicLibrary( lib );
+        }
+        
+        for (IFolder lib : propsModel.getDialogLibraries()) {
+            manifestModel.addDialogLibrary( lib );
+        }
+        
+        for (IResource content : propsModel.getContents()) {
+            manifestModel.addContent( content );
+        }
+        
+        Iterator<Entry<Locale, IFile>> iter = propsModel.getDescriptionFiles().entrySet().iterator();
+        while ( iter.hasNext() ) {
+            Entry<Locale, IFile> entry = iter.next();
+            manifestModel.addDescription( entry.getValue(), entry.getKey() );
+        }
+        
+        // Serialize the manifest model into the manifest.xml file
+        IFile manifestFile = mPackageFile.getParent().getFile( new Path( UnoPackage.MANIFEST_PATH ) );
+        File file = new File( manifestFile.getLocationURI() );
+        
+        if ( !file.exists() || file.canWrite() ) {
+            FileOutputStream out = null;
+
+            try {
+                out = new FileOutputStream( file );
+                manifestModel.write( out );
+            } catch ( Exception e ) {
+                PluginLogger.error( Messages.getString("ConvertToManifestAction.WriteError0"), e ); //$NON-NLS-1$
+            } finally {
+                try { out.close(); } catch (IOException e) { }
+            }
+
+            // Refresh the file
+            try {
+                manifestFile.refreshLocal( IResource.DEPTH_ZERO, null );
+            } catch (CoreException e) {
+            }
+            
+            manifestModel.dispose();
+        }
+    }
+
+    public void selectionChanged(IAction pAction, ISelection pSelection) {
+        if ( !pSelection.isEmpty() && pSelection instanceof IStructuredSelection ) {
+            IStructuredSelection sel = (IStructuredSelection)pSelection;
+            Object o = sel.getFirstElement();
+            if ( o instanceof IFile ) {
+                mPackageFile = ( IFile )o;
+            }
+        }
+    }
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/Messages.java b/core/source/org/openoffice/ide/eclipse/core/actions/Messages.java
new file mode 100644
index 0000000..486829e
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/Messages.java
@@ -0,0 +1,22 @@
+package org.openoffice.ide.eclipse.core.actions;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages {
+    private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.core.actions.messages"; //$NON-NLS-1$
+
+    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+            .getBundle(BUNDLE_NAME);
+
+    private Messages() {
+    }
+
+    public static String getString(String key) {
+        try {
+            return RESOURCE_BUNDLE.getString(key);
+        } catch (MissingResourceException e) {
+            return '!' + key + '!';
+        }
+    }
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/NewUnoFileAction.java b/core/source/org/openoffice/ide/eclipse/core/actions/NewUnoFileAction.java
deleted file mode 100644
index e344818..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/actions/NewUnoFileAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: NewUnoFileAction.java,v $
- *
- * $Revision: 1.3 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2007/11/25 20:32:31 $
- *
- * 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.actions;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.openoffice.ide.eclipse.core.wizards.NewUnoFileWizard;
-
-/**
- * This action is used to create a new UNO File. Please note that this class
- * should be dropped before the 1.1 version fo the plugin.
- * 
- * @author cedricbosdo
- */
-public class NewUnoFileAction implements IWorkbenchWindowActionDelegate {
-
-    private IWorkbenchWindow mWindow;
-    
-    /**
-     * {@inheritDoc}
-     */
-    public void dispose() {
-        // Nothing to do on dispose
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void init(IWorkbenchWindow pWindow) {
-        this.mWindow = pWindow;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void run(IAction pAction) {
-        // Launch the new IDL File wizard
-        NewUnoFileWizard wizard = new NewUnoFileWizard();
-        WizardDialog dialog = new WizardDialog(mWindow.getShell(), wizard);
-        wizard.init(mWindow.getWorkbench(), new StructuredSelection());
-        
-        dialog.open();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void selectionChanged(IAction pAction, ISelection pSelection) {
-        // Nothing to do on selection change
-    }
-}
\ No newline at end of file
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/messages.properties b/core/source/org/openoffice/ide/eclipse/core/actions/messages.properties
new file mode 100644
index 0000000..e87825f
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/messages.properties
@@ -0,0 +1 @@
+ConvertToManifestAction.WriteError0=Can't write manifest.xml
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 58691a7..d66335d 100755
--- a/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties
+++ b/core/source/org/openoffice/ide/eclipse/core/i18n/ImageManager.properties
@@ -3,7 +3,6 @@ OOO_DIALOG_IMAGE    = /icons/ooo_banner.gif
 ERROR               = /icons/error.gif
 UNO_PROJECT         = /icons/uno_prj.gif
 NEWPROJECT_WIZ      = /icons/newunoprj_wiz.gif
-NEWFILE_WIZ         = /icons/newunofile_wiz.gif
 NEW_SERVICE_IMAGE   = /icons/newservice_wiz.gif
 CHECKED             = /icons/checked.gif
 UNCHECKED           = /icons/unchecked.gif
diff --git a/core/source/org/openoffice/ide/eclipse/core/i18n/ImagesConstants.java b/core/source/org/openoffice/ide/eclipse/core/i18n/ImagesConstants.java
index 4e04fcd..0f748e3 100755
--- a/core/source/org/openoffice/ide/eclipse/core/i18n/ImagesConstants.java
+++ b/core/source/org/openoffice/ide/eclipse/core/i18n/ImagesConstants.java
@@ -57,7 +57,6 @@ public class ImagesConstants {
     public static final String ERROR = "ERROR"; //$NON-NLS-1$
     public static final String UNO_PROJECT = "UNO_PROJECT"; //$NON-NLS-1$
     public static final String NEWPROJECT_WIZ = "NEWPROJECT_WIZ"; //$NON-NLS-1$
-    public static final String NEWFILE_WIZ = "NEWFILE_WIZ"; //$NON-NLS-1$
     public static final String NEW_SERVICE_IMAGE = "NEW_SERVICE_IMAGE"; //$NON-NLS-1$
     public static final String CHECKED = "CHECKED"; //$NON-NLS-1$
     public static final String UNCHECKED = "UNCHECKED"; //$NON-NLS-1$
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
index 249d9d1..94e6f11 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java
@@ -52,6 +52,7 @@ import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 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.core.runtime.IProgressMonitor;
@@ -509,12 +510,13 @@ public class UnoidlProjectHelper {
      * 
      * @return the minimal {@link UnoPackage}
      */
-    public static UnoPackage createMinimalUnoPackage(IUnoidlProject pPrj, File pDest, File pDir) {
+    public static UnoPackage createMinimalUnoPackage(IUnoidlProject pPrj, File pDest) {
 
-        UnoPackage unoPackage = new UnoPackage(pDest, pDir);
+        IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( pPrj.getName() );
+        UnoPackage unoPackage = new UnoPackage(pDest, prj);
         
         // Add content to the package
-        unoPackage.addTypelibraryFile(new File(pDir, "types.rdb"), "RDB"); //$NON-NLS-1$ //$NON-NLS-2$
+        unoPackage.addTypelibraryFile( pPrj.getFile( pPrj.getTypesPath() ), "RDB"); //$NON-NLS-1$
         pPrj.getLanguage().getLanguageBuidler().fillUnoPackage(unoPackage, pPrj);
         
         return unoPackage;
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java b/core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java
new file mode 100644
index 0000000..a2eb0d9
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * 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.model.pack;
+
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
+public class FileType {
+    
+    public static final String MIME_XCU = "application/vnd.sun.star.configuration-data"; //$NON-NLS-1$
+    public static final String MIME_XCS = "application/vnd.sun.star.configuration-schema"; //$NON-NLS-1$
+    public static final String MIME_DIALOG_LIB = "application/vnd.sun.star.dialog-library"; //$NON-NLS-1$
+    public static final String MIME_BASIC_LIB = "application/vnd.sun.star.basic-library"; //$NON-NLS-1$
+    public static final String MIME_UNO_TYPES = "application/vnd.sun.star.uno-typelibrary"; //$NON-NLS-1$
+    public static final String MIME_UNO_COMPONENT = "application/vnd.sun.star.uno-component"; //$NON-NLS-1$
+    public static final String MIME_DESCRIPTION = "application/vnd.sun.star.package-bundle-description"; //$NON-NLS-1$
+    
+    public static final String PARAM_LOCALE = "locale"; //$NON-NLS-1$
+    public static final String PARAM_TYPE = "type"; //$NON-NLS-1$
+    public static final String PARAM_PLATFORM = "platform"; //$NON-NLS-1$
+
+    String mMimeType;
+    HashMap< String, String > mParams = new HashMap<String, String>();
+    
+    /**
+     * Constructor.
+     * 
+     * @param pMime the mime type of the file.
+     */
+    public FileType( String pMime ) {
+        mMimeType = pMime;
+    }
+    
+    public void dispose() {
+        mParams.clear();
+    }
+    
+    /**
+     * @return the mimeType
+     */
+    public String getMimeType() {
+        return mMimeType;
+    }
+    
+    /**
+     * @param pName the name of the parameter to add
+     * @param pValue the value of the parameter to add
+     */
+    public void addParam( String pName, String pValue ) { 
+        mParams.put( pName, pValue );
+    }
+    
+    /**
+     * @param pName the name of the parameter to remove
+     */
+    public void removeParam( String pName ) {
+        mParams.remove( pName );
+    }
+    
+    /**
+     * @return a copy of the parameters map. Changing this object will have no effect.
+     */
+    public HashMap< String, String > getParams( ) {
+        HashMap<String, String> copy = new HashMap<String, String>( );
+        copy.putAll( mParams );
+        return copy;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        String type = mMimeType;
+        
+        // Output the params if any
+        Iterator< Entry< String, String > > iter = mParams.entrySet().iterator();
+        String paramPattern = ";{0}={1}";  //$NON-NLS-1$
+        while ( iter.hasNext() ) {
+            Entry< String, String > entry = iter.next();
+            type += MessageFormat.format( paramPattern, entry.getKey(), entry.getValue() );
+        }
+        
+        return type;
+    }
+}
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java b/core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java
new file mode 100644
index 0000000..0ed1f31
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * 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.model.pack;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+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.CoreException;
+
+public class ManifestModel {
+    
+    private static final String EXT_XCS = ".xcs"; //$NON-NLS-1$
+    private static final String EXT_XCU = ".xcu"; //$NON-NLS-1$
+    private static final String EXT_RDB = ".rdb"; //$NON-NLS-1$
+    
+    private HashMap<String, FileType> mEntries = new HashMap<String, FileType>();
+    
+    public void dispose( ) {
+        Collection< FileType > values = mEntries.values();
+        for ( FileType value : values ) {
+            value.dispose( );
+        }
+        mEntries.clear();
+    }
+    
+    /**
+     * Add a file or directory to the package.
+     * 
+     * <p>This method doesn't know about the different languages
+     * contributions to the <code>manifest.xml</code> file.</p>
+     * 
+     * @param pContent the file or folder to add
+     */
+    public void addContent( IResource pContent ) {
+        if ( pContent instanceof IFile ) {
+            IFile file = ( IFile ) pContent;
+            if ( pContent.getName().endsWith( EXT_XCS ) ) {
+                addConfigurationSchemaFile( file );
+            } else if ( pContent.getName().endsWith( EXT_XCU ) ) {
+                addConfigurationDataFile( file );
+            } else if ( pContent.getName().endsWith( EXT_RDB ) ) {
+                addTypelibraryFile( file, "RDB" ); //$NON-NLS-1$
+            }
+        } else {
+            // Recurse on the directory
+            IFolder folder = ( IFolder ) pContent;
+            IResource[] members;
+            try {
+                members = folder.members();
+                for ( IResource child : members ) {
+                    addContent( child );
+                }
+            } catch (CoreException e) {
+            }
+        }
+    }
+    
+    /**
+     * 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 
+     * language and should be given as defined in the OOo Developer's Guide, like
+     * Java, native, Python.
+     * 
+     * @param pFile the file to add to the package
+     * @param pType the type of the file to add.
+     * 
+     * @see #addComponentFile(File, String, String) for platform support
+     */
+    public void addComponentFile( IFile pFile, String pType) {
+        addComponentFile( pFile, pType, null );
+    }
+    
+    /**
+     * Add a uno component file, for example a jar, shared library or python file
+     * containing the uno implementation. 
+     * 
+     * <p>The type of the file defines the language and should be given as defined
+     * in the OOo Developer's Guide, like Java, native, Python.</p>
+     * 
+     * @param pFile the file to add to the package
+     * @param pType the type of the file to add.
+     * @param pPlatform optional parameter to use only with native type. Please
+     *         refer to the OOo Developer's Guide for more information.
+     */
+    public void addComponentFile( IFile pFile, String pType, String pPlatform ) {
+        FileType type = new FileType( FileType.MIME_UNO_COMPONENT );
+        type.addParam( FileType.PARAM_TYPE, pType );
+        if ( pPlatform != null && pType.equals( "native" ) ) { //$NON-NLS-1$
+            type.addParam(FileType.PARAM_PLATFORM, pPlatform ); 
+        }
+        String relPath = pFile.getProjectRelativePath().toString();
+        
+        addEntry( relPath, type );
+    }
+    
+    /**
+     * Add a type library to the package. 
+     * 
+     * <p>Note that by some strange way, a jar dependency can be added 
+     * in the package as a type library like RDB files.</p>
+     *  
+     * @param pFile the file to add 
+     * @param pType the type of the file as specified in the OOo Developer's Guide
+     */
+    public void addTypelibraryFile( IFile pFile, String pType ) {
+        FileType type = new FileType( FileType.MIME_UNO_TYPES );
+        type.addParam( FileType.PARAM_TYPE, pType );
+        String relPath = pFile.getProjectRelativePath().toString();
+        
+        addEntry( relPath, type );
+    }
+    
+    /**
+     * Add a basic library to the package. 
+     * 
+     * <p>Even if this method may not be used, it is possible.</p>
+     * 
+     * @param pDir the directory of the basic library.
+     */
+    public void addBasicLibrary( IFolder pDir ) {
+        FileType type = new FileType( FileType.MIME_BASIC_LIB );
+        String relPath = pDir.getProjectRelativePath().toString();
+
+        addEntry( relPath, type );
+    }
+    
+    /**
+     * Add a dialog library to the package. 
+     * 
+     * <p>Even if this method may not be used, it is possible.</p>
+     * 
+     * @param pDir the directory of the dialog library.
+     */
+    public void addDialogLibrary( IFolder pDir ) {
+        FileType type = new FileType( FileType.MIME_DIALOG_LIB );
+        String relPath = pDir.getProjectRelativePath().toString();
+
+        addEntry( relPath, type );
+    }
+    
+    /**
+     * Add an xcu configuration to the package.
+     * 
+     * @param pFile the xcu file to add
+     */
+    public void addConfigurationDataFile( IFile pFile ) {
+        if ( pFile.getName( ).endsWith( EXT_XCU ) ) {
+            FileType type = new FileType( FileType.MIME_XCU );
+            String relPath = pFile.getProjectRelativePath().toString();
+            
+            addEntry( relPath, type );
+        }
+    }
+    
+    /**
+     * Add an xcs configuration to the package.
+     * 
+     * @param pFile the xcs file to add
+     */
+    public void addConfigurationSchemaFile( IFile pFile ) {
+        if ( pFile.getName( ).endsWith( EXT_XCS ) ) {
+            FileType type = new FileType( FileType.MIME_XCS );
+            String relPath = pFile.getProjectRelativePath().toString();
+            
+            addEntry( relPath, type );
+        }
+    }
+    
+    /**
+     * Add a localized description of the package.
+     * 
+     * @param pDescriptionFile the file containing the description for that locale
+     * @param pLocale the locale of the description. Can be <code>null</code>.
+     */
+    public void addDescription( IFile pDescriptionFile, Locale pLocale ) {
+        // write the description to a file
+        String localeString = new String();
+        if (pLocale != null) {
+            localeString = pLocale.toString();
+            localeString = localeString.replace("_", "-"); //$NON-NLS-1$ //$NON-NLS-2$
+        }
+
+        // Add the file entry to the manifest
+        FileType type = new FileType( FileType.MIME_DESCRIPTION );
+        if ( !localeString.isEmpty() ) {
+            type.addParam( FileType.PARAM_LOCALE, localeString );
+        }
+        String relPath = pDescriptionFile.getProjectRelativePath().toString();
+
+        addEntry( relPath, type );
+    }
+    
+    /**
+     * This is the generic method to add an element to the manifest: nothing 
+     * is tested here.
+     * 
+     * @param pRelativePath the path of the file relative to the package
+     * @param pType the type of the file to write in the manifest
+     */
+    private void addEntry( String pRelativePath, FileType pType ) {
+        mEntries.put( pRelativePath, pType );
+    }
+    
+    /**
+     * Output the manifest.xml file
+     * 
+     * @param pOut where to write the manifest.
+     * @throws IOException if something happened when writing to the output stream
+     */
+    public void write( OutputStream pOut ) throws IOException {
+        Iterator<Entry<String, FileType> > iter = mEntries.entrySet().iterator();
+        String entryPattern = "<manifest:file-entry manifest:full-path=\"{0}\" manifest:media-type=\"{1}\"/>\n"; //$NON-NLS-1$
+        pOut.write( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".getBytes() ); //$NON-NLS-1$
+        pOut.write( "<manifest:manifest>\n".getBytes() ); //$NON-NLS-1$
+        while ( iter.hasNext() ) {
+            Entry<String, FileType> entry = iter.next();
+            pOut.write( MessageFormat.format( entryPattern, entry.getKey(), entry.getValue().toString() ).getBytes() );
+        }
+        pOut.write( "</manifest:manifest>\n".getBytes() ); //$NON-NLS-1$
+        pOut.flush();
+    }
+}
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 4bb1c2a..0923ed1 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
@@ -45,25 +45,24 @@ package org.openoffice.ide.eclipse.core.model.pack;
 
 import java.io.File;
 import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
-import java.util.Vector;
 import java.util.zip.ZipOutputStream;
 
+import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.CoreException;
 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;
 
 /**
@@ -78,17 +77,18 @@ import org.openoffice.ide.eclipse.core.utils.ZipContent;
  */
 public class UnoPackage {
 
+    public static final String MANIFEST_PATH = "manifest.xml"; //$NON-NLS-1$
+    
     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 IProject mPrj;
     private File mDestination;
-    private File mOrigin;
     private boolean mBuilding = false;
     
     private HashMap<String, ZipContent> mZipEntries = new HashMap<String, ZipContent>();
-    private HashMap<String, String> mManifestEntries = new HashMap<String, String>();
-    private Vector<File> mTemporaryFiles = new Vector<File>();
+    private ManifestModel mManifest = new ManifestModel();
     
     /**
      * Create a new package object. 
@@ -106,7 +106,7 @@ public class UnoPackage {
      * @param pOut the file of the package.
      * @param pDir the root directory of the package content. 
      */
-    public UnoPackage(File pOut, File pDir) {
+    public UnoPackage( File pOut, IProject pPrj ) {
         if (! (pOut.getName().endsWith(ZIP) || pOut.getName().endsWith(UNOPKG) || 
                 pOut.getName().endsWith(OXT)) ) {
             int pos = pOut.getName().lastIndexOf("."); //$NON-NLS-1$
@@ -119,7 +119,7 @@ public class UnoPackage {
         }
         
         mDestination = pOut;
-        mOrigin = pDir;
+        mPrj = pPrj;
     }
     
     /**
@@ -128,10 +128,8 @@ public class UnoPackage {
      */
     public void dispose() {
         mDestination = null;
-        mOrigin = null;
-        mManifestEntries.clear();
+        mManifest.dispose();
         mZipEntries.clear();
-        mTemporaryFiles.clear();
     }
     
     /**
@@ -142,22 +140,28 @@ public class UnoPackage {
      * 
      * @param pContent the file or folder to add
      */
-    public void addContent(File pContent) {
-        if (pContent.isFile()) {
+    public void addContent(IResource pContent) {
+        if ( pContent instanceof IFile ) {
+            IFile file = (IFile)pContent;
             if (pContent.getName().endsWith(".xcs")) { //$NON-NLS-1$
-                addConfigurationSchemaFile(pContent);
+                addConfigurationSchemaFile( file );
             } else if (pContent.getName().endsWith(".xcu")) { //$NON-NLS-1$
-                addConfigurationDataFile(pContent);
+                addConfigurationDataFile( file );
             } else if (pContent.getName().endsWith(".rdb")) { //$NON-NLS-1$
-                addTypelibraryFile(pContent, "RDB"); //$NON-NLS-1$
+                addTypelibraryFile( file , "RDB"); //$NON-NLS-1$
             } else {
-                addOtherFile(pContent);
+                addOtherFile( file );
             }
-        } else {
+        } else if ( pContent instanceof IContainer ) {
             // Recurse on the directory
-            File[] children = pContent.listFiles();
-            for (File child : children) {
-                addContent(child);
+            IContainer container = (IContainer) pContent;
+            IResource[] children;
+            try {
+                children = container.members();
+                for (IResource child : children) {
+                    addContent( child );
+                }
+            } catch (CoreException e) {
             }
         }
     }
@@ -171,9 +175,9 @@ public class UnoPackage {
      * @param pFile the file to add to the package
      * @param pType the type of the file to add.
      * 
-     * @see #addComponentFile(File, String, String) for platform support
+     * @see #addComponentFile(IFile, String, String) for platform support
      */
-    public void addComponentFile(File pFile, String pType) {
+    public void addComponentFile(IFile pFile, String pType) {
         addComponentFile(pFile, pType, null);
     }
     
@@ -189,22 +193,15 @@ public class UnoPackage {
      * @param pPlatform optional parameter to use only with native type. Please
      *         refer to the OOo Developer's Guide for more information.
      */
-    public void addComponentFile(File pFile, String pType, String pPlatform) {
+    public void addComponentFile(IFile pFile, String pType, String pPlatform) {
         // Do not change the extension from now
         initializeOutput();
     
-        String mediaType = "application/vnd.sun.star.uno-component;type=" + pType; //$NON-NLS-1$
-        if (pPlatform != null && pType.equals("native")) { //$NON-NLS-1$
-            mediaType += ";platform=" + pPlatform; //$NON-NLS-1$
-        }
-        
-        String relPath = getOriginRelativePath(pFile);
-        
         // create the manifest entry
-        addManifestEntry(relPath, mediaType);
+        mManifest.addComponentFile( pFile, pType, pPlatform );
         
         // create the ZipContent
-        addZipContent(relPath, pFile);
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -216,18 +213,15 @@ public class UnoPackage {
      * @param pFile the file to add 
      * @param pType the type of the file as specified in the OOo Developer's Guide
      */
-    public void addTypelibraryFile(File pFile, String pType) {
+    public void addTypelibraryFile(IFile pFile, String pType) {
         // Do not change the extension from now
         initializeOutput();
         
-        String mediaType = "application/vnd.sun.star.uno-typelibrary;type=" + pType; //$NON-NLS-1$
-        String relPath = getOriginRelativePath(pFile);
-        
         // create the manifest entry
-        addManifestEntry(relPath, mediaType);
+        mManifest.addTypelibraryFile( pFile, pType );
         
         // create the ZipContent
-        addZipContent(relPath, pFile);
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -237,18 +231,12 @@ public class UnoPackage {
      * 
      * @param pDir the directory of the basic library.
      */
-    public void addBasicLibraryFile(File pDir) {
-        if (pDir.isDirectory()) {
-            // Do not change the extension from now
-            initializeOutput();
+    public void addBasicLibraryFile(IFolder pDir) {
+        // Do not change the extension from now
+        initializeOutput();
 
-            String mediaType = "application/vnd.sun.star.basic-library"; //$NON-NLS-1$
-            String relPath = getOriginRelativePath(pDir);
-            
-            addManifestEntry(relPath, mediaType);
-            
-            addZipContent(relPath, pDir);
-        }
+        mManifest.addBasicLibrary( pDir );
+        addZipContent( pDir.getProjectRelativePath().toString(), pDir );
     }
     
     /**
@@ -258,18 +246,12 @@ public class UnoPackage {
      * 
      * @param pDir the directory of the dialog library.
      */
-    public void addDialogLibraryFile(File pDir) {
-        if (pDir.isDirectory()) {
-            // Do not change the extension from now
-            initializeOutput();
+    public void addDialogLibraryFile(IFolder pDir) {
+        // Do not change the extension from now
+        initializeOutput();
 
-            String mediaType = "application/vnd.sun.star.dialog-library"; //$NON-NLS-1$
-            String relPath = getOriginRelativePath(pDir);
-            
-            addManifestEntry(relPath, mediaType);
-            
-            addZipContent(relPath, pDir);
-        }
+        mManifest.addDialogLibrary( pDir );
+        addZipContent( pDir.getProjectRelativePath().toString(), pDir );
     }
     
     /**
@@ -277,18 +259,12 @@ public class UnoPackage {
      * 
      * @param pFile the xcu file to add
      */
-    public void addConfigurationDataFile(File pFile) {
-        if (pFile.isFile() && pFile.getName().endsWith("xcu")) { //$NON-NLS-1$
-            // Do not change the extension from now
-            initializeOutput();
-            
-            String mediaType = "application/vnd.sun.star.configuration-data"; //$NON-NLS-1$
-            String relPath = getOriginRelativePath(pFile);
-            
-            addManifestEntry(relPath, mediaType);
-            
-            addZipContent(relPath, pFile);
-        }
+    public void addConfigurationDataFile(IFile pFile) {
+        // Do not change the extension from now
+        initializeOutput();
+
+        mManifest.addConfigurationDataFile( pFile );
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -296,18 +272,12 @@ public class UnoPackage {
      * 
      * @param pFile the xcs file to add
      */
-    public void addConfigurationSchemaFile(File pFile) {
-        if (pFile.isFile() && pFile.getName().endsWith("xcs")) { //$NON-NLS-1$
-            // Do not change the extension from now
-            initializeOutput();
-            
-            String mediaType = "application/vnd.sun.star.configuration-schema"; //$NON-NLS-1$
-            String relPath = getOriginRelativePath(pFile);
-            
-            addManifestEntry(relPath, mediaType);
-            
-            addZipContent(relPath, pFile);
-        }
+    public void addConfigurationSchemaFile(IFile pFile) {
+        // Do not change the extension from now
+        initializeOutput();
+
+        mManifest.addConfigurationSchemaFile( pFile );
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -316,29 +286,9 @@ public class UnoPackage {
      * @param pDescriptionFile the file containing the description for that locale
      * @param pLocale the locale of the description. Can be <code>null</code>.
      */
-    public void addPackageDescription(File pDescriptionFile, Locale pLocale) {
-        try {
-            // write the description to a file
-            String localeString = ""; //$NON-NLS-1$
-            if (pLocale != null) {
-                localeString = pLocale.toString();
-                localeString = localeString.replace("_", "-"); //$NON-NLS-1$ //$NON-NLS-2$
-            }
-
-            // Add the file entry to the manifest
-            String mediaType = "application/vnd.sun.star.package-bundle-description"; //$NON-NLS-1$
-            if (!localeString.equals("")) { //$NON-NLS-1$
-                mediaType += ";locale=" + localeString; //$NON-NLS-1$
-            }
-            String relPath = getOriginRelativePath(pDescriptionFile);
-            
-            addManifestEntry(relPath, mediaType);
-
-            // Add the file to the zip entries
-            addZipContent(relPath, pDescriptionFile);
-        } catch (Exception e) {
-            // Can't add the description file to the package
-        }
+    public void addPackageDescription(IFile pFile, Locale pLocale) {
+        mManifest.addDescription( pFile, pLocale );
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -349,12 +299,11 @@ public class UnoPackage {
      * 
      * @param pFile the file or directory to add.
      */
-    public void addOtherFile(File pFile) {
+    public void addOtherFile(IFile pFile) {
         // Do not change the extension from now 
         initializeOutput();
         
-        String relPath = getOriginRelativePath(pFile);
-        addZipContent(relPath, pFile);
+        addZipContent( pFile.getProjectRelativePath().toString(), pFile );
     }
     
     /**
@@ -368,27 +317,15 @@ public class UnoPackage {
         
         if (mBuilding) {
             try {
-                // Write the manifest
-                File metainfDir = new File(mOrigin, "META-INF"); //$NON-NLS-1$
-                if (!metainfDir.exists()) {
-                    metainfDir.mkdir();
-                }
-                File manifestFile = new File(metainfDir, "manifest.xml"); //$NON-NLS-1$
-
-                FileWriter writer = new FileWriter(manifestFile);
-                writer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); //$NON-NLS-1$
-                writer.append("<manifest:manifest>\n"); //$NON-NLS-1$
-                
-                // Add the manifest entries
-                Iterator<String> manifestIter = mManifestEntries.values().iterator();
-                while (manifestIter.hasNext()) {
-                    String entry = manifestIter.next();
-                    writer.append("\t" + entry + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+                // Write the manifest if it doesn't exist
+                IFile manifestFile = mPrj.getFile( MANIFEST_PATH );
+                if ( !manifestFile.exists() ) {
+                    FileOutputStream writer = new FileOutputStream( manifestFile.getLocation().toFile() );
+                    mManifest.write( writer );
+                    writer.close();
+                    manifestFile.refreshLocal( IResource.DEPTH_ZERO, null );
                 }
                 
-                writer.append("</manifest:manifest>\n"); //$NON-NLS-1$
-                writer.close();
-                
                 // Write the ZipContent
                 FileOutputStream out = new FileOutputStream(mDestination);
                 ZipOutputStream zipOut = new ZipOutputStream(out);
@@ -411,11 +348,6 @@ public class UnoPackage {
                 PluginLogger.error(Messages.getString("UnoPackage.PackageCreationError"), e); //$NON-NLS-1$
             }
             
-            // remove the temporary files
-            for (File file : mTemporaryFiles) {
-                FileHelper.remove(file);
-            }
-            
             result = mDestination;
     
             dispose();
@@ -427,10 +359,10 @@ public class UnoPackage {
      * @return a list of the files that are already queued for addition 
      *         to the package.
      */
-    public List<File> getContainedFiles() {
-        ArrayList<File> files = new ArrayList<File>(mZipEntries.size());
+    public List<IResource> getContainedFiles() {
+        ArrayList<IResource> files = new ArrayList<IResource>(mZipEntries.size());
         for (ZipContent content : mZipEntries.values()) {
-            files.add(content.getFile());
+            files.add( content.getFile() );
         }
         return files;
     }
@@ -451,17 +383,14 @@ public class UnoPackage {
             
             File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
             
-            IPath prjPath = prj.getProjectPath();
-            File dir = new File(prjPath.toOSString());
             File dest = new File(outputDir, prj.getName() + ".zip"); //$NON-NLS-1$
-            UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(prj, dest, dir);
+            UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(prj, dest);
             
-            List<File> files = unoPackage.getContainedFiles();
-            String path = pRes.getLocation().toString();
+            List<IResource> files = unoPackage.getContainedFiles();
             int i = 0;
             while (i < files.size() && !contained) {
-                File file = files.get(i);
-                if (file.getPath().equals(path)) {
+                IResource res = files.get(i);
+                if ( res.getLocation().equals( pRes.getLocation() ) ) {
                     contained = true;
                 }
                 i++;
@@ -488,23 +417,10 @@ public class UnoPackage {
             
             File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
             
-            IPath prjPath = unoprj.getProjectPath();
-            File dir = new File(prjPath.toOSString());
             File dest = new File(outputDir, pPrj.getName() + ".zip"); //$NON-NLS-1$
-            UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(unoprj, dest, dir);
+            UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(unoprj, dest);
             
-            List<File> files = unoPackage.getContainedFiles();
-            
-            // Convert the Files into IResources
-            for (File file : files) {
-                String relPath = unoPackage.getOriginRelativePath(file);
-                IFile iFile = pPrj.getFile(relPath);
-                if (iFile.exists()) {
-                    resources.add(iFile);
-                } else if (pPrj.getFolder(relPath).exists()) {
-                    resources.add(pPrj.getFolder(relPath));
-                }
-            }
+            resources.addAll( unoPackage.getContainedFiles() );
             
             unoPackage.dispose();
         }
@@ -524,38 +440,21 @@ public class UnoPackage {
     }
     
     /**
-     * Computes the manifest entry and add it to the Manifest entries table.
-     * 
-     * @param pRelativePath the destination relative path of the file
-     * @param pMediaType the media type of the file, as specified in the OOo
-     *         developer's guide
-     */
-    private void addManifestEntry(String pRelativePath, String pMediaType) {
-        if (pRelativePath != null) {
-            String entry = "<manifest:file-entry"; //$NON-NLS-1$
-            entry += " manifest:full-path=\"" + pRelativePath + "\""; //$NON-NLS-1$ //$NON-NLS-2$
-            entry += " manifest:media-type=\"" + pMediaType + "\""; //$NON-NLS-1$ //$NON-NLS-2$
-            entry += "/>"; //$NON-NLS-1$
-
-            mManifestEntries.put(pRelativePath, entry);
-        }
-    }
-    
-    /**
      * Recursively add the file or directory to the Zip entries.
      * 
      * @param pRelativePath the relative path of the file to add
      * @param pFile the file or directory to add
      */
-    private void addZipContent(String pRelativePath, File pFile) {
+    private void addZipContent(String pRelativePath, IResource pFile) {
         if (pRelativePath != null) {
-            if (pFile.isDirectory()) {
+            if ( pFile instanceof IContainer ) {
                 // Add all the children
-                String[] children = pFile.list();
-                for (String child : children) {
-                    if (!child.equals(".") && !child.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
-                        addZipContent(pRelativePath + "/" + child, new File(pFile, child)); //$NON-NLS-1$
+                try {
+                    IResource[] children = ((IContainer)pFile).members();
+                    for (IResource child : children) {
+                        addZipContent( pRelativePath + "/" + child.getName(), child ); //$NON-NLS-1$
                     }
+                } catch ( Exception e ) {
                 }
             } else {
                 ZipContent content = new ZipContent(pRelativePath, pFile);
@@ -563,25 +462,4 @@ public class UnoPackage {
             }
         }
     }
-    
-    /**
-     * Returns the path of the file relatively to the origin directory. If the
-     * file is not contained in the origin directory, null is returned.
-     * 
-     * @param pFile the file of which to get the relative path
-     * @return the relative path using "/" separators or <code>null</code> if
-     *         the file isn't contained in the origin directory.
-     */
-    private String getOriginRelativePath(File pFile) {
-        String path = pFile.getAbsolutePath();
-        String originPath = mOrigin.getAbsolutePath();
-        
-        String relativePath = null;
-        
-        if (path.startsWith(originPath)) {
-            relativePath = path.substring(originPath.length() + 1);
-            relativePath = relativePath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        return relativePath;
-    }
 }
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java b/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java
index 7439281..bb9cb75 100644
--- a/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java
+++ b/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java
@@ -44,12 +44,12 @@
 package org.openoffice.ide.eclipse.core.utils;
 
 import java.io.BufferedInputStream;
-import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
+import org.eclipse.core.resources.IResource;
 import org.openoffice.ide.eclipse.core.PluginLogger;
 
 /**
@@ -62,7 +62,7 @@ public class ZipContent {
 
     private static final int BUFFER_SIZE = 2048;
 
-    protected File mFile;
+    protected IResource mResource;
     
     protected String mEntryName;
     
@@ -70,18 +70,18 @@ public class ZipContent {
      * Constructor.
      * 
      * @param pEntryName the name in the ZIP file
-     * @param pFile the file to put in the ZIP file.
+     * @param pResource the file to put in the ZIP file.
      */
-    public ZipContent(String pEntryName, File pFile) {
-        mFile = pFile;
+    public ZipContent( String pEntryName, IResource pResource ) {
+        mResource = pResource;
         mEntryName = pEntryName;
     }
     
     /**
      * @return the file represented by the {@link ZipEntry}
      */
-    public File getFile() {
-        return mFile;
+    public IResource getFile() {
+        return mResource;
     }
     
     /**
@@ -93,7 +93,7 @@ public class ZipContent {
         
         BufferedInputStream origin = null;
         try {
-            FileInputStream fi = new FileInputStream(mFile);
+            FileInputStream fi = new FileInputStream( mResource.getLocation().toFile() );
             origin = new BufferedInputStream(fi, BUFFER_SIZE);
 
             ZipEntry entry = new ZipEntry(mEntryName);
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/NewUnoFileWizard.java b/core/source/org/openoffice/ide/eclipse/core/wizards/NewUnoFileWizard.java
deleted file mode 100644
index 991ba0d..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/NewUnoFileWizard.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: NewUnoFileWizard.java,v $
- *
- * $Revision: 1.5 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2007/11/25 20:32:29 $
- *
- * 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;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.openoffice.ide.eclipse.core.wizards.pages.NewUnoFilePage;
-
-/**
- * Wizard for the creation of UNO-IDL file.
- * 
- * @author cedricbosdo
- *
- */
-public class NewUnoFileWizard extends Wizard implements INewWizard {
-
-    private NewUnoFilePage mPage;
-    
-    private IWorkbench mWorkbench;
-    
-    /**
-     * Default constructor.
-     */
-    public NewUnoFileWizard() {
-        super();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean performFinish() {
-        
-        IPath parentPath = mPage.getContainerFullPath();
-        IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(parentPath);
-        
-        return NewUnoFilePage.createUnoidlFile(folder, mPage.getFileName(), mWorkbench);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public void init(IWorkbench pWorkbench, IStructuredSelection pSelection) {
-        
-        mWorkbench = pWorkbench;
-        mPage = new NewUnoFilePage("configuration", pSelection); //$NON-NLS-1$
-
-        addPage(mPage);
-    }
-}
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 702a329..c64e3c3 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
@@ -53,7 +53,6 @@ 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.CoreException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -174,21 +173,14 @@ public class PackageExportWizard extends Wizard implements IExportWizard {
                 IPath libraryPath = null;
                 ILanguageBuilder langBuilder = mPrj.getLanguage().getLanguageBuidler();
                 libraryPath = langBuilder.createLibrary(mPrj);
-            
-                // Remove the temporarily created Manifest and keep the library
-                try {
-                    mPrj.getFile("MANIFEST.MF").delete(true, pMonitor); //$NON-NLS-1$
-                } catch (CoreException e) {
-                    // Not important
-                }
-
+                
                 // 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, dir);            
+                UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(mPrj, dest);      
 
                 /*
                  *  Read the package.properties files to add user selected files.
@@ -202,24 +194,24 @@ public class PackageExportWizard extends Wizard implements IExportWizard {
 
                     List<IFolder> basicLibs = pkgModel.getBasicLibraries();
                     for (IFolder lib : basicLibs) {
-                        unoPackage.addBasicLibraryFile(lib.getLocation().toFile());
+                        unoPackage.addBasicLibraryFile(lib);
                     }
 
                     List<IFolder> dialogLibs = pkgModel.getDialogLibraries();
                     for (IFolder lib : dialogLibs) {
-                        unoPackage.addDialogLibraryFile(lib.getLocation().toFile());
+                        unoPackage.addDialogLibraryFile(lib);
                     }
 
                     List<IResource> contents = pkgModel.getContents();
                     for (IResource res : contents) {
-                        unoPackage.addContent(res.getLocation().toFile());
+                        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().getLocation().toFile(), 
+                        unoPackage.addPackageDescription(entry.getValue(), 
                                 entry.getKey());
                     }
                 }
@@ -246,6 +238,11 @@ public class PackageExportWizard extends Wizard implements IExportWizard {
                 
             } 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;
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 d281cea..741f0b2 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/messages.properties
@@ -15,8 +15,6 @@ NewInterfaceWizardPage.Title=Interface creation page
 NewInterfaceWizardPage.Label=Interface name
 NewUnoProjectWizard.JobName=Uno Project creation job
 NewUnoProjectPage.Title=New UNO-IDL project configuration
-NewUnoFilePage.Title=New UNO-IDL file configuration
-NewUnoFilePage.Message=Create a new UNO-IDL file with the basic content of the file
 NewUreAppWizard.Title=New URE Application wizard
 NewUnoProjectPage.Message=This wizard will create the basis of a UNO component project
 NewUnoProjectPage.RootPackage=Root package
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/NewUnoFilePage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/NewUnoFilePage.java
deleted file mode 100644
index 5f8b94a..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/NewUnoFilePage.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: NewUnoFilePage.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 org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.part.FileEditorInput;
-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.model.UnoidlProject;
-import org.openoffice.ide.eclipse.core.model.IUnoComposite;
-import org.openoffice.ide.eclipse.core.model.CompositeFactory;
-import org.openoffice.ide.eclipse.core.wizards.Messages;
-
-/**
- * Simple Uno file creation page, this wizard will be removed when all
- * the UNO types will have their own wizard. 
- * 
- * @author cedricbosdo
- *
- */
-public class NewUnoFilePage extends WizardNewFileCreationPage {
-    
-    /**
-     * Constructor.
-     * 
-     * @param pPageName the page name
-     * @param pSelection the selection where to create the IDL file
-     */
-    public NewUnoFilePage(String pPageName, IStructuredSelection pSelection) {
-        super(pPageName, pSelection);
-        
-        setTitle(Messages.getString("NewUnoFilePage.Title")); //$NON-NLS-1$
-        setDescription(Messages.getString("NewUnoFilePage.Message")); //$NON-NLS-1$
-        setImageDescriptor(OOEclipsePlugin.getImageDescriptor(ImagesConstants.NEWFILE_WIZ));
-        
-    }
-    
-    /**
-         * {@inheritDoc}
-         */
-    public boolean canFlipToNextPage() {
-        boolean result = false;
-        
-        try {
-            IPath parentPath = getContainerFullPath();
-            IFolder folder = ResourcesPlugin.getWorkspace().getRoot().getFolder(parentPath);
-            
-            result = isCreatable(folder, getFileName());
-        } catch (Exception e) {
-            result = false;
-        }
-            
-        return result;
-    }
-    
-    //--------------- Wolrdwide available unoidl file creation methods
-    
-    /**
-     * Method which writes the basic content of the file, ie: the includes and defines.
-     * 
-     * @param pFile created file where to write this content
-     */
-    private static void createFileContent(IFile pFile) {
-        
-        try {
-            UnoidlProject unoProject = (UnoidlProject)pFile.getProject().
-                    getNature(OOEclipsePlugin.UNO_NATURE_ID);
-            
-            IUnoComposite composite = CompositeFactory.createFile(pFile);
-            composite.create(true);
-            composite.dispose();
-            
-            unoProject.getProject().refreshLocal(IProject.DEPTH_INFINITE, null);
-            
-        } catch (Exception e) {
-            PluginLogger.error(
-                Messages.getString("NewUnoFilePage.UnoProjectError"), e); //$NON-NLS-1$
-        }
-    }
-    
-    /**
-     * This method help creating a new unoidl file with it's basic content. The
-     * unoidl file can be created only if it's parent is unoidl capable and if the
-     * file name ends with <code>.idl</code>. 
-     * 
-     * @param pFolder parent folder where to put the unoidl file
-     * @param pFilename name of the file to create
-     * @return <code>true</code> if the creation succeeded, <code>false</code>
-     *         otherwise.
-     */
-    public static boolean createUnoidlFile(IFolder pFolder, String pFilename) {
-        return createUnoidlFile(pFolder, pFilename, null);
-    }
-    
-    
-    /**
-     * This method help creating a new unoidl file with it's basic content. The
-     * unoidl file can be created only if it's parent is unoidl capable and if the
-     * file name ends with <code>.idl</code>. After the file creation, the file is
-     * edited with the unoidl file editor
-     * 
-     * @param pFolder parent folder where to put the unoidl file
-     * @param pFilename name of the file to create
-     * @param pWorkbench worbench where to launch the editor
-     * @return <code>true</code> if the creation succeeded, <code>false</code>
-     *         otherwise.
-     */
-    public static boolean createUnoidlFile(IFolder pFolder, String pFilename, IWorkbench pWorkbench) {
-        boolean performed = false;
-        
-        if (null != pFolder) {
-            try {
-                String idlfolder = pFolder.getPersistentProperty(new QualifiedName(
-                        OOEclipsePlugin.OOECLIPSE_PLUGIN_ID, UnoidlProject.IDL_FOLDER));
-                
-                if (null != idlfolder && idlfolder.equals("true")) { //$NON-NLS-1$
-                    
-                    if (null != pFilename && pFilename.endsWith(".idl")) { //$NON-NLS-1$
-                        IFile file = pFolder.getFile(pFilename);
-                        createFileContent(file);
-                        
-                        IFileEditorInput editorInput = new FileEditorInput(file);
-                        
-                        // Show the created file in the unoidl editor
-                        pWorkbench.getActiveWorkbenchWindow().getActivePage().
-                                openEditor(editorInput, OOEclipsePlugin.UNO_EDITOR_ID);
-                        
-                        performed = true;
-                    } else {
-                        PluginLogger.error(
-                            Messages.getString("NewUnoFilePage.WrongExtensionError"), null);  //$NON-NLS-1$
-                    }
-                } else {
-                    PluginLogger.error(
-                            Messages.getString("NewUnoFilePage.NoIdlFolderError"), null); //$NON-NLS-1$
-                }
-                
-            } catch (CoreException e) {
-                PluginLogger.error(
-                        Messages.getString("NewUnoFilePage.NoIdlFolderError"), e); //$NON-NLS-1$
-            } catch (NullPointerException e) {
-                PluginLogger.debug("Can't open the IDL file: " + pFilename, e); //$NON-NLS-1$
-            }
-        }
-        return performed;
-    }
-
-    /**
-     * This method checks if the parent folder is unoidl capable and if the filename
-     * ends with <code>.idl</code>. A Unoidl capable folder is a folder that possesses
-     * a persistent property IDL_FOLDER set to <code>true</code>
-     * 
-     * @param pFolder parent folder of the file
-     * @param pFilename file of the file to create
-     * @return <code>true</code> if the file can be created, <code>false</code> otherwise
-     */
-    private boolean isCreatable(IFolder pFolder, String pFilename) {
-        boolean creatable = false;
-        
-        if (null != pFolder) {
-            try {
-                String idlfolder = pFolder.getPersistentProperty(new QualifiedName(
-                        OOEclipsePlugin.OOECLIPSE_PLUGIN_ID, UnoidlProject.IDL_FOLDER));
-                
-                if (null != idlfolder && idlfolder.equals("true")) { //$NON-NLS-1$
-                    
-                    if (null != pFilename && pFilename.endsWith(".idl")) { //$NON-NLS-1$
-                        
-                        creatable = true;
-                    } else {
-                        setErrorMessage(Messages.getString("NewUnoFilePage.WrongExtensionError")); //$NON-NLS-1$
-                    }
-                } else {
-                    setErrorMessage(Messages.getString("NewUnoFilePage.NoIdlFolderError")); //$NON-NLS-1$
-                }
-                
-            } catch (CoreException e) {
-                setErrorMessage(Messages.getString("NewUnoFilePage.NoIdlFolderError")); //$NON-NLS-1$
-            }
-        }
-        
-        return creatable;
-    }
-}
\ No newline at end of file
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
index 8f4287e..74653cf 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
@@ -44,20 +44,19 @@
 package org.openoffice.ide.eclipse.java;
 
 import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.LineNumberReader;
-import java.io.StringReader;
-import java.util.Vector;
-import java.util.jar.JarOutputStream;
+import java.util.ArrayList;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
 import org.eclipse.jdt.core.IClasspathEntry;
 import org.eclipse.jdt.core.IJavaProject;
@@ -65,6 +64,8 @@ import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.jdt.launching.IVMInstall;
 import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jdt.ui.jarpackager.IJarExportRunnable;
+import org.eclipse.jdt.ui.jarpackager.JarPackageData;
 import org.openoffice.ide.eclipse.core.LogLevels;
 import org.openoffice.ide.eclipse.core.PluginLogger;
 import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
@@ -73,8 +74,8 @@ import org.openoffice.ide.eclipse.core.model.config.IOOo;
 import org.openoffice.ide.eclipse.core.model.config.ISdk;
 import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
 import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
-import org.openoffice.ide.eclipse.core.utils.ZipContent;
-import org.openoffice.ide.eclipse.java.utils.ZipContentHelper;
+import org.openoffice.ide.eclipse.java.build.FilesVisitor;
+import org.openoffice.ide.eclipse.java.build.UnoManifestProvider;
 
 /**
  * The language builder implementation for Java.
@@ -100,79 +101,36 @@ public class JavaBuilder implements ILanguageBuilder {
      */
     public IPath createLibrary(IUnoidlProject pUnoProject) throws Exception {
 
-        // Create the manifest file
-        String classpath = ""; //$NON-NLS-1$
-        IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pUnoProject.getName());
-        Vector<File> libs = getLibs(JavaCore.create(prj));
-        String prjPath = prj.getLocation().toOSString();
-        for (File lib : libs) {
-            String relPath = lib.getPath().substring(prjPath.length() + 1);
-            classpath += relPath + " "; //$NON-NLS-1$
-        }
-        if (!classpath.equals("")) { //$NON-NLS-1$
-            classpath = "Class-Path: " + classpath + "\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
-        }
-        
-        String classname = ((JavaProjectHandler)mLanguage.getProjectHandler()).
-            getRegistrationClassName(pUnoProject);
-        String content = "ManifestVersion: 1.0\r\n" +  //$NON-NLS-1$
-                         "RegistrationClassName: " + classname + "\r\n" + //$NON-NLS-1$ //$NON-NLS-2$
-                         classpath;
-        
-        
-        File manifestFile = new File(pUnoProject.getFile("MANIFEST.MF"). //$NON-NLS-1$
-                getLocation().toOSString());
-        StringReader reader = new StringReader(content);
-        FileWriter writer = new FileWriter(manifestFile);
-        try {
-            int c = reader.read();
-
-            while (c != -1) {
-                writer.write(c);
-                c = reader.read();
-            }
-        } finally {
-            try {
-                writer.close();
-                reader.close();
-            } catch (IOException e) { e.printStackTrace(); }
-        }
-        
-        
-        // Create projectname.jar
-        File jarFile = ((JavaProjectHandler)mLanguage.getProjectHandler()).
-                getJarFile(pUnoProject);
-        FileOutputStream out = new FileOutputStream(jarFile);
-        JarOutputStream jarOut = new JarOutputStream(out);
+        IFile jarFile = ((JavaProjectHandler)mLanguage.getProjectHandler()).getJarFile(pUnoProject);
         
-        // Add the manifest
-        ZipContent manifest = new ZipContent("META-INF/MANIFEST.MF", manifestFile); //$NON-NLS-1$
-        manifest.writeContentToZip(jarOut);
+        JarPackageData description = new JarPackageData();
+        description.setGenerateManifest( true );
+        description.setJarLocation( jarFile.getLocation() );
         
-        // Get all the files to write
-        File bin = new File(pUnoProject.getFolder("bin"). //$NON-NLS-1$
-                getLocation().toOSString());
-        // JDT dependent
-        ZipContent[] binContent = ZipContentHelper.getFiles(bin);
+        String regClassname = ((JavaProjectHandler)mLanguage.getProjectHandler()).
+        getRegistrationClassName(pUnoProject);
+        description.setManifestProvider( new UnoManifestProvider( regClassname ) );
+        description.setManifestLocation( pUnoProject.getFile( "MANIFEST.MF" ).getFullPath() ); //$NON-NLS-1$
+        description.setSaveManifest( true );
+        description.setReuseManifest( true );
+        description.setExportOutputFolders( true );
+        description.setExportClassFiles( true );
+        description.setExportWarnings( true );
+        description.setOverwrite( true );
         
-        File build = new File(pUnoProject.getFolder(pUnoProject.getBuildPath()).
-                getLocation().toOSString());
-        ZipContent[] javamakerContent = ZipContentHelper.getFiles(build);
+        // Get the files to export: javamaker output + project classes
+        FilesVisitor visitor = new FilesVisitor( );
+        visitor.addException( pUnoProject.getFolder( pUnoProject.getUrdPath( ) ) );
         
-        // write the content of the bin directory to the Jar
-        for (int i = 0; i < binContent.length; i++) {
-            binContent[i].writeContentToZip(jarOut);
-        }
-        
-        for (int i = 0; i < javamakerContent.length; i++) {
-            javamakerContent[i].writeContentToZip(jarOut);
-        }
+        IFolder buildDir = pUnoProject.getFolder( pUnoProject.getBuildPath() );
+        buildDir.accept( visitor );
+        description.setElements( visitor.getFiles() );
         
-        // Close all the streams
-        jarOut.close();
-        out.close();
+        // Create the Jar file
+        IJarExportRunnable runnable = description.createJarExportRunnable( null );
+        runnable.run( new NullProgressMonitor() );
         
-        return new Path(jarFile.getAbsolutePath());
+        return jarFile.getLocation();
     }
 
 
@@ -303,8 +261,8 @@ public class JavaBuilder implements ILanguageBuilder {
         // Add all the jar dependencies
         IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pUnoPrj.getName());
         IJavaProject javaPrj = JavaCore.create(prj);
-        Vector<File> libs = getLibs(javaPrj);
-        for (File lib : libs) {
+        ArrayList<IFile> libs = getLibs(javaPrj);
+        for (IFile lib : libs) {
             pUnoPackage.addTypelibraryFile(lib, "Java"); //$NON-NLS-1$
         }
     }
@@ -316,10 +274,8 @@ public class JavaBuilder implements ILanguageBuilder {
      * @param pJavaPrj the project from which to extract the libraries
      * @return a list of all the File pointing to the libraries.
      */
-    private Vector<File> getLibs(IJavaProject pJavaPrj) {
-        Vector<File> libs = new Vector<File>();
-        IPath prjPath = pJavaPrj.getProject().getLocation();
-        
+    private ArrayList<IFile> getLibs(IJavaProject pJavaPrj) {
+        ArrayList<IFile> libs = new ArrayList<IFile>();
         try {
             IClasspathEntry[] entries = pJavaPrj.getResolvedClasspath(true);
             for (IClasspathEntry entry : entries) {
@@ -333,9 +289,9 @@ public class JavaBuilder implements ILanguageBuilder {
                     if (!new File(path.toOSString()).exists() && path.isAbsolute() &&
                             path.toString().startsWith("/" + pJavaPrj.getProject().getName())) { //$NON-NLS-1$
                         // Relative to the project
-                        File libFile = prjPath.append(path.removeFirstSegments(1)).toFile();
-                        if (libFile.isFile()) {
-                            libs.add(libFile);
+                        IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile( path );
+                        if ( file != null ) {
+                            libs.add( file );
                         }
                     }
                 }
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java b/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
index fdcf6a9..3c8c710 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
@@ -46,6 +46,7 @@ package org.openoffice.ide.eclipse.java;
 import java.io.File;
 import java.util.Vector;
 
+import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.ResourcesPlugin;
@@ -235,7 +236,7 @@ public class JavaProjectHandler implements IProjectHandler {
      * {@inheritDoc}
      */
     public String getLibraryPath(IUnoidlProject pProject) {
-        return getJarFile(pProject).getAbsolutePath();
+        return getJarFile(pProject).getLocation().toOSString();
     }
     
     /**
@@ -245,9 +246,9 @@ public class JavaProjectHandler implements IProjectHandler {
      * @param pProject the concerned UNO project
      * @return a handle to the jar file of the project
      */
-    public File getJarFile(IUnoidlProject pProject) {
+    public IFile getJarFile(IUnoidlProject pProject) {
         String filename = pProject.getName().replace(" ", "") + ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-        return pProject.getFile(filename).getLocation().toFile();
+        return pProject.getFile(filename);
     }
     
     /**
diff --git a/java/source/org/openoffice/ide/eclipse/java/build/FilesVisitor.java b/java/source/org/openoffice/ide/eclipse/java/build/FilesVisitor.java
new file mode 100644
index 0000000..605ae92
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/build/FilesVisitor.java
@@ -0,0 +1,39 @@
+package org.openoffice.ide.eclipse.java.build;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+
+public class FilesVisitor implements IResourceVisitor {
+
+    ArrayList<IFile> mFiles = new ArrayList<IFile>();
+    ArrayList<IResource> mExceptions = new ArrayList<IResource>();
+    
+    public void addException( IResource pRes ) {
+        mExceptions.add( pRes );
+    }
+    
+    public boolean visit(IResource pResource) throws CoreException {
+        
+        if ( pResource.getType() == IResource.FILE ) {
+            mFiles.add( ( IFile )pResource );
+        }
+        
+        boolean visitChildren = true;
+        
+        int i = 0;
+        while ( visitChildren && i < mExceptions.size() ) {
+            visitChildren = !mExceptions.get( i ).equals( pResource );
+            i++;
+        }
+        
+        return visitChildren;
+    }
+
+    public IFile[] getFiles( ) {
+        return mFiles.toArray( new IFile[ mFiles.size() ] );
+    }
+}
diff --git a/java/source/org/openoffice/ide/eclipse/java/build/UnoManifestProvider.java b/java/source/org/openoffice/ide/eclipse/java/build/UnoManifestProvider.java
new file mode 100644
index 0000000..bdc856f
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/build/UnoManifestProvider.java
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * 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 Novell, Inc.
+ *
+ * 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 Novell, Inc.
+ *
+ * All Rights Reserved.
+ * 
+ ************************************************************************/
+package org.openoffice.ide.eclipse.java.build;
+
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.jar.Attributes.Name;
+
+import org.eclipse.jdt.internal.ui.jarpackager.ManifestProvider;
+import org.eclipse.jdt.ui.jarpackager.JarPackageData;
+
+ at SuppressWarnings("restriction")
+public class UnoManifestProvider extends ManifestProvider {
+
+    private String mRegClass;
+
+    public UnoManifestProvider( String pRegClassname ) {
+        mRegClass = pRegClassname;
+    }
+    
+    @Override
+    protected void putAdditionalEntries(Manifest manifest,
+            JarPackageData jarPackage) {
+        
+        Name name = new Attributes.Name( "RegistrationClassName" ); //$NON-NLS-1$
+        manifest.getMainAttributes().put( name, mRegClass );
+    }
+}
diff --git a/java/source/org/openoffice/ide/eclipse/java/utils/ZipContentHelper.java b/java/source/org/openoffice/ide/eclipse/java/utils/ZipContentHelper.java
deleted file mode 100644
index a4770c6..0000000
--- a/java/source/org/openoffice/ide/eclipse/java/utils/ZipContentHelper.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: ZipContentHelper.java,v $
- *
- * $Revision: 1.2 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2007/11/25 20:32:39 $
- *
- * 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.java.utils;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.Platform;
-import org.openoffice.ide.eclipse.core.PluginLogger;
-import org.openoffice.ide.eclipse.core.utils.ZipContent;
-
-/**
- * This class is a small structure containing the data to zip for one file.
- * 
- * @author cedricbosdo
- *
- */
-public class ZipContentHelper {
-    
-    /**
-     * Get all the ZipContent entries for the given file or directory.
-     * 
-     * @param pFile the file or directory from which to get all the
-     *      contents as {@link ZipContent} objects
-     * 
-     * @return the {@link ZipContent} object for the file or the directory
-     *      and its content.
-     */
-    public static ZipContent[] getFiles(File pFile) {
-        return getInternalFiles(pFile, pFile);
-    }
-    
-    /**
-     * Get all the ZipContent entries for the given file or directory.
-     * 
-     * @param pFile the file or directory from which to get all the
-     *      contents as {@link ZipContent} objects
-     * @param pRootDir the root directory to use to compute the {@link ZipContent}
-     *      relative path.
-     * 
-     * @return the {@link ZipContent} object for the file or the directory
-     *      and its content.
-     */
-    private static ZipContent[] getInternalFiles(File pFile, File pRootDir) {
-        
-        ZipContent[] contents = new ZipContent[0];
-        
-        ArrayList<ZipContent> result = new ArrayList<ZipContent>();
-        File[] files = pFile.listFiles();
-        if (files != null) {
-            for (int i = 0; i < files.length; i++) {
-                File filei = files[i];
-                if (filei.isFile() && !filei.getName().endsWith("urd")) { //$NON-NLS-1$
-                    
-                    String filePath = filei.getAbsolutePath();
-                    String relativePath = filePath.substring(
-                            pRootDir.getAbsolutePath().length() + 1);
-                    if (Platform.getOS().equals(Platform.OS_WIN32)) {
-                        relativePath = relativePath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
-                    }
-                    ZipContent content = new ZipContent(relativePath, filei);
-
-                    result.add(content);
-                } else {
-                    if (!filei.getName().equals("urd")) { //$NON-NLS-1$
-                        ZipContent[] tmpContents = getInternalFiles(filei, pRootDir);
-                        result.addAll(Arrays.asList(tmpContents));
-                    }
-                }
-            }
-
-            contents = new ZipContent[result.size()];
-            contents = result.toArray(contents);
-        } else {
-            PluginLogger.warning(Messages.getString("ZipContentHelper.NotDirectoryError") + pFile); //$NON-NLS-1$
-        }
-        return contents;
-    }
-}


More information about the ooo-build-commit mailing list