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

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Mon Aug 3 01:20:29 PDT 2009


 core/source/org/openoffice/ide/eclipse/core/editors/PackagePropertiesEditor.java      |    1 
 core/source/org/openoffice/ide/eclipse/core/editors/main/DescriptionSourcePage.java   |   31 ++
 core/source/org/openoffice/ide/eclipse/core/editors/main/PackageOverviewFormPage.java |    3 
 core/source/org/openoffice/ide/eclipse/core/gui/LocaleDialog.java                     |    4 
 core/source/org/openoffice/ide/eclipse/core/internal/model/AbstractOOo.java           |   24 ++
 core/source/org/openoffice/ide/eclipse/core/internal/model/OOo.java                   |   18 -
 core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java                   |   14 -
 core/source/org/openoffice/ide/eclipse/core/internal/model/UnoFactory.java            |    6 
 core/source/org/openoffice/ide/eclipse/core/model/description/DescriptionModel.java   |    4 
 core/source/org/openoffice/ide/eclipse/core/unittests/AllTests.java                   |    1 
 core/source/org/openoffice/ide/eclipse/core/unittests/OOoTest.java                    |  111 ++++++++++
 java/source/org/openoffice/ide/eclipse/java/build/Messages.java                       |   53 ++++
 java/source/org/openoffice/ide/eclipse/java/registration/Messages.java                |   53 ++++
 13 files changed, 289 insertions(+), 34 deletions(-)

New commits:
commit 3bfb511e6da9c11a40bcb462b433c56f49f8db3c
Author: Cédric Bosdonnat <cedricbosdo at openoffice.org>
Date:   Mon Aug 3 10:19:37 2009 +0200

    Unit test to check whether the OOo checks are ok.
    
    Testing whether the OOo installations will be ok for every platform
    was quite hard. It is no more necessary to have all the running
    instances of each supported OS to see whether the OOo class
    instanciation works or not.
    
    There are also a few warning fixes.

diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/PackagePropertiesEditor.java b/core/source/org/openoffice/ide/eclipse/core/editors/PackagePropertiesEditor.java
index c0c2deb..79ad264 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/PackagePropertiesEditor.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/PackagePropertiesEditor.java
@@ -45,7 +45,6 @@ package org.openoffice.ide.eclipse.core.editors;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.StringReader;
 
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/main/DescriptionSourcePage.java b/core/source/org/openoffice/ide/eclipse/core/editors/main/DescriptionSourcePage.java
index ca0af5f..dbaa51f 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/main/DescriptionSourcePage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/main/DescriptionSourcePage.java
@@ -1,6 +1,35 @@
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2009 by Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ * 
+ * The Initial Developer of the Original Code is: Cédric Bosdonnat.
+ *
+ * Copyright: 2009 by Novell, Inc.
+ *
+ * All Rights Reserved.
+ * 
+ ************************************************************************/
 package org.openoffice.ide.eclipse.core.editors.main;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.ui.forms.editor.FormEditor;
 import org.openoffice.ide.eclipse.core.editors.PackagePropertiesEditor;
 import org.openoffice.ide.eclipse.core.editors.SourcePage;
diff --git a/core/source/org/openoffice/ide/eclipse/core/editors/main/PackageOverviewFormPage.java b/core/source/org/openoffice/ide/eclipse/core/editors/main/PackageOverviewFormPage.java
index bef5957..e744001 100644
--- a/core/source/org/openoffice/ide/eclipse/core/editors/main/PackageOverviewFormPage.java
+++ b/core/source/org/openoffice/ide/eclipse/core/editors/main/PackageOverviewFormPage.java
@@ -223,6 +223,9 @@ public class PackageOverviewFormPage extends FormPage {
         }
     }
 
