summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
authorcedricbosdo <cedricbosdo>2008-12-13 13:42:47 +0000
committercedricbosdo <cedricbosdo>2008-12-13 13:42:47 +0000
commit7054b2177ef1d9692d1be97fb0d0a27ff5ebcdaf (patch)
tree9f2ae938f28c9f6d260de989d905c46717d72047 /java
parent7ec7735004cada6a353fe97c598aa5d619e94b80 (diff)
Fixed Eclipse integration for OOo 3.x 3 layer install
Diffstat (limited to 'java')
-rw-r--r--java/build/build.properties3
-rw-r--r--java/build/build.xml169
-rw-r--r--java/build/feature.xml.in2
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java26
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java35
-rw-r--r--java/source/org/openoffice/ide/eclipse/java/build/OooClasspathContainerInitializer.java18
6 files changed, 125 insertions, 128 deletions
diff --git a/java/build/build.properties b/java/build/build.properties
index d928654..01778ef 100644
--- a/java/build/build.properties
+++ b/java/build/build.properties
@@ -1,2 +1,3 @@
#Wed Apr 26 20:26:48 CEST 2006
-version=1.0.1
+java.plugin.version=1.0.1
+debug=true \ No newline at end of file
diff --git a/java/build/build.xml b/java/build/build.xml
index ff6fd1d..61f2ac5 100644
--- a/java/build/build.xml
+++ b/java/build/build.xml
@@ -2,9 +2,9 @@
<!-- ======================================================================
* $RCSfile: build.xml,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: cedricbosdo $ $Date: 2007/08/15 12:27:16 $
+ * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:43:02 $
*
* The Contents of this file are made available subject to the terms of
* the GNU Lesser General Public License Version 2.1
@@ -40,120 +40,93 @@
* Contributor(s): Cedric Bosdonnat
====================================================================== -->
-<project name="org.openoffice.ide.eclipse.java" default="site">
- <description>
- This project provides a new plugin for Eclipse to help
- OpenOffice.org development
- </description>
+<project name="java" default="java.error">
- <loadproperties srcfile="build.properties" />
- <property name="prj.path" value=".." />
- <property name="out.path" value="${prj.path}/bin/ant" />
+ <target name="java.error">
+ <fail>Wrong target!
+
+ This script should not be executed directly.
+ Please, use the one in the build project
+ </fail>
+ </target>
- <path id="dependencies.path">
- <pathelement location="${prj.path}/../core/bin/ant/plugin/"/>
-
- <fileset dir="${eclipse.home}/plugins/">
- <include name="org.eclipse*.jar"/>
- </fileset>
- </path>
- <target name="clean"
- description="Cleans all the temporary files">
+ <target name="init-env">
+ <dirname property="java.basedir" file="${ant.file.java}/.."/>
+
+ <loadproperties srcfile="${java.basedir}/build/build.properties" />
- <delete dir="${out.path}/plugin" />
- <delete dir="${out.path}/feature" />
+ <property name="java.out.path" value="${java.basedir}/bin/ant" />
+ <property name="java.out.classes" value="${java.out.path}/classes"/>
+ <property name="java.sources" value="${java.basedir}/source"/>
+
+ <path id="java.dependencies.path">
+ <pathelement location="${core.out.classes}"/>
+
+ <fileset dir="${eclipse.home}/plugins/">
+ <include name="org.eclipse*.jar"/>
+ </fileset>
+ </path>
+
+ <mkdir dir="${java.out.path}/features" />
+ <mkdir dir="${java.out.path}/plugins" />
+ <mkdir dir="${java.out.classes}" />
</target>
- <target name="purge"
- description="Removes all the generated files">
- <delete dir="${out.path}" />
+ <target name="clean">
+ <delete dir="${java.out.classes}" />
+ </target>
+
+ <target name="purge" depends="clean">
+ <delete dir="${java.out.path}" />
</target>
- <!-- =================================
- target: site
- ================================= -->
- <target name="site"
- depends="plugin, feature"
- description="builds and delivers the plugin">
-
- <copy file="${prj.path}/build/site_fragment.xml.in"
- tofile="${out.path}/site_fragment.xml" />
- <replace file="${out.path}/site_fragment.xml"
- token="@VERSION@" value="${version}" />
-
- <echo>
- =================================================
-
- The java plugin and feature are created. Please
- run the build.xml file in the build project in
- order to generate the whole ooeclipseintegration
- update site.
-
- =================================================
- </echo>
-
+ <target name="site" depends="java.plugin, java.feature">
+ <copy file="${java.basedir}/build/site_fragment.xml.in"
+ tofile="${java.out.path}/site_fragment.xml" />
+ <replace file="${java.out.path}/site_fragment.xml"
+ token="@VERSION@" value="${java.plugin.version}" />
</target>
- <!-- - - - - - - - - target: feature - - - - - - - - - - - - -->
- <target name="feature" depends="plugin">
-
- <mkdir dir="${out.path}/features" />
-
+ <target name="java.feature">
<!-- Replace the @VERSION@ tokens to create the feature.xml file -->
- <mkdir dir="${out.path}/feature" />
- <copy file="${prj.path}/build/feature.xml.in"
- tofile="${out.path}/feature/feature.xml" />
- <replace file="${out.path}/feature/feature.xml"
- token="@VERSION@" value="${version}" />
-
- <jar destfile="${out.path}/features/org.openoffice.ide.eclipse.java_${version}.jar"
- basedir="${out.path}/feature"
- includes="feature.xml" />
+ <copy file="${java.basedir}/build/feature.xml.in"
+ tofile="${java.out.path}/feature.xml" />
+ <replace file="${java.out.path}/feature.xml"
+ token="@VERSION@" value="${java.plugin.version}" />
+ <replace file="${java.out.path}/feature.xml"
+ token="@CORE_VERSION@" value="${core.plugin.version}" />
+ <jar destfile="${java.out.path}/features/${package.prefix}.java_${java.plugin.version}.jar">
+ <zipfileset prefix="" file="${java.out.path}/feature.xml"/>
+ </jar>
</target>
- <!-- - - - - - - - - target: plugin - - - - - - - - - - - - -->
- <target name="plugin">
-
- <mkdir dir="${out.path}/plugins" />
- <mkdir dir="${out.path}/plugin" />
- <javac srcdir="${prj.path}/source" destdir="${out.path}/plugin"
- target="1.5" source="1.5" debug="${debug}"
- classpathref="dependencies.path"
+ <target name="java.compile" depends="init-env">
+ <javac srcdir="${java.sources}" destdir="${java.out.classes}"
+ target="1.5" source="1.5"
+ debug="${debug}"
+ classpathref="java.dependencies.path"
excludes="**/unittests/**"/>
+ </target>
+
+ <target name="java.plugin" depends="java.compile">
+ <copy file="${java.basedir}/build/MANIFEST.MF.in"
+ tofile="${java.out.path}/MANIFEST.MF" />
+ <replace file="${java.out.path}/MANIFEST.MF"
+ token="@VERSION@" value="${java.plugin.version}" />
- <copy todir="${out.path}/plugin">
- <fileset dir="${prj.path}/source">
- <include name="**/*.properties"/>
- <include name="**/*.tpl"/>
- </fileset>
- </copy>
-
- <!-- Copy the important files in the directory -->
-
- <copy file="${prj.path}/build/MANIFEST.MF.in"
- tofile="${out.path}/plugin/META-INF/MANIFEST.MF" />
- <replace file="${out.path}/plugin/META-INF/MANIFEST.MF"
- token="@VERSION@" value="${version}" />
-
- <copy todir="${out.path}/plugin/icons">
- <fileset dir="${prj.path}/icons">
- <include name="**/*"/>
- </fileset>
- </copy>
+ <jar destfile="${java.out.path}/plugins/${package.prefix}.java_${java.plugin.version}.jar"
+ manifest="${java.out.path}/MANIFEST.MF">
+ <zipfileset prefix="" dir="${java.sources}">
+ <exclude name="**/*.java"/>
+ </zipfileset>
+ <zipfileset prefix="" dir="${java.out.classes}"/>
- <copy file="${prj.path}/plugin.xml"
- tofile="${out.path}/plugin/plugin.xml" />
-
-
- <!-- Creating the plugin jar file -->
- <jar destfile="${out.path}/plugins/org.openoffice.ide.eclipse.java_${version}.jar"
- basedir="${out.path}/plugin"
- manifest="${out.path}/plugin/META-INF/MANIFEST.MF"
- includes="**/*" />
-
+ <zipfileset prefix="icons" dir="${java.basedir}/icons"/>
+ <zipfileset prefix="" file="${java.basedir}/plugin.xml" />
+ </jar>
</target>
</project>
diff --git a/java/build/feature.xml.in b/java/build/feature.xml.in
index 9396bdc..644c33e 100644
--- a/java/build/feature.xml.in
+++ b/java/build/feature.xml.in
@@ -47,7 +47,7 @@ MA 02111-1307 USA
</url>
<requires>
- <import feature="org.openoffice.ide.eclipse.core" version="1.1.0"/>
+ <import feature="org.openoffice.ide.eclipse.core" version="@CORE_VERSION@"/>
</requires>
<plugin
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
index c58204d..6227d47 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaBuilder.java
@@ -2,9 +2,9 @@
*
* $RCSfile: JavaBuilder.java,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: cedricbosdo $ $Date: 2007/11/25 20:32:38 $
+ * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:43:02 $
*
* The Contents of this file are made available subject to the terms of
* the GNU Lesser General Public License Version 2.1
@@ -109,7 +109,7 @@ public class JavaBuilder implements ILanguageBuilder {
String relPath = lib.getPath().substring(prjPath.length() + 1);
classpath += relPath + " "; //$NON-NLS-1$
}
- if (!classpath.equals("")) {
+ if (!classpath.equals("")) { //$NON-NLS-1$
classpath = "Class-Path: " + classpath + "\r\n"; //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -188,16 +188,22 @@ public class JavaBuilder implements ILanguageBuilder {
if (null != pSdk && null != pOoo) {
- IPath ooTypesPath = new Path (pOoo.getTypesPath());
+ String[] paths = pOoo.getTypesPath();
+ String oooTypesArgs = ""; //$NON-NLS-1$
+ for (String path : paths) {
+ IPath ooTypesPath = new Path (path);
+ oooTypesArgs += " -X\"" + ooTypesPath.toOSString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
// TODO What if the user creates other root modules ?
String firstModule = pRootModule.split("::")[0]; //$NON-NLS-1$
String command = "javamaker -T" + firstModule + //$NON-NLS-1$
".* -nD -Gc -BUCR " + //$NON-NLS-1$
- "-O \"" + pBuildFolder.getAbsolutePath() + "\" \"" + //$NON-NLS-1$
+ "-O \"" + pBuildFolder.getAbsolutePath() + "\" \"" + //$NON-NLS-1$ //$NON-NLS-2$
pTypesFile.getAbsolutePath() + "\" " + //$NON-NLS-1$
- "-X\"" + ooTypesPath.toOSString() + "\""; //$NON-NLS-1$ //$NON-NLS-2$
+ oooTypesArgs;
IUnoidlProject unoprj = ProjectsManager.getProject(pPrj.getName());
Process process = pSdk.runTool(unoprj,command, pMonitor);
@@ -206,7 +212,7 @@ public class JavaBuilder implements ILanguageBuilder {
new InputStreamReader(process.getErrorStream()));
// Only for debugging purpose
- if (PluginLogger.isLevel(LogLevels.DEBUG)) { //$NON-NLS-1$
+ if (PluginLogger.isLevel(LogLevels.DEBUG)) {
String line = lineReader.readLine();
while (null != line) {
@@ -292,14 +298,14 @@ public class JavaBuilder implements ILanguageBuilder {
// Add the component Jar file
JavaProjectHandler handler = (JavaProjectHandler)mLanguage.getProjectHandler();
- pUnoPackage.addComponentFile(handler.getJarFile(pUnoPrj), "Java");
+ pUnoPackage.addComponentFile(handler.getJarFile(pUnoPrj), "Java"); //$NON-NLS-1$
// Add all the jar dependencies
IProject prj = ResourcesPlugin.getWorkspace().getRoot().getProject(pUnoPrj.getName());
IJavaProject javaPrj = JavaCore.create(prj);
Vector<File> libs = getLibs(javaPrj);
for (File lib : libs) {
- pUnoPackage.addTypelibraryFile(lib, "Java");
+ pUnoPackage.addTypelibraryFile(lib, "Java"); //$NON-NLS-1$
}
}
@@ -325,7 +331,7 @@ public class JavaBuilder implements ILanguageBuilder {
*/
IPath path = entry.getPath();
if (!new File(path.toOSString()).exists() && path.isAbsolute() &&
- path.toString().startsWith("/" + pJavaPrj.getProject().getName())) {
+ path.toString().startsWith("/" + pJavaPrj.getProject().getName())) { //$NON-NLS-1$
// Relative to the project
File libFile = prjPath.append(path.removeFirstSegments(1)).toFile();
if (libFile.isFile()) {
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java b/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
index d666790..9283018 100644
--- a/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
+++ b/java/source/org/openoffice/ide/eclipse/java/JavaProjectHandler.java
@@ -2,9 +2,9 @@
*
* $RCSfile: JavaProjectHandler.java,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: cedricbosdo $ $Date: 2007/12/26 14:40:19 $
+ * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:43:02 $
*
* The Contents of this file are made available subject to the terms of
* the GNU Lesser General Public License Version 2.1
@@ -188,9 +188,9 @@ public class JavaProjectHandler implements IProjectHandler {
if (pService.startsWith(prefix)) {
String localName = pService.substring(prefix.length());
- implementationName = prefix + "." + comp + localName + "Impl";
+ implementationName = prefix + "." + comp + localName + "Impl"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
- throw new Exception("Cannot find implementation name for service: " + pService);
+ throw new Exception("Cannot find implementation name for service: " + pService); //$NON-NLS-1$
}
return implementationName;
@@ -247,7 +247,7 @@ public class JavaProjectHandler implements IProjectHandler {
* @return a handle to the jar file of the project
*/
public File getJarFile(IUnoidlProject pProject) {
- String filename = pProject.getName().replace(" ", "") + ".jar"; //$NON-NLS-1$
+ String filename = pProject.getName().replace(" ", "") + ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
return pProject.getFile(filename).getLocation().toFile();
}
@@ -273,17 +273,20 @@ public class JavaProjectHandler implements IProjectHandler {
public static Vector<Path> findJarsFromPath(IOOo pOoo) {
Vector<Path> jarsPath = new Vector<Path>();
- Path folderPath = new Path(pOoo.getClassesPath());
- File programFolder = folderPath.toFile();
-
- String[] content = programFolder.list();
- for (int i = 0, length = content.length; i < length; i++) {
- String contenti = content[i];
- if (isKeptJar(contenti)) {
- Path jariPath = new Path (
- pOoo.getClassesPath() + "/" + contenti); //$NON-NLS-1$
- jarsPath.add(jariPath);
- }
+ String[] paths = pOoo.getClassesPath();
+ for (String path : paths) {
+ Path folderPath = new Path(path);
+ File programFolder = folderPath.toFile();
+
+ String[] content = programFolder.list();
+ for (int i = 0, length = content.length; i < length; i++) {
+ String contenti = content[i];
+ if (isKeptJar(contenti)) {
+ Path jariPath = new Path (
+ path + "/" + contenti); //$NON-NLS-1$
+ jarsPath.add(jariPath);
+ }
+ }
}
return jarsPath;
diff --git a/java/source/org/openoffice/ide/eclipse/java/build/OooClasspathContainerInitializer.java b/java/source/org/openoffice/ide/eclipse/java/build/OooClasspathContainerInitializer.java
index a5003cf..cdc2496 100644
--- a/java/source/org/openoffice/ide/eclipse/java/build/OooClasspathContainerInitializer.java
+++ b/java/source/org/openoffice/ide/eclipse/java/build/OooClasspathContainerInitializer.java
@@ -2,9 +2,9 @@
*
* $RCSfile: OooClasspathContainerInitializer.java,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: cedricbosdo $ $Date: 2007/12/26 14:40:18 $
+ * last change: $Author: cedricbosdo $ $Date: 2008/12/13 13:43:01 $
*
* The Contents of this file are made available subject to the terms of
* the GNU Lesser General Public License Version 2.1
@@ -82,4 +82,18 @@ public class OooClasspathContainerInitializer extends
JavaCore.setClasspathContainer(pContainerPath, projects, containers, null);
}
}
+
+ /**
+ * Always allow container modification: it could be necessary to add additional OOo
+ * jars or set the sources path.
+ *
+ * @param containerPath the path of the container
+ * @param project the project for which to change the container
+ *
+ * @return always <code>true</code>
+ */
+ @Override
+ public boolean canUpdateClasspathContainer(IPath containerPath, IJavaProject project) {
+ return true;
+ }
}