[ooo-build-commit] ooeclipse: Branch 'master'
Cédric Bosdonnat
cbosdo at kemper.freedesktop.org
Thu Jun 10 00:59:31 PDT 2010
core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java | 2
core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java | 2
core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java | 2
core/source/org/openoffice/ide/eclipse/core/model/language/LanguageExportPart.java | 26 +
core/source/org/openoffice/ide/eclipse/core/preferences/ProjectPropertiesPage.java | 12
core/source/org/openoffice/ide/eclipse/core/wizards/pages/ManifestExportPage.java | 97 +++-
core/source/org/openoffice/ide/eclipse/core/wizards/pages/UnoPackageExportPage.java | 8
java/plugin.xml | 2
java/source/org/openoffice/ide/eclipse/java/JavaExportPart.java | 109 -----
java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java | 137 ++++++
java/source/org/openoffice/ide/eclipse/java/export/build.xml | 206 ++++++++++
java/source/org/openoffice/ide/eclipse/java/messages.properties | 1
12 files changed, 466 insertions(+), 138 deletions(-)
New commits:
commit 8d68834a5bf42cc1702cae32974c377256cb9a68
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date: Thu Jun 10 09:58:29 2010 +0200
Continued the export refactoring
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java b/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
index 4ed958e..01e9582 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/description/GeneralSection.java
@@ -172,7 +172,7 @@ public class GeneralSection extends LocalizedSection< DescriptionModel > {
if ( res != null && res.getType() == IResource.FILE ) {
IFile file = (IFile)res;
String path = file.getProjectRelativePath().toString();
- mDescriptionBtn.setText( path );
+ mDescriptionTxt.setText( path );
}
}
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
index 4a5a231..9594fe6 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java
@@ -95,7 +95,7 @@ public final class UnoFactory {
prj.getFile("package.properties").getLocation().toFile().createNewFile(); //$NON-NLS-1$
// Creates an empty description.xml file
- File file = prj.getFile("description.xml").getLocation().toFile(); //$NON-NLS-1$
+ File file = prj.getFile( IUnoidlProject.DESCRIPTION_FILENAME ).getLocation().toFile();
DescriptionModel descrModel = new DescriptionModel( );
descrModel.getDisplayNames().put( Locale.ENGLISH, prj.getName() );
descrModel.setId( prj.getCompanyPrefix().toLowerCase() + "." + //$NON-NLS-1$
diff --git a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
index c63c1be..7572070 100644
--- a/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
+++ b/core/source/org/openoffice/ide/eclipse/core/model/IUnoidlProject.java
@@ -58,6 +58,8 @@ import org.openoffice.ide.eclipse.core.model.language.AbstractLanguage;
*/
public interface IUnoidlProject {
+ public static final String DESCRIPTION_FILENAME = "description.xml"; //$NON-NLS-1$
+
/**
* <code>org.openoffice.ide.eclipse.idlfolder</code> is a
* persistent folder property that determines whether the
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 460cd5e..f514b8d 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,6 +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;
/**
* Abstract class for the language specific controls part in the OXT export
@@ -41,6 +43,8 @@ import org.eclipse.swt.widgets.Composite;
*/
public abstract class LanguageExportPart {
+ private ManifestExportPage mPage;
+
/**
* Create the controls in the part.
* @param pParent the parent composite where to create the controls
@@ -52,4 +56,26 @@ public abstract class LanguageExportPart {
*/
public abstract void dispose();
+ /**
+ * Run the export actions in a separate thread.
+ *
+ * <strong>Note that the controls might be disposed when this methods
+ * is called.</strong>
+ * @param pModel the model of the exported package
+ */
+ public abstract void doFinish( UnoPackage pModel );
+
+ /**
+ * @param pPage the manifest page containing this part.
+ */
+ public void setPage( ManifestExportPage pPage ) {
+ mPage = pPage;
+ }
+
+ /**
+ * @return the page containing this UI part.
+ */
+ protected ManifestExportPage getPage( ) {
+ return mPage;
+ }
}
diff --git a/core/source/org/openoffice/ide/eclipse/core/preferences/ProjectPropertiesPage.java b/core/source/org/openoffice/ide/eclipse/core/preferences/ProjectPropertiesPage.java
index db8cf70..19e600c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/preferences/ProjectPropertiesPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/preferences/ProjectPropertiesPage.java
@@ -45,7 +45,6 @@ package org.openoffice.ide.eclipse.core.preferences;
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridLayout;
@@ -53,13 +52,13 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IWorkbenchPropertyPage;
import org.eclipse.ui.dialogs.PropertyPage;
-import org.openoffice.ide.eclipse.core.OOEclipsePlugin;
import org.openoffice.ide.eclipse.core.PluginLogger;
import org.openoffice.ide.eclipse.core.gui.rows.LabeledRow;
import org.openoffice.ide.eclipse.core.gui.rows.OOoRow;
import org.openoffice.ide.eclipse.core.gui.rows.SdkRow;
import org.openoffice.ide.eclipse.core.internal.model.UnoidlProject;
import org.openoffice.ide.eclipse.core.model.OOoContainer;
+import org.openoffice.ide.eclipse.core.model.ProjectsManager;
import org.openoffice.ide.eclipse.core.model.SDKContainer;
import org.openoffice.ide.eclipse.core.model.config.IOOo;
import org.openoffice.ide.eclipse.core.model.config.ISdk;
@@ -110,10 +109,11 @@ public class ProjectPropertiesPage extends PropertyPage
super.setElement(pElement);
try {
- mProject = (UnoidlProject)((IProject)getElement()).
- getNature(OOEclipsePlugin.UNO_NATURE_ID);
-
- } catch (CoreException e) {
+ IProject prj = (IProject)pElement.getAdapter( IProject.class );
+ if ( prj != null ) {
+ mProject = (UnoidlProject)ProjectsManager.getProject( prj.getName() );
+ }
+ } catch (Exception e) {
PluginLogger.debug(e.getMessage());
}
}
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 b5280d0..f29f55c 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
@@ -73,7 +73,7 @@ public class ManifestExportPage extends WizardPage {
public static final int HORIZONTAL_INDENT = 20;
- private static final String MANIFEST_FILENAME = "manifest.xml"; //$NON-NLS-1$
+ public static final String MANIFEST_FILENAME = "manifest.xml"; //$NON-NLS-1$
private static final int LAYOUT_COLS = 3;
@@ -114,6 +114,13 @@ public class ManifestExportPage extends WizardPage {
}
/**
+ * @return the UNO project to export as a package
+ */
+ public IUnoidlProject getProject( ) {
+ return mProject;
+ }
+
+ /**
* Set the proper manifest.xml file to the package model from the user selection.
*
* @param pModel the model to change
@@ -136,8 +143,40 @@ public class ManifestExportPage extends WizardPage {
* @param pModel the model to export
*/
public void createBuildScripts(UnoPackage pModel) {
- // TODO Auto-generated method stub
-
+ mLangPart.doFinish( pModel );
+ }
+
+
+ /**
+ * Define the manifest file to generate and force the dialog to this value.
+ *
+ * @param pFile the file to set or <code>null</code> to remove the current
+ * existing value
+ */
+ public void setManifestPath(IFile pFile) {
+ // FIXME Ugly hack due to some bug in the GTK buttons events
+ if ( pFile != null && !pFile.exists() ) {
+ mSaveManifestBtn.setSelection( true );
+ mReuseManifestBtn.setSelection( false );
+ mGenerateManifestBtn.setSelection( true );
+ mSaveRowTxt.setText( pFile.getFullPath().toString() );
+ setSaveRowEnabled( true );
+ setLoadRowEnabled( false );
+ } else if ( pFile != null && pFile.exists() ) {
+ mGenerateManifestBtn.setSelection( false );
+ mReuseManifestBtn.setSelection( true );
+ mSaveManifestBtn.setSelection( false );
+ mLoadRowTxt.setText( pFile.getFullPath().toString() );
+ setLoadRowEnabled( true );
+ setSaveRowEnabled( false );
+ } else {
+ mGenerateManifestBtn.setSelection( true );
+ mReuseManifestBtn.setSelection( false );
+ mSaveManifestBtn.setSelection( true );
+ mSaveRowTxt.setText( new String( ) );
+ setSaveRowEnabled( true );
+ setLoadRowEnabled( false );
+ }
}
/**
@@ -163,6 +202,30 @@ public class ManifestExportPage extends WizardPage {
}
/**
+ * Enables the manifest save row.
+ *
+ * @param pEnabled <code>true</code> to enable all the controls of the row
+ * <code>false</code> otherwise.
+ */
+ private void setSaveRowEnabled( boolean pEnabled ) {
+ mSaveRowLbl.setEnabled( pEnabled );
+ mSaveRowTxt.setEnabled( pEnabled );
+ mSaveRowBtn.setEnabled( pEnabled );
+ }
+
+ /**
+ * Enables the manifest load row.
+ *
+ * @param pEnabled <code>true</code> to enable all the controls of the row
+ * <code>false</code> otherwise.
+ */
+ private void setLoadRowEnabled( boolean pEnabled ) {
+ mLoadRowLbl.setEnabled( pEnabled );
+ mLoadRowTxt.setEnabled( pEnabled );
+ mLoadRowBtn.setEnabled( pEnabled );
+ }
+
+ /**
* Create the manifest save/reuse options.
*
* @param pParent the parent composite where to create the controls
@@ -184,9 +247,7 @@ public class ManifestExportPage extends WizardPage {
mSaveManifestBtn.setEnabled( selection );
boolean saveSelection = mSaveManifestBtn.getSelection();
- mSaveRowLbl.setEnabled( selection && saveSelection );
- mSaveRowTxt.setEnabled( selection && saveSelection );
- mSaveRowBtn.setEnabled( selection && saveSelection );
+ setSaveRowEnabled( selection && saveSelection );
}
public void widgetDefaultSelected(SelectionEvent pE) {
@@ -210,9 +271,7 @@ public class ManifestExportPage extends WizardPage {
public void widgetSelected(SelectionEvent pE) {
boolean enabled = mReuseManifestBtn.getSelection();
- mLoadRowLbl.setEnabled( enabled );
- mLoadRowTxt.setEnabled( enabled );
- mLoadRowBtn.setEnabled( enabled );
+ setLoadRowEnabled( enabled );
}
public void widgetDefaultSelected(SelectionEvent pE) {
@@ -246,9 +305,7 @@ public class ManifestExportPage extends WizardPage {
public void widgetSelected(SelectionEvent pE) {
boolean enabled = mSaveManifestBtn.getSelection();
- mSaveRowLbl.setEnabled( enabled );
- mSaveRowTxt.setEnabled( enabled );
- mSaveRowBtn.setEnabled( enabled );
+ setSaveRowEnabled( enabled );
}
public void widgetDefaultSelected(SelectionEvent pE) {
@@ -259,30 +316,31 @@ public class ManifestExportPage extends WizardPage {
mSaveRowLbl = new Label( pParent, SWT.NONE );
mSaveRowLbl.setText( Messages.getString("ManifestExportPage.SaveRowLabel") ); //$NON-NLS-1$
mSaveRowLbl.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false ) );
- mSaveRowLbl.setEnabled( false );
mSaveRowTxt = new Text( pParent, SWT.SINGLE | SWT.BORDER );
mSaveRowTxt.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
- mSaveRowTxt.setEnabled( false );
mSaveRowBtn = new Button( pParent, SWT.PUSH );
mSaveRowBtn.setText( Messages.getString("ManifestExportPage.Browse") ); //$NON-NLS-1$
mSaveRowBtn.setLayoutData( new GridData( SWT.END, SWT.CENTER, false, false ) );
- mSaveRowBtn.setEnabled( false );
mSaveRowBtn.addSelectionListener( new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent pE) {
SaveAsDialog dlg = new SaveAsDialog( getShell() );
+ dlg.setOriginalName( MANIFEST_FILENAME );
+ dlg.setOriginalFile( mProject.getFile( MANIFEST_FILENAME ) );
dlg.create();
dlg.getShell().setText( Messages.getString("ManifestExportPage.SaveDialogTitle") ); //$NON-NLS-1$
dlg.setMessage( Messages.getString("ManifestExportPage.SaveDialogMessage") ); //$NON-NLS-1$
- dlg.setOriginalFile( mProject.getFile( MANIFEST_FILENAME ) );
+
if ( dlg.open() == Window.OK ) {
mSaveRowTxt.setText( dlg.getResult().toString() );
}
}
});
+
+ setSaveRowEnabled( false );
}
/**
@@ -294,16 +352,13 @@ public class ManifestExportPage extends WizardPage {
mLoadRowLbl = new Label( pParent, SWT.NONE );
mLoadRowLbl.setText( Messages.getString("ManifestExportPage.LoadRowLabel") ); //$NON-NLS-1$
mLoadRowLbl.setLayoutData( new GridData( SWT.BEGINNING, SWT.CENTER, false, false ) );
- mLoadRowLbl.setEnabled( false );
mLoadRowTxt = new Text( pParent, SWT.SINGLE | SWT.BORDER );
mLoadRowTxt.setLayoutData( new GridData( SWT.FILL, SWT.CENTER, true, false ) );
- mLoadRowTxt.setEnabled( false );
mLoadRowBtn = new Button( pParent, SWT.PUSH );
mLoadRowBtn.setText( Messages.getString("ManifestExportPage.Browse") ); //$NON-NLS-1$
mLoadRowBtn.setLayoutData( new GridData( SWT.END, SWT.CENTER, false, false ) );
- mLoadRowBtn.setEnabled( false );
mLoadRowBtn.addSelectionListener( new SelectionAdapter() {
@Override
@@ -342,6 +397,7 @@ public class ManifestExportPage extends WizardPage {
dlg.setMessage( Messages.getString("ManifestExportPage.LoadDialogMessage") ); //$NON-NLS-1$
dlg.setStatusLineAboveButtons( true );
dlg.setInput( ResourcesPlugin.getWorkspace().getRoot() );
+ dlg.setInitialSelection( getProject().getFile( MANIFEST_FILENAME ) );
if ( dlg.open() == Window.OK ) {
Object result = dlg.getFirstResult();
IFile file = ( IFile )result;
@@ -349,6 +405,8 @@ public class ManifestExportPage extends WizardPage {
}
}
});
+
+ setLoadRowEnabled( false );
}
/**
@@ -363,6 +421,7 @@ public class ManifestExportPage extends WizardPage {
if ( mProject != null ) {
mLangPart = mProject.getLanguage().getExportBuildPart();
if ( mLangPart != null ) {
+ mLangPart.setPage( this );
Composite body = ( Composite ) getControl();
if ( body != null ) {
// The body can be null before the page creation
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 9b4c99d..0391bc1 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
@@ -36,6 +36,7 @@ import java.util.ArrayList;
import java.util.List;
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;
@@ -353,7 +354,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( "description.xml" ); //$NON-NLS-1$
+ 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$
@@ -470,6 +471,11 @@ public class UnoPackageExportPage extends WizardPage {
// Create the package model
pack = UnoidlProjectHelper.createMinimalUnoPackage( mSelectedProject, destFile );
pack.addToClean( libraryPath );
+
+ IFile descrFile = mSelectedProject.getFile( IUnoidlProject.DESCRIPTION_FILENAME );
+ if ( descrFile.exists() ) {
+ pack.addContent( descrFile );
+ }
// Add the additional content to the package
List<?> items = mResourceGroup.getAllWhiteCheckedItems();
diff --git a/java/plugin.xml b/java/plugin.xml
index 6e86efb..2c5df7b 100644
--- a/java/plugin.xml
+++ b/java/plugin.xml
@@ -10,7 +10,7 @@
class="org.openoffice.ide.eclipse.java.JavaWizardPage">
</newWizardPage>
<exportBuildPart
- class="org.openoffice.ide.eclipse.java.JavaExportPart">
+ class="org.openoffice.ide.eclipse.java.export.JavaExportPart">
</exportBuildPart>
</language>
</extension>
diff --git a/java/source/org/openoffice/ide/eclipse/java/JavaExportPart.java b/java/source/org/openoffice/ide/eclipse/java/JavaExportPart.java
deleted file mode 100644
index 0df5abf..0000000
--- a/java/source/org/openoffice/ide/eclipse/java/JavaExportPart.java
+++ /dev/null
@@ -1,109 +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.java;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-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.wizards.pages.ManifestExportPage;
-
-/**
- * Dialog part for the Ant scripts export configuration.
- *
- * @author Cédric Bosdonnat
- *
- */
-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;
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void createControls(Composite pParent) {
- mSaveScripts = new Button( pParent, SWT.CHECK );
- mSaveScripts.setText( Messages.getString("JavaExportPart.SaveAntScript") ); //$NON-NLS-1$
- mSaveScripts.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, true, false ) );
- mSaveScripts.addSelectionListener( new SelectionListener() {
-
- public void widgetSelected( SelectionEvent pE ) {
- boolean enabled = mSaveScripts.getSelection();
- mNameRowLbl.setEnabled( enabled );
- mNameRowTxt.setEnabled( enabled );
- }
-
- public void widgetDefaultSelected( SelectionEvent pE ) {
- widgetSelected( pE );
- }
- });
-
- mNameRow = new Composite( pParent, SWT.NONE );
- mNameRow.setLayout( new GridLayout( 2, false ) );
- GridData gd = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
- gd.horizontalIndent = ManifestExportPage.HORIZONTAL_INDENT;
- mNameRow.setLayoutData( gd );
-
- 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 );
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- if ( mSaveScripts != null ) {
- mSaveScripts.dispose();
- mNameRow.dispose();
- }
- }
-
-}
diff --git a/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
new file mode 100644
index 0000000..29506e8
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/export/JavaExportPart.java
@@ -0,0 +1,137 @@
+/*************************************************************************
+ *
+ * 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.java.export;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+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;
+
+/**
+ * Dialog part for the Ant scripts export configuration.
+ *
+ * @author Cédric Bosdonnat
+ *
+ */
+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;
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void createControls(Composite pParent) {
+
+ 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 ) );
+
+ Composite content = new Composite( pParent, SWT.NONE );
+ GridData gd = new GridData( SWT.FILL, SWT.FILL, true, true );
+ gd.horizontalIndent = ManifestExportPage.HORIZONTAL_INDENT;
+ content.setLayoutData( gd );
+ content.setLayout( new GridLayout() );
+
+ mSaveScripts = new Button( content, SWT.CHECK );
+ mSaveScripts.setText( Messages.getString("JavaExportPart.SaveAntScript") ); //$NON-NLS-1$
+ mSaveScripts.setLayoutData( new GridData( SWT.FILL, SWT.BEGINNING, true, false ) );
+ 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 );
+ }
+
+ public void widgetDefaultSelected( SelectionEvent pE ) {
+ widgetSelected( pE );
+ }
+ });
+
+ mNameRow = new Composite( content, SWT.NONE );
+ mNameRow.setLayout( new GridLayout( 2, false ) );
+ gd = new GridData( SWT.FILL, SWT.BEGINNING, true, false );
+ gd.horizontalIndent = ManifestExportPage.HORIZONTAL_INDENT;
+ mNameRow.setLayoutData( gd );
+
+ 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 );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ if ( mSaveScripts != null ) {
+ mSaveScripts.dispose();
+ mNameRow.dispose();
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void doFinish( UnoPackage pModel ) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/java/source/org/openoffice/ide/eclipse/java/export/build.xml b/java/source/org/openoffice/ide/eclipse/java/export/build.xml
new file mode 100644
index 0000000..12af04a
--- /dev/null
+++ b/java/source/org/openoffice/ide/eclipse/java/export/build.xml
@@ -0,0 +1,206 @@
+<?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 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
+ * Library General Public License for more details.
+ *
+ * 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
+ -->
+<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"/>
+
+ <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}"/>
+
+ <path id="office.class.path">
+ <fileset dir="${office.basis.dir}${file.separator}program${file.separator}classes">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${office.ure.dir}${file.separator}share${file.separator}java">
+ <include name="*.jar"/>
+ </fileset>
+ </path>
+
+ <property name="office.unotypes.rdb"
+ value="${office.ure.dir}${file.separator}share${file.separator}misc${file.separator}types.rdb"/>
+
+ <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 file=".unoproject"/>
+ <property file="package.properties"/>
+ <dirname property="project.dir" file="package.properties"/>
+
+ <property name="build.dir" value="${project.build}"/>
+ <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"/>
+
+ <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}"/>
+ <property name="idl.dir" value="${project.dir}${project.idl}"/>
+
+ <property name="idl.out" value="${project.dir}${file.separator}${build.dir}${file.separator}idl"/>
+ <property name="idl.out.urd" value="${idl.out}${file.separator}urd"/>
+ <property name="idl.out.rdb" value="${idl.out}${file.separator}rdb"/>
+ <property name="idl.rdb.name" value="types.rdb"/>
+ <property name="idl.rdb.fullpath" value="${idl.out.rdb}${file.separator}${idl.rdb.name}"/>
+
+ <mkdir dir="${build.dir}" />
+ <mkdir dir="${idl.out}"/>
+ <mkdir dir="${idl.out.urd}"/>
+ <mkdir dir="${idl.out.rdb}"/>
+ <mkdir dir="${build.classes.dir}"/>
+ <mkdir dir="${dist.dir}"/>
+ </target>
+
+ <target name="clean" depends="init-env">
+ <delete dir="${build.dir}"/>
+ </target>
+
+ <target name="package-oxt" depends="package-jar">
+ <!-- The manifest.xml file is extracted from the package build with Eclipse -->
+
+ <zip destfile="${uno.package.name}" includes="${contents}">
+ <fileset dir="." includes="${contents}"/>
+ <zipfileset dir="descriptions" includes="**/*.txt" prefix="descriptions"/>
+ <zipfileset file="ant/manifest.xml" fullpath="META-INF/manifest.xml"/>
+ <zipfileset file="${dist.dir}/${ant.project.name}.jar"
+ fullpath="${ant.project.name}.jar"/>
+ <zipfileset file="${idl.rdb.fullpath}" fullpath="types.rdb"/>
+ </zip>
+ </target>
+
+ <target name="package-jar" depends="compile-java">
+ <jar destfile="${dist.dir}/${ant.project.name}.jar">
+ <manifest>
+ <attribute name="RegistrationClassName" value="${regclassname}"/>
+ </manifest>
+ <fileset dir="${build.classes.dir}">
+ <include name="**/*.class"/>
+ </fileset>
+ <fileset dir="${src.dir.absolute}">
+ <exclude name="**/*.java"/>
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="compile-java" depends="types">
+ <echo message="build classes: ${build.classes.dir}"/>
+ <javac srcdir="${src.dir.absolute}" source="1.4" target="1.4" encoding="UTF-8"
+ destdir="${build.classes.dir}" excludes="**/*Test*">
+ <classpath>
+ <pathelement location="${build.classes.dir}"/>
+ <path refid="office.class.path"/>
+ </classpath>
+ </javac>
+ </target>
+
+ <target name="types" depends="merge-urd">
+ <echo message="Generating java class files from rdb..."/>
+ <condition property="args.offapi" value=" -X${office.offapi.rdb}" else="">
+ <length string="${office.offapi.rdb}" when="greater" length="0" trim="true"/>
+ </condition>
+
+ <exec executable="${sdk.javamaker}" failonerror="true">
+ <env key="PATH" path="${office.tool.path}"/>
+ <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <arg value="-nD"/>
+ <arg value="-Gc"/>
+ <arg value="-BUCR"/>
+ <arg value="-O"/>
+ <arg value="${project.dir}${file.separator}${build.classes.dir}"/>
+ <arg file="${idl.rdb.fullpath}"/>
+ <arg line="-X${office.unotypes.rdb}${args.offapi}"/>
+ </exec>
+ </target>
+
+ <target name="merge-urd" depends="compile-idl">
+ <delete file="${idl.rdb.fullpath}"/>
+ <apply executable="${sdk.regmerge}" failonerror="true">
+ <env key="PATH" path="${office.tool.path}"/>
+ <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <arg file="${idl.rdb.fullpath}"/>
+ <arg value="/UCR"/>
+ <fileset dir="${idl.out.urd}" includes="**/*.urd" casesensitive="yes"/>
+ </apply>
+ </target>
+
+ <target name="compile-idl" depends="init-env">
+ <echo message="${sdk.idlc}"/>
+ <echo message="${office.tool.path}"/>
+
+ <apply executable="${sdk.idlc}" failonerror="true">
+ <env key="PATH" path="${office.tool.path}"/>
+ <env key="LD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <env key="DYLD_LIBRARY_PATH" path="${office.tool.path}"/>
+ <arg value="-C"/>
+ <arg value="-O"/>
+ <arg value="${idl.out.urd}"/>
+ <arg value="-I"/>
+ <arg value="${idl.dir}"/>
+ <arg value="-I"/>
+ <arg value="${sdk.idl.dir}"/>
+ <fileset dir="${idl.dir}" includes="**/*.idl" casesensitive="yes"/>
+ </apply>
+ </target>
+
+</project>
diff --git a/java/source/org/openoffice/ide/eclipse/java/messages.properties b/java/source/org/openoffice/ide/eclipse/java/messages.properties
index 383268b..8f4d8f2 100644
--- a/java/source/org/openoffice/ide/eclipse/java/messages.properties
+++ b/java/source/org/openoffice/ide/eclipse/java/messages.properties
@@ -5,6 +5,7 @@ Language.CreateCodeError=Code generation failed
Language.GetClasspathError=Failed to get the project classpath
JavaExportPart.AntFile=Ant build file
JavaExportPart.SaveAntScript=Save as Ant script
+JavaExportPart.Title=Java options
JavaWizardPage.IncludeTestClasses=Include base classes for tests
JavaWizardPage.JavaVersion=Java version
JavaWizardPage.JavaVersionTooltip=Defines the minimal required java version of the project.
More information about the ooo-build-commit
mailing list