+    /**
+     * Refresh data on the page.
+     */
     public void refresh() {
         for ( AbstractOverviewSection section : mSections ) {
             section.loadData( );
diff --git a/core/source/org/openoffice/ide/eclipse/core/gui/LocaleDialog.java b/core/source/org/openoffice/ide/eclipse/core/gui/LocaleDialog.java
index 7239ae6..e6d746d 100644
--- a/core/source/org/openoffice/ide/eclipse/core/gui/LocaleDialog.java
+++ b/core/source/org/openoffice/ide/eclipse/core/gui/LocaleDialog.java
@@ -10,14 +10,10 @@ import java.util.Locale;
 import org.eclipse.jface.dialogs.Dialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.IBaseLabelProvider;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.LabelProvider;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.jface.viewers.ViewerSorter;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.layout.GridData;
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 ea8349b..026e0aa 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
@@ -76,6 +76,8 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
 
     protected static final String FILE_SEP = System.getProperty("file.separator"); //$NON-NLS-1$
     
+    private static String sPlatform;
+    
     private String mHome;
     private String mName;
     
@@ -319,7 +321,7 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
         libpath = "file:///" + libpath; //$NON-NLS-1$
         
         String unoPath = getUnoPath();
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             /* uno is already in the PATH variable, so don't worry */
             unoPath = "uno"; //$NON-NLS-1$
         }
@@ -353,4 +355,24 @@ public abstract class AbstractOOo implements IOOo, ITableElement {
         Process p = pPrj.getSdk().runToolWithEnv(pPrj, command, env, pMonitor);
         DebugPlugin.newProcess(pLaunch, p, Messages.getString("AbstractOOo.UreProcessName")  + pMain); //$NON-NLS-1$
     }
+    
+    /**
+     * Sets the target platform for tests.
+     * 
+     * @param pPlatform the target platform
+     */
+    public static void setPlatform( String pPlatform ) {
+        sPlatform = pPlatform;
+    }
+    
+    /**
+     * @return the system platform, or the test one if set.
+     */
+    protected String getPlatform( ) {
+        String result = sPlatform;
+        if ( sPlatform == null) {
+            result = Platform.getOS();
+        }
+        return result;
+    }
 }
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 cb1067f..a8430c7 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
@@ -111,7 +111,7 @@ public class OOo extends AbstractOOo {
     public OOo(String pOooHome, String pOooName) throws InvalidConfigException {
         super(pOooHome, pOooName);
     }
-        
+    
     //----------------------------------------------------- IOOo Implementation
     
     /**
@@ -125,7 +125,7 @@ public class OOo extends AbstractOOo {
     @Override
     public void setHome(String pHome) throws InvalidConfigException {
         
-        if (Platform.getOS().equals(Platform.OS_MACOSX)) {
+        if (getPlatform().equals(Platform.OS_MACOSX)) {
             pHome = pHome + FILE_SEP + "Contents"; //$NON-NLS-1$
         }
         
@@ -157,7 +157,7 @@ public class OOo extends AbstractOOo {
         String[] otherPaths = mMapper.getAdditionnalLibs();
         
         String libs = getHome() + FILE_SEP + "program"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_MACOSX)) {
+        if (getPlatform().equals(Platform.OS_MACOSX)) {
             libs = getHome() + FILE_SEP + "MacOS"; //$NON-NLS-1$
         }
         
@@ -199,7 +199,7 @@ public class OOo extends AbstractOOo {
      */
     public String getUnorcPath() {
         String path = getLibsPath()[0] + FILE_SEP + "bootstrap"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             path += ".ini"; //$NON-NLS-1$
         } else {
             path += "rc"; //$NON-NLS-1$
@@ -212,7 +212,7 @@ public class OOo extends AbstractOOo {
      */
     public String getUnoPath() {
         String uno = "uno.bin"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             uno = "uno.exe"; //$NON-NLS-1$
         }
         String unoPath = getLibsPath()[0] + FILE_SEP + uno;
@@ -301,7 +301,7 @@ public class OOo extends AbstractOOo {
 
             // Constitute the classpath for OOo Boostrapping
             String classpath = "-cp "; //$NON-NLS-1$
-            if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            if (getPlatform().equals(Platform.OS_WIN32)) {
                 classpath += "\""; //$NON-NLS-1$
             }
 
@@ -320,7 +320,7 @@ public class OOo extends AbstractOOo {
             }
 
             classpath += pLibLocation;
-            if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            if (getPlatform().equals(Platform.OS_WIN32)) {
                 classpath += "\""; //$NON-NLS-1$
             }
 
@@ -394,7 +394,7 @@ public class OOo extends AbstractOOo {
      */
     private void addPackage(File pPackageFile) throws Exception {
         String path = pPackageFile.getAbsolutePath();
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             path = "\"" + path + "\""; //$NON-NLS-1$ //$NON-NLS-2$
         }
         String shellCommand = "unopkg gui -f " + path; //$NON-NLS-1$
@@ -673,7 +673,7 @@ public class OOo extends AbstractOOo {
             File link = null;
             
             File linkFile = new File(pParent, pName);
-            if (Platform.getOS().equals(Platform.OS_WIN32)) {
+            if (getPlatform().equals(Platform.OS_WIN32)) {
                 // Read the content of the file to get the true folder
                 try {
                     FileInputStream is = new FileInputStream(linkFile);
diff --git a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
index edfabe4..08e7d2e 100644
--- a/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
+++ b/core/source/org/openoffice/ide/eclipse/core/internal/model/URE.java
@@ -100,7 +100,7 @@ public class URE extends AbstractOOo {
      */
     public String[] getClassesPath() {
         String jars = getHome() + FILE_SEP + "share" + FILE_SEP + "java"; //$NON-NLS-1$ //$NON-NLS-2$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             jars = getHome() + FILE_SEP + "java"; //$NON-NLS-1$
         }
         return new String[]{ jars };
@@ -111,7 +111,7 @@ public class URE extends AbstractOOo {
      */
     public String[] getLibsPath() {
         String libs = getHome() + FILE_SEP + "lib"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             libs = getHome() + FILE_SEP + "bin"; //$NON-NLS-1$
         }
         return new String[]{ libs };
@@ -123,7 +123,7 @@ public class URE extends AbstractOOo {
     public String[] getTypesPath() {
         String types = getHome() + FILE_SEP + "share" + FILE_SEP + "misc" + //$NON-NLS-1$ //$NON-NLS-2$ 
             FILE_SEP + "types.rdb"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             types = getHome() + FILE_SEP + "misc" + FILE_SEP + "types.rdb"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return new String[]{ types };
@@ -135,7 +135,7 @@ public class URE extends AbstractOOo {
     public String[] getServicesPath() {
         String services = getHome() + FILE_SEP + "share" + FILE_SEP + "misc" + //$NON-NLS-1$ //$NON-NLS-2$ 
                 FILE_SEP + "services.rdb"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             services = getHome() + FILE_SEP + "misc" + FILE_SEP + "services.rdb"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return new String[]{ services };
@@ -146,7 +146,7 @@ public class URE extends AbstractOOo {
      */
     public String getUnorcPath() {
         String path = getHome() + FILE_SEP + "lib" + FILE_SEP + "unorc"; //$NON-NLS-1$ //$NON-NLS-2$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             path = getHome() + FILE_SEP + "bin" + FILE_SEP + "uno.ini"; //$NON-NLS-1$ //$NON-NLS-2$
         }
         return path;
@@ -157,7 +157,7 @@ public class URE extends AbstractOOo {
      */
     public String getUnoPath() {
         String uno = "uno.bin"; //$NON-NLS-1$
-        if (Platform.getOS().equals(Platform.OS_WIN32)) {
+        if (getPlatform().equals(Platform.OS_WIN32)) {
             uno = "uno.exe";  //$NON-NLS-1$
         }
         
@@ -217,7 +217,7 @@ public class URE extends AbstractOOo {
         }
         
         String unoPath = getUnoPath();
-        if (Platform.OS_WIN32.equals(Platform.getOS())) {
+        if (Platform.OS_WIN32.equals(getPlatform())) {
             unoPath = "\"" + unoPath + "\"";  // escape spaces in windows names //$NON-NLS-1$ //$NON-NLS-2$
         }
         
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 b7a8b47..4c3abb3 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
@@ -103,8 +103,8 @@ public final class UnoFactory {
         File file = prj.getFile("description.xml").getLocation().toFile(); //$NON-NLS-1$
         DescriptionModel descrModel = new DescriptionModel( );
         descrModel.mDisplayNames.put( Locale.ENGLISH, prj.getName() );
-        descrModel.mId = prj.getCompanyPrefix().toLowerCase() + "." + 
-            prj.getName().replaceAll( "[^a-zA-Z0-9]", new String( ) ).toLowerCase();
+        descrModel.mId = prj.getCompanyPrefix().toLowerCase() + "." + //$NON-NLS-1$
+            prj.getName().replaceAll( "[^a-zA-Z0-9]", new String( ) ).toLowerCase(); //$NON-NLS-1$
         FileOutputStream out = null;
         try {
             out = new FileOutputStream( file );
@@ -112,7 +112,7 @@ public final class UnoFactory {
         } catch ( Exception e ) {
             // TODO Log ?
         } finally {
-            try { out.close(); } catch ( Exception e ) {}
+            try { out.close(); } catch ( Exception e ) { }
         }
             
         UnoidlProjectHelper.refreshProject(prj, null);
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 7f60a52..70bdaa3 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
@@ -428,10 +428,10 @@ public class DescriptionModel {
      * @return the string form of the locale
      */
     private String writeLocale( Locale pLocale ) {
-        char sep = '-'; //$NON-NLS-1$
+        char sep = '-';
         String result = new String( );
         
-        result = pLocale.toString().replace( '_', sep ); //$NON-NLS-1$
+        result = pLocale.toString().replace( '_', sep );
         
         return result;
     }
diff --git a/core/source/org/openoffice/ide/eclipse/core/unittests/AllTests.java b/core/source/org/openoffice/ide/eclipse/core/unittests/AllTests.java
index edd5389..c70e39c 100644
--- a/core/source/org/openoffice/ide/eclipse/core/unittests/AllTests.java
+++ b/core/source/org/openoffice/ide/eclipse/core/unittests/AllTests.java
@@ -62,6 +62,7 @@ public class AllTests {
         //$JUnit-BEGIN$
         suite.addTestSuite(CompositeTest.class);
         suite.addTestSuite(UnoFactoryTest.class);
+        suite.addTestSuite(OOoTest.class);
         //$JUnit-END$
         return suite;
     }
diff --git a/core/source/org/openoffice/ide/eclipse/core/unittests/OOoTest.java b/core/source/org/openoffice/ide/eclipse/core/unittests/OOoTest.java
new file mode 100644
index 0000000..2ec57ed
--- /dev/null
+++ b/core/source/org/openoffice/ide/eclipse/core/unittests/OOoTest.java
@@ -0,0 +1,111 @@
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2009 by Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ * 
+ * The Initial Developer of the Original Code is: Cédric Bosdonnat.
+ *
+ * Copyright: 2009 by Novell, Inc.
+ *
+ * All Rights Reserved.
+ * 
+ ************************************************************************/
+package org.openoffice.ide.eclipse.core.unittests;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.Platform;
+import org.openoffice.ide.eclipse.core.internal.model.OOo;
+import org.openoffice.ide.eclipse.core.preferences.InvalidConfigException;
+
+import junit.framework.TestCase;
+
+/**
+ * Unit test class checking the OOo structure recognition.
+ * 
+ * @author Cédric Bosdonnat
+ *
+ */
+public class OOoTest extends TestCase {
+
+    private static final String TEST_PROP = "ooo.tests"; //$NON-NLS-1$
+
+    /**
+     * Test if the directories checks for various versions of OOo are working.
+     * 
+     * <p>In order to make this test run, a <tt>ooo.tests</tt> variable has to be set. This
+     * should point to a directory containing a directory per supported OS, which are:</p>
+     * <ul>
+     *  <li>linux</li>
+     *  <li>macosx</li>
+     *  <li>win32</li>
+     * </ul>
+     * 
+     * <p>Each one of these directories have to contain the one directory per installation 
+     * to test. For example, if one wants to test OpenOffice.org 2.4 and 3.1 for Linux, the 
+     * following directories should be created in the <tt>linux</tt> folder:</p>
+     * <ul>
+     *  <li>OpenOffice.org 2.4</li>
+     *  <li>OpenOffice.org 3.1</li>
+     * </ul>
+     * 
+     * <p>The names are only used for readability purpose. The tested OOo folders will be these
+     * ones.</p>
+     */
+    public void testOOoChecks( ) {
+        String pattern = "Unexpected OOo load failure for OS {0}, installation {1}"; //$NON-NLS-1$
+        String testsPath = System.getProperty( TEST_PROP );
+        File testsDir = new File( testsPath );
+
+        // Loop over the platforms
+        File[] dirs = testsDir.listFiles( new FileFilter( ) {
+            public boolean accept(File pPathname) {                    
+                boolean isDir = pPathname.isDirectory() && pPathname.canRead();
+                boolean isMacos = pPathname.getName().equals( Platform.OS_MACOSX );
+                boolean isWin32 = pPathname.getName().equals( Platform.OS_WIN32 );
+                boolean isLinux = pPathname.getName().equals( Platform.OS_LINUX );
+
+                return isDir && ( isMacos || isWin32 || isLinux );
+            }
+        });
+        for (File platformDir : dirs) {
+            // Emulate the given platform
+            OOo.setPlatform( platformDir.getName() );
+
+            // Loop over the installation directories
+            File[] instDirs = platformDir.listFiles( new FileFilter( ) {
+                public boolean accept(File pPathname) {
+                    return pPathname.isDirectory() && pPathname.canRead();
+                } 
+            });
+
+            for (File inst : instDirs) {
+                try {
+                    new OOo( inst.getAbsolutePath() );
+                } catch (InvalidConfigException e) {
+                    fail( MessageFormat.format( pattern, platformDir.getName(), inst.getName() ) );
+                }
+            }
+        }
+    }
+}
diff --git a/java/source/org/openoffice/ide/eclipse/java/build/Messages.java b/java/source/org/openoffice/ide/eclipse/java/build/Messages.java
index 1bcd12d..de28c73 100644
--- a/java/source/org/openoffice/ide/eclipse/java/build/Messages.java
+++ b/java/source/org/openoffice/ide/eclipse/java/build/Messages.java
@@ -1,22 +1,69 @@
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2009 by Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ * 
+ * The Initial Developer of the Original Code is: Cédric Bosdonnat.
+ *
+ * Copyright: 2009 by Novell, Inc.
+ *
+ * All Rights Reserved.
+ * 
+ ************************************************************************/
 package org.openoffice.ide.eclipse.java.build;
 
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
+/**
+ * Messages for the package.
+ * 
+ * @author cedricbosdo
+ *
+ */
 public class Messages {
     private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.java.build.messages"; //$NON-NLS-1$
 
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
             .getBundle(BUNDLE_NAME);
 
+    /**
+     * Default constructor.
+     */
     private Messages() {
     }
 
-    public static String getString(String key) {
+    /**
+     * Get the string from it's key.
+     * 
+     * @param pKey the key of the string
+     * 
+     * @return the internationalized string
+     */
+    public static String getString(String pKey) {
+        String string = '!' + pKey + '!';
         try {
-            return RESOURCE_BUNDLE.getString(key);
+            string =  RESOURCE_BUNDLE.getString(pKey);
         } catch (MissingResourceException e) {
-            return '!' + key + '!';
         }
+        return string;
     }
 }
diff --git a/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java b/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java
index d290c3b..671dded 100644
--- a/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java
+++ b/java/source/org/openoffice/ide/eclipse/java/registration/Messages.java
@@ -1,22 +1,69 @@
+/*************************************************************************
+ *
+ * The Contents of this file are made available subject to the terms of
+ * the GNU Lesser General Public License Version 2.1
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2009 by Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ * 
+ * The Initial Developer of the Original Code is: Cédric Bosdonnat.
+ *
+ * Copyright: 2009 by Novell, Inc.
+ *
+ * All Rights Reserved.
+ * 
+ ************************************************************************/
 package org.openoffice.ide.eclipse.java.registration;
 
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
+/**
+ * Messages for the package.
+ * 
+ * @author cedricbosdo
+ *
+ */
 public class Messages {
     private static final String BUNDLE_NAME = "org.openoffice.ide.eclipse.java.registration.messages"; //$NON-NLS-1$
 
     private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
             .getBundle(BUNDLE_NAME);
 
+    /**
+     * Default constructor.
+     */
     private Messages() {
     }
 
-    public static String getString(String key) {
+    /**
+     * Get the string from it's key.
+     * 
+     * @param pKey the key of the string
+     * 
+     * @return the internationalized string
+     */
+    public static String getString(String pKey) {
+        String string = '!' + pKey + '!';
         try {
-            return RESOURCE_BUNDLE.getString(key);
+            string =  RESOURCE_BUNDLE.getString(pKey);
         } catch (MissingResourceException e) {
-            return '!' + key + '!';
         }
+        return string;
     }
 }


More information about the ooo-build-commit mailing list