[ooo-build-commit] ooeclipse: Branch 'master' - 3 commits
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Sun Dec 12 14:48:21 PST 2010
java/.classpath | 1
java/build.xml | 2
java/source/org/openoffice/ide/eclipse/java/export/JavaExportPageControl.java | 84 ++++++++
java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java | 43 ++--
java/source/org/openoffice/ide/eclipse/java/export/build.xml | 94 +++-------
java/source/org/openoffice/ide/eclipse/java/test/JavaExportPageControlTest.java | 64 ++++++
packager/build.properties | 8
7 files changed, 216 insertions(+), 80 deletions(-)
New commits:
commit 9f476475e9c186f468885772877dea6eb63cbc2e
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Sun Dec 12 23:46:26 2010 +0100
[java] Simplified the future template ant script: no support for OOo 2.x
diff --git a/java/source/org/openoffice/ide/eclipse/java/export/build.xml b/java/source/org/openoffice/ide/eclipse/java/export/build.xml
index 12af04a..2e63008 100644
--- a/java/source/org/openoffice/ide/eclipse/java/export/build.xml
+++ b/java/source/org/openoffice/ide/eclipse/java/export/build.xml
@@ -1,45 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- * OpenOffice.org extension for syntax highlighting
- * Copyright (C) 2008 Cédric Bosdonnat cedricbosdo at openoffice.org
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
*
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
+ * 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 General Public License for more details.
*
- * 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
- * Library General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program.
+ * If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright: 2009 by Cédric Bosdonnat
*
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ * All Rights Reserved.
-->
<project name="COOoder" default="package-oxt" basedir="..">
- <target name="check-ooo-version">
- <property file="ant/build.properties"/>
-
- <property name="office.basis.dir" value="${office.install.dir}${file.separator}basis-link"/>
- <property name="office.ure.dir" value="${office.basis.dir}${file.separator}ure-link"/>
-
- <!-- test whether building against OOo3 or not -->
- <condition property="office.version3" value="true">
- <and>
- <available file="${office.basis.dir}" />
- <available file="${office.ure.dir}"/>
- </and>
- </condition>
- </target>
-
- <target name="init-env-ooo3" depends="check-ooo-version" if="office.version3">
- <echo message="Initializing the properties for OpenOffice 3.0"/>
+ <target name="init-env">
+
+ <!-- set properties from libreoffice install and its SDK -->
+ <echo message="Initializing the properties for LibreOffice"/>
+
+ <property name="office.basis.dir" value="${office.install.dir}${file.separator}basis-link"/>
+ <property name="office.ure.dir" value="${office.basis.dir}${file.separator}ure-link"/>
<property name="office.libs.path" value="${office.install.dir}${file.separator}program${path.separator}${office.basis.dir}${file.separator}program${path.separator}${office.ure.dir}${file.separator}lib"/>
- <echo message="Office libs path: ${office.libs.path}"/>
+ <echo message="Office libs path: ${office.libs.path}"/>
<path id="office.class.path">
<fileset dir="${office.basis.dir}${file.separator}program${file.separator}classes">
@@ -55,23 +46,16 @@
<property name="office.offapi.rdb"
value="${office.basis.dir}${file.separator}program${file.separator}offapi.rdb"/>
- </target>
-
- <target name="init-env-ooo2" depends="check-ooo-version" unless="office.version3">
- <property name="office.libs.path" value="${office.install.dir}${file.separator}program"/>
-
- <path id="office.class.path">
- <fileset dir="${office.install.dir}${file.separator}program${file.separator}classes">
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <property name="office.unotypes.rdb"
- value="${office.install.dir}${file.separator}program${file.separator}types.rdb"/>
- </target>
-
- <target name="init-env" depends="init-env-ooo3, init-env-ooo2">
- <!-- set variables for the project structure -->
+
+ <property name="sdk.idl.dir" location="${sdk.dir}${file.separator}idl"/>
+ <property name="sdk.idlc" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}idlc"/>
+ <property name="sdk.regmerge" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}regmerge"/>
+ <property name="sdk.javamaker" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}javamaker"/>
+
+ <property environment="env"/>
+ <property name="office.tool.path" value="${env.PATH}${path.separator}${office.libs.path}"/>
+
+ <!-- set properties for the project structure -->
<property file=".unoproject"/>
<property file="package.properties"/>
<dirname property="project.dir" file="package.properties"/>
@@ -80,17 +64,7 @@
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="dist.dir" value="${build.dir}/dist"/>
- <!-- set variables from SDK and Office -->
- <echo message="setting up UNO environment ..."/>
-
-
- <property environment="env"/>
- <property name="office.tool.path" value="${env.PATH}${path.separator}${office.libs.path}"/>
-
- <property name="sdk.idl.dir" location="${sdk.dir}${file.separator}idl"/>
- <property name="sdk.idlc" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}idlc"/>
- <property name="sdk.regmerge" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}regmerge"/>
- <property name="sdk.javamaker" value="${sdk.dir}${file.separator}${sdk.bin.dir}${file.separator}javamaker"/>
+ <!-- set properties for the output structure -->
<property name="uno.package.name" value="${project.dir}${file.separator}${dist.dir}${file.separator}${ant.project.name}.oxt"/>
<property name="src.dir.absolute" value="${project.dir}${project.srcdir}"/>
@@ -102,6 +76,8 @@
<property name="idl.rdb.name" value="types.rdb"/>
<property name="idl.rdb.fullpath" value="${idl.out.rdb}${file.separator}${idl.rdb.name}"/>
+ <!-- create a few empty directories -->
+
<mkdir dir="${build.dir}" />
<mkdir dir="${idl.out}"/>
<mkdir dir="${idl.out.urd}"/>
commit 50f8b27a6da3555c11167259d26b09da575a1a42
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Sun Dec 12 23:45:57 2010 +0100
[packager] Fixed Eclipse warnings in the build.properties
diff --git a/packager/build.properties b/packager/build.properties
index a7395f8..15c4e3c 100644
--- a/packager/build.properties
+++ b/packager/build.properties
@@ -1,7 +1,9 @@
output.. = bin/
bin.includes = META-INF/,\
bin/org/,\
- source/ooo-plugin-packager-core/src/main/java/
+ source/ooo-plugin-packager-core/src/main/java/,\
+ .
src.includes = bin/org/,\
- source/,\
- META-INF/
+ META-INF/,\
+ source/
+source.. = source/ooo-plugin-packager-core/src/main/java/
commit dc18d9ec13a0d2ea4c52255b4c7daef999ff1cad
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Sun Dec 12 23:45:22 2010 +0100
[java] Refactored the export page part to use a testable controller
diff --git a/java/.classpath b/java/.classpath
index d154f35..d6914fe 100644
--- a/java/.classpath
+++ b/java/.classpath
@@ -2,6 +2,7 @@
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="src" path="source"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/java/build.xml b/java/build.xml
index 5d666f0..b591473 100644
--- a/java/build.xml
+++ b/java/build.xml
@@ -90,7 +90,7 @@
target="1.5" source="1.5"
debug="${debug}"
classpathref="java.dependencies.path"
- excludes="**/unittests/**"/>
+ excludes="**/*Test.*"/>
</target>
<target name="java.plugin" depends="java.version, java.compile" unless="java.nobuild">
diff --git a/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPageControl.java b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPageControl.java
new file mode 100644
index 0000000..1bcee19
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPageControl.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program.
+ * If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright: 2010 by Cédric Bosdonnat
+ *
+ * All Rights Reserved.
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.java.export;
+
+/**
+ * Controller object for the fields of the {@link JavaExportPart} view.
+ *
+ * @author Cédric Bosdonnat
+ *
+ */
+public class JavaExportPageControl {
+
+ public static final String DEFAULT_ANT_FILENAME = "build.xml"; //$NON-NLS-1$
+
+ private boolean mSaveAntScript;
+ private String mSavePath;
+
+ private boolean mSavePathEnabled;
+
+ /**
+ * Default constructor.
+ */
+ public JavaExportPageControl() {
+ setSaveAntScript( false );
+ setSavePath( DEFAULT_ANT_FILENAME );
+ }
+
+ /**
+ * @param pSave the state of the save ant script box.
+ */
+ public void setSaveAntScript( boolean pSave ) {
+ mSaveAntScript = pSave;
+
+ // Don't activate the path field unless the save is selected
+ mSavePathEnabled = pSave;
+ }
+
+ /**
+ * @param pPath the path to set in the save field
+ */
+ public void setSavePath( String pPath ) {
+ mSavePath = pPath;
+ }
+
+ /**
+ * @return the state of the save ant script box
+ */
+ public boolean getSaveAntScript( ) {
+ return mSaveAntScript;
+ }
+
+ /**
+ * @return the value of the save path text field
+ */
+ public String getSavePath( ) {
+ return mSavePath;
+ }
+
+ /**
+ * @return whether the save path field is enabled
+ */
+ public boolean isSavePathEnabled( ) {
+ return mSavePathEnabled;
+ }
+}
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 5d7edb9..69fcbb9 100644
--- a/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
+++ b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
@@ -30,8 +30,9 @@
************************************************************************/
package org.openoffice.ide.eclipse.java.export;
-import org.eclipse.core.resources.IFile;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
@@ -53,19 +54,21 @@ import org.openoffice.plugin.core.model.UnoPackage;
*/
public class JavaExportPart extends LanguageExportPart {
- private static final String DEFAULT_ANT_FILENAME = "build.xml"; //$NON-NLS-1$
-
private Button mSaveScripts;
private Composite mNameRow;
private Label mNameRowLbl;
private Text mNameRowTxt;
-
+
+ private JavaExportPageControl mController;
+
/**
* {@inheritDoc}
*/
@Override
public void createControls(Composite pParent) {
+ mController = new JavaExportPageControl();
+
Label titleLbl = new Label( pParent, SWT.NONE );
titleLbl.setText( Messages.getString("JavaExportPart.Title") ); //$NON-NLS-1$
titleLbl.setLayoutData( new GridData( SWT.BEGINNING, SWT.BEGINNING, false, false ) );
@@ -82,15 +85,11 @@ public class JavaExportPart extends LanguageExportPart {
mSaveScripts.addSelectionListener( new SelectionListener() {
public void widgetSelected( SelectionEvent pE ) {
- boolean enabled = mSaveScripts.getSelection();
- mNameRowLbl.setEnabled( enabled );
- mNameRowTxt.setEnabled( enabled );
- IFile file = null;
- if ( enabled ) {
- file = getPage().getProject().getFile( ManifestExportPage.MANIFEST_FILENAME );
- }
- getPage().setManifestPath( file );
+ mController.setSaveAntScript( mSaveScripts.getSelection() );
+
+ mNameRowLbl.setEnabled( mController.isSavePathEnabled() );
+ mNameRowTxt.setEnabled( mController.isSavePathEnabled() );
}
public void widgetDefaultSelected( SelectionEvent pE ) {
@@ -107,12 +106,21 @@ public class JavaExportPart extends LanguageExportPart {
mNameRowLbl = new Label( mNameRow, SWT.NONE );
mNameRowLbl.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false ) );
mNameRowLbl.setText( Messages.getString("JavaExportPart.AntFile") ); //$NON-NLS-1$
- mNameRowLbl.setEnabled( false );
mNameRowTxt = new Text( mNameRow, SWT.BORDER | SWT.SINGLE );
mNameRowTxt.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
- mNameRowTxt.setText( DEFAULT_ANT_FILENAME );
- mNameRowTxt.setEnabled( false );
+ mNameRowTxt.addModifyListener( new ModifyListener() {
+
+ public void modifyText( ModifyEvent pEvent ) {
+ mController.setSavePath( mNameRowTxt.getText() );
+ }
+ });
+
+ // Load the default values
+ mSaveScripts.setSelection( mController.isSavePathEnabled() );
+ mNameRowTxt.setText( mController.getSavePath() );
+ mNameRowTxt.setEnabled( mController.isSavePathEnabled() );
+ mNameRowLbl.setEnabled( mController.isSavePathEnabled() );
}
/**
@@ -131,7 +139,8 @@ public class JavaExportPart extends LanguageExportPart {
*/
@Override
public void doFinish( UnoPackage pModel ) {
- // TODO Auto-generated method stub
-
+ if ( mController.getSaveAntScript() ) {
+ // TODO Generate the build script
+ }
}
}
diff --git a/java/source/org/openoffice/ide/eclipse/java/test/JavaExportPageControlTest.java b/java/source/org/openoffice/ide/eclipse/java/test/JavaExportPageControlTest.java
new file mode 100644
index 0000000..4066f8d
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/test/JavaExportPageControlTest.java
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * This library is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program.
+ * If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright: 2010 by Cédric Bosdonnat
+ *
+ * All Rights Reserved.
+ *
+ ************************************************************************/
+package org.openoffice.ide.eclipse.java.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.openoffice.ide.eclipse.java.export.JavaExportPageControl;
+
+/**
+ * Unit test for the Manifest export page part UI controller.
+ *
+ * @author Cedric Bosdonnat
+ *
+ */
+public class JavaExportPageControlTest {
+
+ /**
+ * Ensure that the default values are the ones expected.
+ */
+ @Test
+ public void testDefaults( ) {
+ JavaExportPageControl tested = new JavaExportPageControl();
+ assertFalse( "Save ant script shouldn't be default", tested.getSaveAntScript() );
+ assertFalse( "Save path shouldn't be enabled by default", tested.isSavePathEnabled() );
+ assertEquals( JavaExportPageControl.DEFAULT_ANT_FILENAME, tested.getSavePath() );
+ }
+
+ /**
+ * Test checking and unchecking the Save Ant script box.
+ */
+ @Test
+ public void testSetSaveAntScript() {
+ JavaExportPageControl tested = new JavaExportPageControl();
+
+ tested.setSaveAntScript( true );
+ assertTrue( "Save ant script selection not persisting", tested.getSaveAntScript() );
+ assertTrue( "Save path should be enabled when save ant script is checked", tested.isSavePathEnabled() );
+
+ tested.setSaveAntScript( false );
+ assertFalse( "Save ant script selection not persisting", tested.getSaveAntScript() );
+ assertFalse( "Save path should be disabled after save ant script is unchecked", tested.isSavePathEnabled() );
+ }
+
+}
More information about the ooo-build-commit
mailing list