summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-05 08:59:48 +0100
committerCédric Bosdonnat <cedricbosdo@openoffice.org>2010-11-05 08:59:48 +0100
commitc8114e54d7f433c48fd0f3d54e3e7f16758865a5 (patch)
tree3f2b04ad47e93e942a8726d65bc6b010cd5baca8
parentaf8c7a38282e5b585e79451d2d6615a30ea390fe (diff)
Integration of the oxt packager library
-rwxr-xr-xcore/META-INF/MANIFEST.MF3
-rw-r--r--core/build/build.xml6
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java20
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/actions/UnoProjectPulldownAction.java18
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/actions/UnoTypePulldownAction.java16
-rwxr-xr-xcore/source/org/openoffice/ide/eclipse/core/builders/RegmergeBuilder.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java1
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/editors/pack/ContentsSection.java4
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/editors/pack/LibsSection.java4
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/editors/pack/PackageDescriptionSection.java4
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/helpers/UnoidlProjectHelper.java95
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java2
-rwxr-xr-xcore/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/language/ILanguageBuilder.java6
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java2
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java118
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java258
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java614
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java (renamed from core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java)29
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/utils/FileHelper.java185
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/utils/XMLWriter.java235
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java123
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java7
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java7
-rw-r--r--core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java45
-rw-r--r--cpp/META-INF/MANIFEST.MF3
-rw-r--r--cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java5
-rw-r--r--java/META-INF/MANIFEST.MF3
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java21
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java2
-rw-r--r--packager/.classpath7
-rw-r--r--packager/.gitignore1
-rw-r--r--packager/.project28
-rw-r--r--packager/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--packager/META-INF/MANIFEST.MF13
-rw-r--r--packager/build.properties5
-rw-r--r--packager/build/MANIFEST.MF.in13
-rw-r--r--packager/build/build.properties4
-rw-r--r--packager/build/build.xml94
41 files changed, 407 insertions, 1610 deletions
diff --git a/core/META-INF/MANIFEST.MF b/core/META-INF/MANIFEST.MF
index c30f0a0..077181a 100755
--- a/core/META-INF/MANIFEST.MF
+++ b/core/META-INF/MANIFEST.MF
@@ -19,7 +19,8 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.debug.core,
org.eclipse.debug.ui,
org.eclipse.ui;bundle-version="3.4.1",
- javax.xml;bundle-version="1.3.4"
+ javax.xml;bundle-version="1.3.4",
+ org.openoffice.ide.packager.core;bundle-version="0.1.0"
Bundle-ActivationPolicy: lazy
Export-Package: org.openoffice.ide.eclipse.core,
org.openoffice.ide.eclipse.core.actions,
diff --git a/core/build/build.xml b/core/build/build.xml
index da1f27e..9e5e320 100644
--- a/core/build/build.xml
+++ b/core/build/build.xml
@@ -42,6 +42,8 @@
<project name="core" default="core.error">
+ <import file="../packager/build/build.xml"/>
+
<target name="core.error">
<fail>Wrong target!
@@ -50,7 +52,7 @@
</fail>
</target>
- <target name="init-env">
+ <target name="init-env" depends="packager.init-env">
<dirname property="core.basedir" file="${ant.file.core}/.."/>
<loadproperties srcfile="${core.basedir}/build/build.properties" />
@@ -104,7 +106,7 @@
</target>
- <target name="core.compile" depends="init-env">
+ <target name="core.compile" depends="init-env, packager.plugin">
<javac srcdir="${core.basedir}/source" destdir="${core.out.classes}"
target="1.5" source="1.5"
debug="${debug}"
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java b/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java
index 70e9ad6..cdf1ffb 100644
--- a/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/ConvertToManifestAction.java
@@ -51,14 +51,15 @@ 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.ProjectsManager;
-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;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
+import org.openoffice.plugin.core.model.ManifestModel;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Action converting the legacy package.properties into manifest.xml file.
*
- * @author cbosdo
+ * @author Cédric Bosdonnat <cedric.bosdonnat@free.fr>
*
*/
public class ConvertToManifestAction implements IObjectActionDelegate {
@@ -80,26 +81,31 @@ public class ConvertToManifestAction implements IObjectActionDelegate {
String prjName = mPackageFile.getProject().getName();
IUnoidlProject prj = ProjectsManager.getProject( prjName );
+ File prjFile = SystemHelper.getFile( prj );
+
// Create a dummy package to get the automatic entries of the manifest
UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage( prj, new File( "foo.oxt" ) ); //$NON-NLS-1$
ManifestModel manifestModel = unoPackage.getManifestModel();
for (IFolder lib : propsModel.getBasicLibraries()) {
- manifestModel.addBasicLibrary( lib );
+ manifestModel.addBasicLibrary( lib.getProjectRelativePath().toString() );
}
for (IFolder lib : propsModel.getDialogLibraries()) {
- manifestModel.addDialogLibrary( lib );
+ manifestModel.addDialogLibrary( lib.getProjectRelativePath().toString() );
}
for (IResource content : propsModel.getContents()) {
- manifestModel.addContent( content );
+ File contentFile = SystemHelper.getFile( content );
+ manifestModel.addContent(
+ UnoPackage.getPathRelativeToBase( contentFile, prjFile),
+ contentFile );
}
Iterator<Entry<Locale, IFile>> iter = propsModel.getDescriptionFiles().entrySet().iterator();
while ( iter.hasNext() ) {
Entry<Locale, IFile> entry = iter.next();
- manifestModel.addDescription( entry.getValue(), entry.getKey() );
+ manifestModel.addDescription( entry.getValue().getProjectRelativePath().toString(), entry.getKey() );
}
// Serialize the manifest model into the manifest.xml file
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/UnoProjectPulldownAction.java b/core/source/org/openoffice/ide/eclipse/core/actions/UnoProjectPulldownAction.java
index 4a15341..bd6a23e 100644
--- a/core/source/org/openoffice/ide/eclipse/core/actions/UnoProjectPulldownAction.java
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/UnoProjectPulldownAction.java
@@ -48,21 +48,23 @@ import org.eclipse.jface.viewers.IStructuredSelection;
/**
* Pulldown action for the uno projects. The wizard has to be defined as follows:
- * <wizard
+ * <pre>
+ * &lt;wizard
* canFinishEarly="false"
* category="org.openoffice.ide.eclipse.core"
* hasPages="true"
* icon="icons/newunoproject.gif"
* id="org.openoffice.ide.eclipse.core.newunoproject"
* name="%wizards.unoidlproject"
- * project="true">
- * <class class="org.openoffice.ide.eclipse.core.wizards.NewUnoProjectWizard">
- * <parameter name="unoproject" value="true"/>
- * </class>
- * <description>
+ * project="true"&gt;
+ * &lt;class class="org.openoffice.ide.eclipse.core.wizards.NewUnoProjectWizard"&gt;
+ * &lt;parameter name="unoproject" value="true"/&gt;
+ * &lt;/class&gt;
+ * &lt;description&gt;
* Create an empty UNO component with a service and it's implementation.
- * </description>
- * </wizard>
+ * &lt;/description&gt;
+ * &lt;/wizard&gt;
+ * </pre>
*
* @author cedricbosdo
*
diff --git a/core/source/org/openoffice/ide/eclipse/core/actions/UnoTypePulldownAction.java b/core/source/org/openoffice/ide/eclipse/core/actions/UnoTypePulldownAction.java
index 2b6800b..8859740 100644
--- a/core/source/org/openoffice/ide/eclipse/core/actions/UnoTypePulldownAction.java
+++ b/core/source/org/openoffice/ide/eclipse/core/actions/UnoTypePulldownAction.java
@@ -53,7 +53,8 @@ import org.openoffice.ide.eclipse.core.wizards.NewServiceWizard;
/**
* Pulldown action for the uno types. The wizard has to be defined as follows:
- * <wizard
+ * <pre>
+ * &lt;wizard
* canFinishEarly="false"
* category="org.openoffice.ide.eclipse.core"
* hasPages="true"
@@ -61,13 +62,14 @@ import org.openoffice.ide.eclipse.core.wizards.NewServiceWizard;
* id="org.openoffice.ide.eclipse.core.newservice"
* name="%wizards.service"
* project="false">
- * <class class="org.openoffice.ide.eclipse.core.wizards.NewServiceWizard">
- * <parameter name="unotype" value="true"/>
- * </class>
- * <description>
+ * &lt;class class="org.openoffice.ide.eclipse.core.wizards.NewServiceWizard"&gt;
+ * &lt;parameter name="unotype" value="true"/&gt;
+ * &lt;/class&gt;
+ * &lt;description&gt;
* Creates a new 'new-styled' UNO service. A service will export one interface and define some constructors.
- * </description>
- * </wizard>
+ * &lt;/description&gt;
+ * &lt;/wizard&gt;
+ * </pre>
*
* @author cedricbosdo
*
diff --git a/core/source/org/openoffice/ide/eclipse/core/builders/RegmergeBuilder.java b/core/source/org/openoffice/ide/eclipse/core/builders/RegmergeBuilder.java
index 2e37566..e9435cf 100755
--- a/core/source/org/openoffice/ide/eclipse/core/builders/RegmergeBuilder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/builders/RegmergeBuilder.java
@@ -52,7 +52,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
-import org.openoffice.ide.eclipse.core.utils.FileHelper;
+import org.openoffice.plugin.core.utils.FileHelper;
/**
* Builder for the URD files generating the <code>types.rdb</code> registry.
diff --git a/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java b/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
index f1c7c7f..d1036c2 100644
--- a/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/builders/TypesBuilder.java
@@ -106,6 +106,7 @@ public class TypesBuilder extends IncrementalProjectBuilder {
/**
* {@inheritDoc}
*/
+ @SuppressWarnings("unchecked")
protected IProject[] build(int pKind, Map pArgs, IProgressMonitor pMonitor) throws CoreException {
mChangedIdl = false;
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/pack/ContentsSection.java b/core/source/org/openoffice/ide/eclipse/core/editors/pack/ContentsSection.java
index 684d8cd..a8c79b3 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/pack/ContentsSection.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/pack/ContentsSection.java
@@ -62,8 +62,8 @@ import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.model.WorkbenchContentProvider;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.openoffice.ide.eclipse.core.editors.Messages;
+import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
import org.openoffice.ide.eclipse.core.model.pack.PackagePropertiesModel;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
import org.openoffice.ide.eclipse.core.model.utils.IModelChangedListener;
/**
@@ -138,7 +138,7 @@ public class ContentsSection extends SectionPart {
if (resource.getName().startsWith(".") || //$NON-NLS-1$
resource.getName().equals("build") || //$NON-NLS-1$
resource.getName().equals("bin") || //$NON-NLS-1$
- UnoPackage.isContainedInPackage(resource)) {
+ UnoidlProjectHelper.isContainedInPackage(resource)) {
select = false;
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/pack/LibsSection.java b/core/source/org/openoffice/ide/eclipse/core/editors/pack/LibsSection.java
index 7669865..9d1062f 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/pack/LibsSection.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/pack/LibsSection.java
@@ -79,8 +79,8 @@ import org.eclipse.ui.forms.widgets.Section;
import org.eclipse.ui.model.IWorkbenchAdapter;
import org.openoffice.ide.eclipse.core.editors.Messages;
import org.openoffice.ide.eclipse.core.gui.ProjectSelectionDialog;
+import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
import org.openoffice.ide.eclipse.core.model.pack.PackagePropertiesModel;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
/**
* Basic and dialog libraries section of the Contents form page of the
@@ -276,7 +276,7 @@ public class LibsSection extends SectionPart {
hiddenResources.addAll(editor.getModel().getBasicLibraries());
hiddenResources.addAll(editor.getModel().getDialogLibraries());
hiddenResources.addAll(editor.getModel().getContents());
- hiddenResources.addAll(UnoPackage.getContainedFile(prj));
+ hiddenResources.addAll(UnoidlProjectHelper.getContainedFile(prj));
dlg.setFilteredElements(hiddenResources);
if (ProjectSelectionDialog.OK == dlg.open()) {
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/pack/PackageDescriptionSection.java b/core/source/org/openoffice/ide/eclipse/core/editors/pack/PackageDescriptionSection.java
index 4b21c5e..d9c714c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/pack/PackageDescriptionSection.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/pack/PackageDescriptionSection.java
@@ -80,7 +80,7 @@ import org.eclipse.ui.model.IWorkbenchAdapter;
import org.openoffice.ide.eclipse.core.editors.Messages;
import org.openoffice.ide.eclipse.core.gui.LocaleCellProvider;
import org.openoffice.ide.eclipse.core.gui.ProjectSelectionDialog;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
/**
* @author cedricbosdo
@@ -228,7 +228,7 @@ public class PackageDescriptionSection extends SectionPart {
hiddenResources.addAll(editor.getModel().getDialogLibraries());
hiddenResources.addAll(editor.getModel().getContents());
hiddenResources.addAll(editor.getModel().getDescriptionFiles().values());
- hiddenResources.addAll(UnoPackage.getContainedFile(prj));
+ hiddenResources.addAll(UnoidlProjectHelper.getContainedFile(prj));
dlg.setFilteredElements(hiddenResources);
if (ProjectSelectionDialog.OK == dlg.open()) {
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 1e6878b..ff5d52e 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
@@ -46,13 +46,15 @@ package org.openoffice.ide.eclipse.core.internal.helpers;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Properties;
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;
@@ -73,7 +75,8 @@ import org.openoffice.ide.eclipse.core.model.UnoFactoryData;
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.AbstractLanguage;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Helper class for UNO-IDL project handling.
@@ -511,13 +514,95 @@ public class UnoidlProjectHelper {
*/
public static UnoPackage createMinimalUnoPackage(IUnoidlProject pPrj, File pDest) {
- IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( pPrj.getName() );
- UnoPackage unoPackage = new UnoPackage(pDest, prj);
+ UnoPackage unoPackage = new UnoPackage(pDest);
+
+ File libFile = SystemHelper.getFile( pPrj.getFile( pPrj.getTypesPath() ) );
+ File prjFile = SystemHelper.getFile( pPrj );
// Add content to the package
- unoPackage.addTypelibraryFile( pPrj.getFile( pPrj.getTypesPath() ), "RDB"); //$NON-NLS-1$
+ unoPackage.addTypelibraryFile(
+ UnoPackage.getPathRelativeToBase(libFile, prjFile),
+ libFile,
+ "RDB"); //$NON-NLS-1$
pPrj.getLanguage().getLanguageBuidler().fillUnoPackage(unoPackage, pPrj);
return unoPackage;
}
+
+ /**
+ * Checks if the resource is contained in the UNO package.
+ *
+ * @param pRes the resource to check
+ * @return <code>true</code> if the resource is contained in the package
+ */
+ public static boolean isContainedInPackage(IResource pRes) {
+ boolean contained = false;
+
+ String prjName = pRes.getProject().getName();
+ IUnoidlProject prj = ProjectsManager.getProject(prjName);
+
+ try {
+ URI resUri = pRes.getLocationURI();
+
+ if (prj != null) {
+
+ File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
+
+ File dest = new File(outputDir, prj.getName() + ".zip"); //$NON-NLS-1$
+ UnoPackage unoPackage = createMinimalUnoPackage(prj, dest);
+
+ List<File> files = unoPackage.getContainedFiles();
+ int i = 0;
+ while (i < files.size() && !contained) {
+ URI uri = files.get(i).toURI();
+ if ( uri.equals( resUri ) ) {
+ contained = true;
+ }
+ i++;
+ }
+ unoPackage.dispose();
+ }
+ } catch ( Exception e ) {
+ contained = false;
+ }
+
+ return contained;
+ }
+
+ /**
+ * Get the list of the files contained in the minimal UNO package.
+ *
+ * @param pPrj the project for which to get the minimal resources
+ * @return the list of files
+ */
+ public static List<IResource> getContainedFile(IProject pPrj) {
+ ArrayList<IResource> resources = new ArrayList<IResource>();
+
+ String prjName = pPrj.getName();
+ IUnoidlProject unoprj = ProjectsManager.getProject(prjName);
+
+ if (unoprj != null) {
+
+ File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
+
+ File dest = new File(outputDir, pPrj.getName() + ".zip"); //$NON-NLS-1$
+ UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(unoprj, dest);
+
+ List<File> files = unoPackage.getContainedFiles();
+ File prjFile = SystemHelper.getFile( pPrj );
+ for (File file : files) {
+ String relative = UnoPackage.getPathRelativeToBase( file, prjFile );
+ IResource res = pPrj.findMember( relative );
+ if ( res != null ) {
+ resources.add( res );
+ }
+ }
+
+
+ unoPackage.dispose();
+ }
+
+ return resources;
+ }
+
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
index 2c13d96..cff6ee1 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java
@@ -57,11 +57,11 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.swt.graphics.Image;
import org.openoffice.ide.eclipse.core.gui.ITableElement;
-import org.openoffice.ide.eclipse.core.internal.helpers.SystemHelper;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.OOoContainer;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.config.InvalidConfigException;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
/**
* Helper class to add the table element features to the OOo classes. All the
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
index 82897fc..2700ff2 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java
@@ -54,8 +54,8 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.widgets.Display;
import org.openoffice.ide.eclipse.core.PluginLogger;
-import org.openoffice.ide.eclipse.core.internal.helpers.SystemHelper;
import org.openoffice.ide.eclipse.core.model.config.InvalidConfigException;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
/**
* Representing an OpenOffice.org instance for use in the UNO-IDL projects.
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
index 46b79a3..64f51c2 100755
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/SDK.java
@@ -62,11 +62,11 @@ import org.eclipse.swt.graphics.Image;
import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
import org.openoffice.ide.eclipse.core.PluginLogger;
import org.openoffice.ide.eclipse.core.gui.ITableElement;
-import org.openoffice.ide.eclipse.core.internal.helpers.SystemHelper;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
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.config.InvalidConfigException;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
/**
* Class representing a SDK instance used in the UNO-IDL projects.
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java b/core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java
index aa38b77..e4bb50b 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java
@@ -41,7 +41,7 @@ import java.util.Map.Entry;
import org.openoffice.ide.eclipse.core.model.utils.IModel;
import org.openoffice.ide.eclipse.core.model.utils.IModelChangedListener;
-import org.openoffice.ide.eclipse.core.utils.XMLWriter;
+import org.openoffice.plugin.core.utils.XMLWriter;
/**
* Class representing the description.xml file.
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/language/ILanguageBuilder.java b/core/source/org/openoffice/ide/eclipse/core/model/language/ILanguageBuilder.java
index dd98f70..8f7454e 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/language/ILanguageBuilder.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/language/ILanguageBuilder.java
@@ -45,13 +45,13 @@ package org.openoffice.ide.eclipse.core.model.language;
import java.io.File;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
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.pack.UnoPackage;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Interface defining a set of methods for to do the language specific
@@ -78,7 +78,7 @@ public interface ILanguageBuilder {
* @return the created library path
* @throws Exception if anything wrong happened
*/
- public IPath createLibrary(IUnoidlProject pUnoProject) throws Exception;
+ public IFile createLibrary(IUnoidlProject pUnoProject) throws Exception;
/**
* <p>Generates the language specific interfaces corresponding
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java b/core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java
index f514b8d..529f3e0 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java
@@ -31,8 +31,8 @@
package org.openoffice.ide.eclipse.core.model.language;
import org.eclipse.swt.widgets.Composite;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
import org.openoffice.ide.eclipse.core.wizards.pages.ManifestExportPage;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Abstract class for the language specific controls part in the OXT export
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
deleted file mode 100644
index 2fbad4d..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/model/pack/FileType.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*************************************************************************
- *
- * The Contents of this file are made available subject to the terms of
- * the GNU Lesser General Public License Version 2.1
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2009 by Cédric Bosdonnat.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * The Initial Developer of the Original Code is: Cédric Bosdonnat.
- *
- * Copyright: 2009 by Cédric Bosdonnat.
- *
- * All Rights Reserved.
- *
- ************************************************************************/
-package org.openoffice.ide.eclipse.core.model.pack;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
-/**
- * Class representing the file types for the entries of the manifest.xml file.
- *
- * @author Cédric Bosdonnat
- *
- */
-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;
- }
-
- /**
- * @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
deleted file mode 100644
index 17428f5..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/model/pack/ManifestModel.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*************************************************************************
- *
- * The Contents of this file are made available subject to the terms of
- * the GNU Lesser General Public License Version 2.1
- *
- * GNU Lesser General Public License Version 2.1
- * =============================================
- * Copyright 2009 by Cédric Bosdonnat.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- *
- * The Initial Developer of the Original Code is: Cédric Bosdonnat.
- *
- * Copyright: 2009 by Cédric Bosdonnat.
- *
- * All Rights Reserved.
- *
- ************************************************************************/
-package org.openoffice.ide.eclipse.core.model.pack;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.text.MessageFormat;
-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;
-
-/**
- * Class representing the data contained in the manifest.xml file.
- *
- * @author Cédric Bosdonnat
- *
- */
-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>();
-
- /**
- * 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 ( !(0 == localeString.length()) ) {
- 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}\"" + //$NON-NLS-1$
- " 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
deleted file mode 100644
index 99ad0c3..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/model/pack/UnoPackage.java
+++ /dev/null
@@ -1,614 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: UnoPackage.java,v $
- *
- * $Revision: 1.7 $
- *
- * last change: $Author: cedricbosdo $ $Date: 2007/11/25 20:32:30 $
- *
- * 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.model.pack;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-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.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.widgets.Display;
-import org.openoffice.ide.eclipse.core.PluginLogger;
-import org.openoffice.ide.eclipse.core.internal.helpers.UnoidlProjectHelper;
-import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
-import org.openoffice.ide.eclipse.core.model.Messages;
-import org.openoffice.ide.eclipse.core.model.ProjectsManager;
-import org.openoffice.ide.eclipse.core.utils.FileHelper;
-import org.openoffice.ide.eclipse.core.utils.ZipContent;
-
-/**
- * This class represents a UNO package and should be used to create a UNO package.
- *
- * <p>In the same way than ant jar target does, the UNO package is defined by an
- * output file and a root directory. All the file that will be added to the
- * package will have to be contained in this directory or one of its children.</p>
- *
- * @author cedricbosdo
- *
- */
-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 static final String BASIC_LIBRARY_INDEX = "script.xlb"; //$NON-NLS-1$
- private static final String DIALOG_LIBRARY_INDEX = "dialog.xlb"; //$NON-NLS-1$
-
- private IProject mPrj;
- private File mDestination;
- private boolean mBuilding = false;
-
- private HashMap<String, ZipContent> mZipEntries = new HashMap<String, ZipContent>();
- private ManifestModel mManifest = new ManifestModel();
- private ArrayList< IPath > mToClean = new ArrayList<IPath>( );
-
- private IFile mReadManifestFile;
- private IFile mSaveManifestFile;
-
- private Runnable mDeployJob;
-
- /**
- * Create a new package object.
- *
- * <p>The extension has be one of the following. The default extension is
- * {@link #ZIP}. If the extension is invalid or missing, the file will be
- * renamed in <code>.zip</code>.
- * <ul>
- * <li>{@link #ZIP}</li>
- * <li>{@link #UNOPKG}</li>
- * <li>{@link #OXT}</li>
- * </ul>
- * </p>
- *
- * @param pOut the file of the package.
- * @param pPrj the project to export
- */
- 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$
- if (pos > 0) {
- String name = pOut.getName().substring(0, pos);
- pOut = new File(pOut.getParentFile(), name + "." + ZIP); //$NON-NLS-1$
- } else {
- pOut = new File(pOut.getParentFile(), pOut.getName() + ".zip"); //$NON-NLS-1$
- }
- }
-
- mDestination = pOut;
- mPrj = pPrj;
- }
-
- /**
- * Cleans up the data structure. There is no need to call this method if the
- * package has been closed using {@link #close()}
- */
- public void dispose() {
- mDestination = null;
- mZipEntries.clear();
- }
-
- /**
- * @return the manifest.xml model contained in the package
- */
- public ManifestModel getManifestModel( ) {
- return mManifest;
- }
-
- /**
- * Set the manifest.xml file to use for the package: setting this value will
- * skip the manifest.xml file automatic generation.
- *
- * <p><strong>Setting this value to a non-existing file is the same as setting it with
- * <code>null</code>: the default value will be used.</strong></p>
- *
- * @param pFile the file to read.
- *
- * @see #MANIFEST_PATH The default path value relative to the project
- */
- public void setReadManifestFile( IFile pFile ) {
- if ( pFile != null && pFile.exists( ) ) {
- mReadManifestFile = pFile;
- }
- }
-
- /**
- * @param pFile the file where to save the manifest.xml
- */
- public void setSaveManifestFile( IFile pFile ) {
- if ( pFile != null ) {
- mSaveManifestFile = pFile;
- }
- }
-
- /**
- * @param pJob the job to run to deploy the package, <code>null</code>
- * can be used to remove any previously set deploy job.
- */
- public void setDeployJob( Runnable pJob ) {
- mDeployJob = pJob;
- }
-
- /**
- * Add a file or directory to the package.
- *
- * <p>This method doesn't know about the different languages
- * 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(".xcs")) { //$NON-NLS-1$
- addConfigurationSchemaFile( file );
- } else if (pContent.getName().endsWith(".xcu")) { //$NON-NLS-1$
- addConfigurationDataFile( file );
- } else if (pContent.getName().endsWith(".rdb")) { //$NON-NLS-1$
- addTypelibraryFile( file , "RDB"); //$NON-NLS-1$
- } else {
- addOtherFile( file );
- }
- } else if ( isBasicLibrary( pContent ) ) {
- addBasicLibraryFile( ( IFolder ) pContent );
- } else if ( isDialogLibrary( pContent ) ) {
- addDialogLibraryFile( ( IFolder ) pContent );
- } else if ( pContent instanceof IContainer ) {
- // Recurse on the directory
- IContainer container = (IContainer) pContent;
- IResource[] children;
- try {
- children = container.members();
- for (IResource child : children) {
- 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(IFile, 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) {
- // Do not change the extension from now
- initializeOutput();
-
- // create the manifest entry
- mManifest.addComponentFile( pFile, pType, pPlatform );
-
- // create the ZipContent
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * 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) {
- // Do not change the extension from now
- initializeOutput();
-
- // create the manifest entry
- mManifest.addTypelibraryFile( pFile, pType );
-
- // create the ZipContent
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * 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 addBasicLibraryFile(IFolder pDir) {
- // Do not change the extension from now
- initializeOutput();
-
- mManifest.addBasicLibrary( pDir );
- addZipContent( pDir.getProjectRelativePath().toString(), pDir );
- }
-
- /**
- * 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 addDialogLibraryFile(IFolder pDir) {
- // Do not change the extension from now
- initializeOutput();
-
- mManifest.addDialogLibrary( pDir );
- addZipContent( pDir.getProjectRelativePath().toString(), pDir );
- }
-
- /**
- * Add an xcu configuration to the package.
- *
- * @param pFile the xcu file to add
- */
- public void addConfigurationDataFile(IFile pFile) {
- // Do not change the extension from now
- initializeOutput();
-
- mManifest.addConfigurationDataFile( pFile );
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * Add an xcs configuration to the package.
- *
- * @param pFile the xcs file to add
- */
- public void addConfigurationSchemaFile(IFile pFile) {
- // Do not change the extension from now
- initializeOutput();
-
- mManifest.addConfigurationSchemaFile( pFile );
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * Add a localized description of the package.
- *
- * @param pFile the file containing the description for that locale
- * @param pLocale the locale of the description. Can be <code>null</code>.
- */
- public void addPackageDescription(IFile pFile, Locale pLocale) {
- mManifest.addDescription( pFile, pLocale );
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * Adds a file or directory to the package but do not include it in the
- * manifest.
- *
- * <p>This could be used for example for images.</p>
- *
- * @param pFile the file or directory to add.
- */
- public void addOtherFile(IFile pFile) {
- // Do not change the extension from now
- initializeOutput();
-
- addZipContent( pFile.getProjectRelativePath().toString(), pFile );
- }
-
- /**
- * Writes the package on the disk and cleans up the data. The UnoPackage
- * instance cannot be used after this operation: it should unreferenced.
- *
- * @param pMonitor the progress monitor
- *
- * @return the file of the package or <code>null</code> if nothing happened.
- */
- public File close( IProgressMonitor pMonitor ) {
- File result = null;
-
- if (mBuilding) {
- try {
- IFile manifestFile = mReadManifestFile;
- if ( manifestFile == null ) {
- // Write the manifest if it doesn't exist
- manifestFile = getSaveManifestFile();
- FileOutputStream writer = new FileOutputStream( manifestFile.getLocation().toFile() );
- mManifest.write( writer );
- writer.close();
- manifestFile.refreshLocal( IResource.DEPTH_ZERO, null );
- }
-
- // Write the ZipContent
- FileOutputStream out = new FileOutputStream(mDestination);
- ZipOutputStream zipOut = new ZipOutputStream(out);
-
- Iterator<ZipContent> entries = mZipEntries.values().iterator();
- while (entries.hasNext()) {
- ZipContent content = entries.next();
- content.writeContentToZip(zipOut);
- }
-
- // Add the manifest to the zip
- ZipContent manifest = new ZipContent("META-INF/manifest.xml", manifestFile); //$NON-NLS-1$
- manifest.writeContentToZip(zipOut);
-
- // close the streams
- zipOut.close();
- out.close();
-
- } catch (Exception e) {
- PluginLogger.error(Messages.getString("UnoPackage.PackageCreationError"), e); //$NON-NLS-1$
- }
-
- result = mDestination;
-
- cleanResources();
-
- // Deploy the package if a job is set
- if ( mDeployJob != null ) {
- Display.getDefault().asyncExec( mDeployJob );
- }
-
- // Refresh the project and return the status
- try {
- mPrj.refreshLocal( IResource.DEPTH_INFINITE, pMonitor );
- } catch ( Exception e ) {
- }
-
- dispose();
- }
- return result;
- }
-
- /**
- * @return a list of the files that are already queued for addition
- * to the package.
- */
- public List<IResource> getContainedFiles() {
- ArrayList<IResource> files = new ArrayList<IResource>(mZipEntries.size());
- for (ZipContent content : mZipEntries.values()) {
- files.add( content.getFile() );
- }
- return files;
- }
-
- /**
- * Checks if the resource is contained in the UNO package.
- *
- * @param pRes the resource to check
- * @return <code>true</code> if the resource is contained in the package
- */
- public static boolean isContainedInPackage(IResource pRes) {
- boolean contained = false;
-
- String prjName = pRes.getProject().getName();
- IUnoidlProject prj = ProjectsManager.getProject(prjName);
-
- if (prj != null) {
-
- File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
-
- File dest = new File(outputDir, prj.getName() + ".zip"); //$NON-NLS-1$
- UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(prj, dest);
-
- List<IResource> files = unoPackage.getContainedFiles();
- int i = 0;
- while (i < files.size() && !contained) {
- IResource res = files.get(i);
- if ( res.getLocation().equals( pRes.getLocation() ) ) {
- contained = true;
- }
- i++;
- }
- unoPackage.dispose();
- }
-
- return contained;
- }
-
- /**
- * Get the list of the files contained in the minimal UNO package.
- *
- * @param pPrj the project for which to get the minimal resources
- * @return the list of files
- */
- public static List<IResource> getContainedFile(IProject pPrj) {
- ArrayList<IResource> resources = new ArrayList<IResource>();
-
- String prjName = pPrj.getName();
- IUnoidlProject unoprj = ProjectsManager.getProject(prjName);
-
- if (unoprj != null) {
-
- File outputDir = new File(System.getProperty("user.home")); //$NON-NLS-1$
-
- File dest = new File(outputDir, pPrj.getName() + ".zip"); //$NON-NLS-1$
- UnoPackage unoPackage = UnoidlProjectHelper.createMinimalUnoPackage(unoprj, dest);
-
- resources.addAll( unoPackage.getContainedFiles() );
-
- unoPackage.dispose();
- }
-
- return resources;
- }
-
- /**
- * Add the path to a resource to clean after having exported the package.
- * The resource won't be cleaned if the package isn't exported.
- *
- * @param pPath the path to the resource to clean.
- */
- public void addToClean( IPath pPath ) {
- mToClean.add( pPath );
- }
-
- /**
- * Creates the main elements for the package creation.
- *
- * <p>After this step, the extension cannot be changed. Calling this
- * method when the package has already been initialized does nothing.</p>
- *
- */
- private void initializeOutput() {
- mBuilding = true;
- }
-
- /**
- * 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, IResource pFile) {
- if (pRelativePath != null) {
- if ( pFile instanceof IContainer ) {
- // Add all the children
- 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);
- mZipEntries.put(pRelativePath, content);
- }
- }
- }
-
- /**
- * Clean the resources added using {@link #addToClean(IPath)}.
- */
- private void cleanResources() {
- for ( IPath path : mToClean ) {
- FileHelper.remove( new File( path.toOSString() ) );
- }
-
- // Remove the default manifest file if needed
- IFile manifestFile = getSaveManifestFile();
- if ( mSaveManifestFile == null &&
- !manifestFile.equals( mReadManifestFile ) &&
- manifestFile.exists() ) {
- try {
- manifestFile.delete( true, null );
- } catch ( Exception e ) {
- }
- }
- }
-
- /**
- * Checks if the resource is a dialog library.
- *
- * @param pRes the resource to check
- *
- * @return <code>true</code> if the resource is a dialog library,
- * <code>false</code> in any other case
- */
- private boolean isDialogLibrary( IResource pRes ) {
- boolean result = false;
- if ( pRes instanceof IFolder ) {
- IFolder folder = ( IFolder ) pRes;
- result = folder.getFile( DIALOG_LIBRARY_INDEX ).exists();
- }
- return result;
- }
-
- /**
- * Checks if the resource is a basic library.
- *
- * @param pRes the resource to check
- *
- * @return <code>true</code> if the resource is a basic library,
- * <code>false</code> in any other case
- */
- private boolean isBasicLibrary( IResource pRes ) {
- boolean result = false;
- if ( pRes instanceof IFolder ) {
- IFolder folder = ( IFolder ) pRes;
- result = folder.getFile( BASIC_LIBRARY_INDEX ).exists();
- }
- return result;
- }
-
- /**
- * @return the manifest file to write either defined by the setter or
- * the default value.
- */
- private IFile getSaveManifestFile( ) {
- IFile file = mSaveManifestFile;
- if ( file == null ) {
- file = mPrj.getFile( MANIFEST_PATH );
- }
- return file;
- }
-}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
index 511867c..47ecc38 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/helpers/SystemHelper.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/utils/SystemHelper.java
@@ -41,7 +41,7 @@
*
*
************************************************************************/
-package org.openoffice.ide.eclipse.core.internal.helpers;
+package org.openoffice.ide.eclipse.core.model.utils;
import java.io.File;
import java.io.IOException;
@@ -50,9 +50,13 @@ import java.util.Iterator;
import java.util.Set;
import java.util.Map.Entry;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.openoffice.ide.eclipse.core.PluginLogger;
+import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
/**
* Helper class for system variables handling.
@@ -67,6 +71,29 @@ public class SystemHelper {
private static final int COMMAND_ARGS_LENGTH = 3;
/**
+ * Get a normal Java File from an Eclipse IResource.
+ *
+ * @param pRes the IResource to convert
+ *
+ * @return the equivalent File
+ */
+ public static File getFile( IResource pRes ) {
+ return pRes.getLocation().toFile();
+ }
+
+ /**
+ * Get a normal Java File from an {@link IUnoidlProject}.
+ *
+ * @param pPrj {@link IUnoidlProject} to convert
+ *
+ * @return the equivalent File
+ */
+ public static File getFile( IUnoidlProject pPrj ) {
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( pPrj.getName() );
+ return getFile( prj );
+ }
+
+ /**
* Add an environment variable to an array of existing variables.
*
* @param pEnv the array of existing environment variables where to add the
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/FileHelper.java b/core/source/org/openoffice/ide/eclipse/core/utils/FileHelper.java
deleted file mode 100644
index 9f5b971..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/utils/FileHelper.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: FileHelper.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.utils;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-
-import org.openoffice.ide.eclipse.core.internal.helpers.Messages;
-
-/**
- * Utility class for file handling.
- *
- * @author cedricbosdo
- *
- */
-public class FileHelper {
-
- /**
- * Moves the src directory or file to the dst container.
- *
- * @param pSrc the file or directory to move
- * @param pDst the destination directory
- * @param pForce if set to <code>true</code>, overwrites the existing files
- *
- * @throws IOException is thrown when one of the parameters is null
- * or the underlying file doesn't exists. This exception can also
- * be thrown if the writing rights are missing on dst
- */
- public static void move(File pSrc, File pDst, boolean pForce) throws IOException {
-
- // Check for invalid arguments
- if (pSrc == null || !pSrc.canRead()) {
- throw new IOException(
- Messages.getString("FileHelper.ReadError") + pSrc.getAbsolutePath()); //$NON-NLS-1$
- }
-
- if (pDst == null || !pDst.canWrite()) {
- throw new IOException(
- Messages.getString("FileHelper.WriteError") + pDst.getAbsolutePath()); //$NON-NLS-1$
- }
-
- // Now really move the content
- if (pSrc.isFile()) {
- copyFile(pSrc, new File(pDst, pSrc.getName()), pForce);
- pSrc.delete();
- } else {
-
- File dstdir = new File(pDst, pSrc.getName());
-
- // if the new dir doesn't exists, then create it
- if (!dstdir.exists()) {
- dstdir.mkdir();
- }
-
- // copy each contained file
- File[] files = pSrc.listFiles();
- for (int i = 0; i < files.length; i++) {
- File filei = files[i];
- move(filei, dstdir, pForce);
- filei.delete();
- }
-
- pSrc.delete();
- }
- }
-
- /**
- * Copy the file src into the file dst. If the dst file already
- * exists, it will be deleted before to start copying if force is set
- * to <code>true</code>, otherwise nothing will be done.
- *
- * @param pSrc the original file
- * @param pDst the file to create
- * @param pForce overwrite the existing destination if any
- *
- * @throws IOException is thrown if
- * <ul>
- * <li>the src file is <code>null</code> or isn't readable,</li>
- * <li>dst is <code>null</code></li>
- * <li>the writing process fails</li>
- * </ul>
- */
- public static void copyFile(File pSrc, File pDst, boolean pForce) throws IOException {
-
- // Check for invalid arguments
- if (pSrc == null || !pSrc.canRead()) {
- throw new IOException(
- Messages.getString("FileHelper.ReadError") + pSrc.getAbsolutePath()); //$NON-NLS-1$
- }
-
- if (pDst == null) {
- throw new IOException(Messages.getString("FileHelper.NullDestinationError")); //$NON-NLS-1$
- }
-
- // clean the existing file if any and force
- if (pForce && pDst.exists() && pDst.isFile()) {
- pDst.delete();
- }
-
- if (!pDst.exists()) {
- // now copy the file
- FileInputStream in = new FileInputStream(pSrc);
- FileOutputStream out = new FileOutputStream(pDst);
-
- try {
- int c = in.read();
- while (c != -1) {
- out.write(c);
- c = in.read();
- }
- } finally {
- try {
- in.close();
- out.close();
- } catch (Exception e) {
- }
- }
- }
- }
-
- /**
- * Removes a file or directory.
- *
- * @param pFile the file or directory to remove
- */
- public static void remove(File pFile) {
- if (pFile.isFile()) {
- pFile.delete();
- } else {
- String[] children = pFile.list();
- if (null != children) {
- for (String child : children) {
- if (!child.equals(".") && !child.equals("..")) { //$NON-NLS-1$ //$NON-NLS-2$
- File childFile = new File(pFile, child);
- remove(childFile);
- }
- }
- }
- pFile.delete();
- }
- }
-}
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/XMLWriter.java b/core/source/org/openoffice/ide/eclipse/core/utils/XMLWriter.java
deleted file mode 100644
index 37a8865..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/utils/XMLWriter.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Cédric Bosdonnat - cleaned up the code
- *******************************************************************************/
-package org.openoffice.ide.eclipse.core.utils;
-
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.HashMap;
-import java.util.Iterator;
-
-/**
- * A simple XML writer.
- */
-public class XMLWriter extends PrintWriter {
-
- /* constants */
- protected static final String XML_VERSION = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; //$NON-NLS-1$
- private static final int BUFFER_FREE_SPACE = 10;
-
- protected int mTab;
-
- /**
- * Creates a new writer using the given output stream to write the data.
- *
- * @param pOutput where to write the XML
- * @throws UnsupportedEncodingException if the UTF8 charset isn't supported (would be strange)
- */
- public XMLWriter(OutputStream pOutput) throws UnsupportedEncodingException {
- super(new OutputStreamWriter(pOutput, "UTF8")); //$NON-NLS-1$
- mTab = 0;
- println(XML_VERSION);
- }
-
- /**
- * Write the end of an XML tag.
- *
- * @param pName the name of the tag
- */
- public void endTag(String pName) {
- mTab--;
- printTag('/' + pName, null);
- }
-
- /**
- * Write the end of an XML tag.
- *
- * @param pName the name of the tag
- * @param pIndentation whether to print the indentation or not
- */
- public void endTag(String pName, boolean pIndentation ) {
- mTab--;
- printTag('/' + pName, null, pIndentation, true, false );
- }
-
- /**
- * Write a simple XML tag, on the form &lt;name&gt;value&lt;/name&gt;.
- *
- * @param pName the name of the tag
- * @param pValue the value
- */
- public void printSimpleTag(String pName, Object pValue) {
- if (pValue != null) {
- printTag(pName, null, true, false, false);
- print(getEscaped(String.valueOf(pValue)));
- printTag('/' + pName, null, false, true, false);
- }
- }
-
- /**
- * Write the tab characters at the beginning of the line.
- */
- public void printTabulation() {
- for (int i = 0; i < mTab; i++) {
- super.print('\t');
- }
- }
-
- /**
- * Print an XML Tag in the form &lt;name .../&gt;.
- *
- * @param pName the tag name
- * @param pParameters the tag attributes
- *
- * @see #startTag(String, HashMap)
- * @see #startTag(String, HashMap, boolean)
- */
- public void printSingleTag(String pName, HashMap<String, ? extends Object> pParameters) {
- printTag(pName, pParameters, true, true, true);
- }
-
- /**
- * Print an XML Tag.
- *
- * @param pName the tag name
- * @param pParameters the tag attributes
- *
- * @see #startTag(String, HashMap)
- * @see #startTag(String, HashMap, boolean)
- */
- public void printTag(String pName, HashMap<String, ? extends Object> pParameters) {
- printTag(pName, pParameters, true, true, false);
- }
-
- /**
- * Print an XML tag.
- *
- * @param pName the tag name
- * @param pParameters the tag attributes
- * @param pShouldTab whether to add a tab or not before the tag
- * @param pNewLine whether to add a new line or not after the tag
- * @param pSingleTag writes a tag in the form &lt;name /&gt;
- *
- * @see #startTag(String, HashMap)
- * @see #startTag(String, HashMap, boolean)
- */
- public void printTag(String pName, HashMap<String, ? extends Object> pParameters,
- boolean pShouldTab, boolean pNewLine, boolean pSingleTag ) {
- StringBuffer sb = new StringBuffer();
- sb.append("<"); //$NON-NLS-1$
- sb.append(pName);
- if (pParameters != null) {
- for (Iterator<String> it = pParameters.keySet().iterator(); it.hasNext();) {
- sb.append(" "); //$NON-NLS-1$
- String key = it.next();
- sb.append(key);
- sb.append("=\""); //$NON-NLS-1$
- sb.append(getEscaped(String.valueOf(pParameters.get(key))));
- sb.append("\""); //$NON-NLS-1$
- }
- }
- if ( pSingleTag ) {
- sb.append( "/" ); //$NON-NLS-1$
- }
- sb.append(">"); //$NON-NLS-1$
- if (pShouldTab) {
- printTabulation();
- }
- if (pNewLine) {
- println(sb.toString());
- } else {
- print(sb.toString());
- }
- }
-
- /**
- * Write the start of an XML element.
- *
- * @param pName the name of the element
- * @param pParameters the attributes of the element
- */
- public void startTag(String pName, HashMap<String, ? extends Object> pParameters) {
- startTag(pName, pParameters, true);
- }
-
- /**
- * Write the start of an XML element.
- *
- * @param pName the name of the element
- * @param pParameters the attributes of the element
- * @param pNewLine whether to add a line after the tag or not.
- */
- public void startTag(String pName, HashMap<String, ? extends Object> pParameters, boolean pNewLine) {
- printTag(pName, pParameters, true, pNewLine, false);
- mTab++;
- }
-
- /**
- * Safely add a character to the buffer, replaces it by the corresponding XML entity
- * if needed.
- *
- * @param pBuffer where to write the character
- * @param pC the character to add
- */
- private static void appendEscapedChar(StringBuffer pBuffer, char pC) {
- String replacement = getReplacement(pC);
- if (replacement != null) {
- pBuffer.append('&');
- pBuffer.append(replacement);
- pBuffer.append(';');
- } else {
- pBuffer.append(pC);
- }
- }
-
- /**
- * Replace the XML problematic characters by their entities in the string.
- *
- * @param pS the string to escape
- *
- * @return the same string with the XML entities instead.
- */
- public static String getEscaped(String pS) {
- StringBuffer result = new StringBuffer(pS.length() + BUFFER_FREE_SPACE);
- for (int i = 0; i < pS.length(); ++i) {
- appendEscapedChar(result, pS.charAt(i));
- }
- return result.toString();
- }
-
- /**
- * Get the XML entity name for a character, or <code>null</code> if there is no
- * replacement for this character.
- *
- * @param pC the character for which to get an XML entity
- * @return the XML entity name
- */
- private static String getReplacement(char pC) {
- // Encode special XML characters into the equivalent character references.
- // These five are defined by default for all XML documents.
- String result = null;
- switch (pC) {
- case '<' :
- result = "lt"; //$NON-NLS-1$
- case '>' :
- result = "gt"; //$NON-NLS-1$
- case '"' :
- result = "quot"; //$NON-NLS-1$
- case '\'' :
- result = "apos"; //$NON-NLS-1$
- case '&' :
- result = "amp"; //$NON-NLS-1$
- }
- return result;
- }
-}
diff --git a/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java b/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java
deleted file mode 100644
index bb9cb75..0000000
--- a/core/source/org/openoffice/ide/eclipse/core/utils/ZipContent.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*************************************************************************
- *
- * $RCSfile: ZipContent.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.utils;
-
-import java.io.BufferedInputStream;
-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;
-
-/**
- * This class is a small structure containing the data to ZIP for one file.
- *
- * @author cedricbosdo
- *
- */
-public class ZipContent {
-
- private static final int BUFFER_SIZE = 2048;
-
- protected IResource mResource;
-
- protected String mEntryName;
-
- /**
- * Constructor.
- *
- * @param pEntryName the name in the ZIP file
- * @param pResource the file to put in the ZIP file.
- */
- public ZipContent( String pEntryName, IResource pResource ) {
- mResource = pResource;
- mEntryName = pEntryName;
- }
-
- /**
- * @return the file represented by the {@link ZipEntry}
- */
- public IResource getFile() {
- return mResource;
- }
-
- /**
- * Write the ZIP entry to the given Zip output stream.
- *
- * @param pOutput the stream where to write the entry data.
- */
- public void writeContentToZip(ZipOutputStream pOutput) {
-
- BufferedInputStream origin = null;
- try {
- FileInputStream fi = new FileInputStream( mResource.getLocation().toFile() );
- origin = new BufferedInputStream(fi, BUFFER_SIZE);
-
- ZipEntry entry = new ZipEntry(mEntryName);
- pOutput.putNextEntry(entry);
-
- int count;
- byte data[] = new byte[BUFFER_SIZE];
-
- while ((count = origin.read(data, 0, BUFFER_SIZE)) != -1) {
- pOutput.write(data, 0, count);
- }
-
- pOutput.closeEntry();
-
- } catch (IOException e) {
- PluginLogger.warning("Problem when writing file to zip: " + mEntryName); //$NON-NLS-1$
- } finally {
- // Close the file entry stream
- try {
- if (origin != null) {
- origin.close();
- }
- } catch (IOException e) {
- }
- }
- }
-}
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 38d7c7d..1389b42 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/PackageExportWizard.java
@@ -43,9 +43,9 @@ import org.eclipse.ui.IWorkbench;
import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.ProjectsManager;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
import org.openoffice.ide.eclipse.core.wizards.pages.ManifestExportPage;
import org.openoffice.ide.eclipse.core.wizards.pages.UnoPackageExportPage;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Class for the new OXT export wizard.
@@ -90,9 +90,11 @@ public class PackageExportWizard extends Wizard implements IExportWizard {
mManifestPage.createBuildScripts( model );
// Export the package
- File out = model.close( null );
+ File out = model.close( );
finished = out != null;
+ mMainPage.refreshProject();
+
if ( mHasNewDialogSettings ) {
IDialogSettings workbenchSettings = OOEclipsePlugin.getDefault().getDialogSettings();
IDialogSettings section = workbenchSettings.getSection(DIALOG_SETTINGS_KEY);
@@ -101,7 +103,6 @@ public class PackageExportWizard extends Wizard implements IExportWizard {
}
mMainPage.saveWidgetValues();
-
}
return finished;
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
index f29f55c..a8e79f6 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java
@@ -60,8 +60,9 @@ import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.language.LanguageExportPart;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
import org.openoffice.ide.eclipse.core.wizards.Messages;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Second page of the new OXT package export wizard.
@@ -128,12 +129,12 @@ public class ManifestExportPage extends WizardPage {
public void configureManifest(UnoPackage pModel) {
IFile saveFile = getSaveManifestFile( );
if ( saveFile != null ) {
- pModel.setSaveManifestFile( saveFile );
+ pModel.setSaveManifestFile( SystemHelper.getFile( saveFile ) );
}
IFile readFile = getReadManifestFile( );
if ( readFile != null ) {
- pModel.setReadManifestFile( readFile );
+ pModel.setReadManifestFile( SystemHelper.getFile( readFile ) );
}
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
index a5071c7..8650fdc 100644
--- a/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java
@@ -33,7 +33,6 @@ package org.openoffice.ide.eclipse.core.wizards.pages;
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import org.eclipse.core.resources.IContainer;
@@ -43,11 +42,8 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -60,6 +56,7 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.internal.ide.DialogUtil;
@@ -74,9 +71,10 @@ import org.openoffice.ide.eclipse.core.model.IUnoidlProject;
import org.openoffice.ide.eclipse.core.model.ProjectsManager;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.language.ILanguageBuilder;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
+import org.openoffice.ide.eclipse.core.model.utils.SystemHelper;
import org.openoffice.ide.eclipse.core.utils.FilesFinder;
import org.openoffice.ide.eclipse.core.wizards.Messages;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* First page of the new UNO extension export wizard.
@@ -352,7 +350,7 @@ public class UnoPackageExportPage extends WizardPage {
hidden |= pRes.getName().startsWith( "." ); //$NON-NLS-1$
// Hide files which are always included in the package
- hidden |= pRes.getName().equals( IUnoidlProject.DESCRIPTION_FILENAME);
+ hidden |= pRes.getName().equals( IUnoidlProject.DESCRIPTION_FILENAME );
hidden |= pRes.getName().equals( "MANIFEST.MF" ); //$NON-NLS-1$
hidden |= pRes.getName().equals( "manifest.xml" ); //$NON-NLS-1$
hidden |= pRes.getName().equals( "types.rdb" ); //$NON-NLS-1$
@@ -461,33 +459,39 @@ public class UnoPackageExportPage extends WizardPage {
}
if ( doit ) {
+ File prjFile = SystemHelper.getFile( mSelectedProject );
+
// Export the library
- IPath libraryPath = null;
+ IFile library = null;
ILanguageBuilder langBuilder = mSelectedProject.getLanguage().getLanguageBuidler();
- libraryPath = langBuilder.createLibrary( mSelectedProject );
+ library = langBuilder.createLibrary( mSelectedProject );
// Create the package model
pack = UnoidlProjectHelper.createMinimalUnoPackage( mSelectedProject, destFile );
- pack.addToClean( libraryPath );
+ pack.addToClean( SystemHelper.getFile( library ) );
IFile descrFile = mSelectedProject.getFile( IUnoidlProject.DESCRIPTION_FILENAME );
if ( descrFile.exists() ) {
- pack.addContent( descrFile );
+ File resFile = SystemHelper.getFile( descrFile );
+ pack.addContent( UnoPackage.getPathRelativeToBase( resFile, prjFile ),
+ resFile );
}
// Add the additional content to the package
List<?> items = mResourceGroup.getAllWhiteCheckedItems();
for (Object item : items) {
if ( item instanceof IResource ) {
- IResource res = (IResource)item;
- pack.addContent( res );
+ File resFile = SystemHelper.getFile( (IResource)item );
+ pack.addContent( UnoPackage.getPathRelativeToBase( resFile, prjFile ),
+ resFile );
}
}
- // Create the deployer instance
+ // Run the deployer
if ( mAutodeployBox.getSelection() ) {
DeployerJob job = new DeployerJob( mSelectedProject.getOOo(), destFile );
- pack.setDeployJob( job );
+
+ Display.getDefault().asyncExec( job );
}
}
} catch ( Exception e ) {
@@ -498,6 +502,19 @@ public class UnoPackageExportPage extends WizardPage {
}
/**
+ * Refresh the selected project.
+ */
+ public void refreshProject() {
+ try {
+ // Refresh the project and return the status
+ String prjName = mSelectedProject.getName();
+ IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject( prjName );
+ prj.refreshLocal( IResource.DEPTH_INFINITE, null );
+ } catch (CoreException e) {
+ }
+ }
+
+ /**
* Thread performing the package deployment into OpenOffice.org.
*
* @author Cédric Bosdonnat
diff --git a/cpp/META-INF/MANIFEST.MF b/cpp/META-INF/MANIFEST.MF
index f038538..d34e5c3 100644
--- a/cpp/META-INF/MANIFEST.MF
+++ b/cpp/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.1",
org.eclipse.cdt.ui;bundle-version="5.1.0",
org.eclipse.ui.ide;bundle-version="3.5.0",
- org.eclipse.ui.cheatsheets
+ org.eclipse.ui.cheatsheets,
+ org.openoffice.ide.packager.core;bundle-version="0.1.0"
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java b/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java
index 1afdb6f..ea2539e 100644
--- a/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java
+++ b/cpp/source/org/openoffice/ide/eclipse/cpp/CppBuilder.java
@@ -37,6 +37,7 @@ import java.io.LineNumberReader;
import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
import org.eclipse.cdt.core.settings.model.ICSettingEntry;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -48,7 +49,7 @@ import org.openoffice.ide.eclipse.core.model.ProjectsManager;
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.plugin.core.model.UnoPackage;
/**
* Helper class for the C++ UNO internal build tools.
@@ -63,7 +64,7 @@ public class CppBuilder implements ILanguageBuilder {
/**
* {@inheritDoc}
*/
- public IPath createLibrary(IUnoidlProject pUnoProject) throws Exception {
+ public IFile createLibrary(IUnoidlProject pUnoProject) throws Exception {
// TODO Auto-generated method stub
return null;
}
diff --git a/java/META-INF/MANIFEST.MF b/java/META-INF/MANIFEST.MF
index d74c71c..6db7b2c 100644
--- a/java/META-INF/MANIFEST.MF
+++ b/java/META-INF/MANIFEST.MF
@@ -16,6 +16,7 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.jface.text,
org.eclipse.jdt.junit;bundle-version="3.5.0",
org.eclipse.ui.ide,
- org.eclipse.ui.cheatsheets
+ org.eclipse.ui.cheatsheets,
+ org.openoffice.ide.packager.core;bundle-version="0.1.0"
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
index 65cfd05..9b8ee1b 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
@@ -73,9 +73,10 @@ import org.openoffice.ide.eclipse.core.model.ProjectsManager;
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.model.utils.SystemHelper;
import org.openoffice.ide.eclipse.java.build.FilesVisitor;
import org.openoffice.ide.eclipse.java.build.UnoManifestProvider;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* The language builder implementation for Java.
@@ -99,7 +100,7 @@ public class JavaBuilder implements ILanguageBuilder {
/**
* {@inheritDoc}
*/
- public IPath createLibrary(IUnoidlProject pUnoProject) throws Exception {
+ public IFile createLibrary(IUnoidlProject pUnoProject) throws Exception {
IFile jarFile = ((JavaProjectHandler)mLanguage.getProjectHandler()).getJarFile(pUnoProject);
@@ -130,7 +131,7 @@ public class JavaBuilder implements ILanguageBuilder {
IJarExportRunnable runnable = description.createJarExportRunnable( null );
runnable.run( new NullProgressMonitor() );
- return jarFile.getLocation();
+ return jarFile;
}
@@ -253,17 +254,25 @@ public class JavaBuilder implements ILanguageBuilder {
* {@inheritDoc}
*/
public void fillUnoPackage(UnoPackage pUnoPackage, IUnoidlProject pUnoPrj) {
-
+
// Add the component Jar file
JavaProjectHandler handler = (JavaProjectHandler)mLanguage.getProjectHandler();
- pUnoPackage.addComponentFile(handler.getJarFile(pUnoPrj), "Java"); //$NON-NLS-1$
+ File libFile = SystemHelper.getFile( handler.getJarFile(pUnoPrj) );
+ File prjFile = SystemHelper.getFile( pUnoPrj );
+
+ pUnoPackage.addComponentFile(
+ UnoPackage.getPathRelativeToBase( libFile, prjFile ),
+ libFile, "Java"); //$NON-NLS-1$
// Add all the jar dependencies
IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pUnoPrj.getName());
IJavaProject javaPrj = JavaCore.create(prj);
ArrayList<IFile> libs = getLibs(javaPrj);
for (IFile lib : libs) {
- pUnoPackage.addTypelibraryFile(lib, "Java"); //$NON-NLS-1$
+ File jarFile = SystemHelper.getFile( lib );
+ pUnoPackage.addTypelibraryFile(
+ UnoPackage.getPathRelativeToBase( jarFile, prjFile ),
+ jarFile, "Java"); //$NON-NLS-1$
}
}
diff --git a/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
index 29506e8..5d7edb9 100644
--- a/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
+++ b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
@@ -41,9 +41,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.openoffice.ide.eclipse.core.model.language.LanguageExportPart;
-import org.openoffice.ide.eclipse.core.model.pack.UnoPackage;
import org.openoffice.ide.eclipse.core.wizards.pages.ManifestExportPage;
import org.openoffice.ide.eclipse.java.Messages;
+import org.openoffice.plugin.core.model.UnoPackage;
/**
* Dialog part for the Ant scripts export configuration.
diff --git a/packager/.classpath b/packager/.classpath
new file mode 100644
index 0000000..c5d47ad
--- /dev/null
+++ b/packager/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry exported="true" kind="lib" path="ooo-plugin-packager-core-0.1.0-SNAPSHOT.jar" sourcepath="/ooo-plugin-packager-core/src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/packager/.gitignore b/packager/.gitignore
new file mode 100644
index 0000000..d392f0e
--- /dev/null
+++ b/packager/.gitignore
@@ -0,0 +1 @@
+*.jar
diff --git a/packager/.project b/packager/.project
new file mode 100644
index 0000000..b36f88f
--- /dev/null
+++ b/packager/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.openoffice.ide.packager.core</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/packager/.settings/org.eclipse.jdt.core.prefs b/packager/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..f213c0b
--- /dev/null
+++ b/packager/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Wed Sep 15 16:46:57 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/packager/META-INF/MANIFEST.MF b/packager/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..a2ebd5b
--- /dev/null
+++ b/packager/META-INF/MANIFEST.MF
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ooo-plugin-packager core
+Bundle-SymbolicName: org.openoffice.ide.packager.core
+Bundle-Version: 0.1.0
+Bundle-Vendor: Cédric Bosdonnat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: ooo-plugin-packager-core-0.1.0-SNAPSHOT.jar,
+ .
+Export-Package: org.openoffice.plugin.core.model,
+ org.openoffice.plugin.core.utils
+Require-Bundle: org.apache.commons.lang;bundle-version="2.3.0"
diff --git a/packager/build.properties b/packager/build.properties
new file mode 100644
index 0000000..9abde93
--- /dev/null
+++ b/packager/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ ooo-plugin-packager-core-0.1.0-SNAPSHOT.jar
diff --git a/packager/build/MANIFEST.MF.in b/packager/build/MANIFEST.MF.in
new file mode 100644
index 0000000..ac1cb47
--- /dev/null
+++ b/packager/build/MANIFEST.MF.in
@@ -0,0 +1,13 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ooo-plugin-packager core
+Bundle-SymbolicName: org.openoffice.ide.packager.core
+Bundle-Version: @VERSION@
+Bundle-Vendor: Cédric Bosdonnat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: ooo-plugin-packager-core-0.1.0-SNAPSHOT.jar,
+ .
+Export-Package: org.openoffice.plugin.core.model,
+ org.openoffice.plugin.core.utils
+Require-Bundle: org.apache.commons.lang;bundle-version="2.3.0"
diff --git a/packager/build/build.properties b/packager/build/build.properties
new file mode 100644
index 0000000..d99e73e
--- /dev/null
+++ b/packager/build/build.properties
@@ -0,0 +1,4 @@
+#Wed Apr 26 20:26:48 CEST 2006
+packager.plugin.version=1.0.0
+debug=true
+packager.git.repo=git://github.com/fredericmorin/ooo-plugin-packager.git
diff --git a/packager/build/build.xml b/packager/build/build.xml
new file mode 100644
index 0000000..2fc4fb7
--- /dev/null
+++ b/packager/build/build.xml
@@ -0,0 +1,94 @@
+<?xml version="1.0"?>
+
+<project name="packager" default="packager.error">
+
+
+ <target name="packager.error">
+ <fail>Wrong target!
+
+ This script should not be executed directly.
+ Please, use the one in the build project
+ </fail>
+ </target>
+
+
+ <target name="init-env">
+ <dirname property="packager.basedir" file="${ant.file.packager}/.."/>
+
+ <loadproperties srcfile="${packager.basedir}/build/build.properties" />
+
+ <property name="packager.out.path" value="${packager.basedir}/bin/ant" />
+ <property name="packager.out.classes" value="${packager.out.path}/classes"/>
+ <property name="packager.sources" value="${packager.out.path}/source"/>
+
+ <path id="packager.dependencies.path">
+ <fileset dir="${eclipse.home}/plugins/">
+ <include name="org.apache.commons.lang*.jar"/>
+ </fileset>
+ </path>
+
+ <mkdir dir="${packager.out.path}/features" />
+ <mkdir dir="${packager.out.path}/plugins" />
+ <mkdir dir="${packager.out.classes}" />
+
+ <condition property="packager.sources.cloned">
+ <resourceexists>
+ <file file="${packager.sources}"/>
+ </resourceexists>
+ </condition>
+ </target>
+
+ <target name="purge">
+ <dirname property="packager.basedir" file="${ant.file.packager}/.."/>
+ <property name="packager.out.path" value="${packager.basedir}/bin/ant" />
+ <delete dir="${packager.out.path}" />
+ </target>
+
+ <!--
+ <target name="packager.compile" depends="init-env">
+ <javac srcdir="${packager.sources}" destdir="${packager.out.classes}"
+ target="1.5" source="1.5"
+ debug="${debug}"
+ classpathref="packager.dependencies.path"
+ excludes="**/unittests/**"/>
+ </target>
+ -->
+
+ <target name="clone-sources" depends="init-env" unless="packager.sources.cloned">
+ <exec executable="git" dir="${packager.out.path}">
+ <arg line="clone ${packager.git.repo}"/>
+ <arg line="source"/>
+ </exec>
+ </target>
+
+ <target name="pull-sources" depends="init-env, clone-sources" if="packager.sources.cloned">
+ <exec executable="git" dir="${packager.sources}">
+ <arg line="pull -r"/>
+ </exec>
+ </target>
+
+ <target name="compile-jar" depends="init-env, clone-sources, pull-sources">
+
+ </target>
+
+
+ <target name="packager.plugin" depends="compile-jar">
+ <copy file="${packager.basedir}/build/MANIFEST.MF.in"
+ tofile="${packager.out.path}/MANIFEST.MF" />
+ <replace file="${packager.out.path}/MANIFEST.MF"
+ token="@VERSION@" value="${packager.plugin.version}" />
+
+ <jar destfile="${packager.out.path}/plugins/${package.prefix}.java_${packager.plugin.version}.jar"
+ manifest="${packager.out.path}/MANIFEST.MF">
+ <zipfileset prefix="" dir="${packager.sources}">
+ <exclude name="**/*.java"/>
+ </zipfileset>
+ <zipfileset prefix="" dir="${packager.out.classes}"/>
+
+ <zipfileset prefix="icons" dir="${packager.basedir}/icons"/>
+ <zipfileset prefix="" file="${packager.basedir}/plugin.xml" />
+ </jar>
+ </target>
+
+</project>
+