incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@apache.org
Subject svn commit: r1236486 [5/43] - in /incubator/ooo/devtools/netbeansintegration: ./ build/ build/public-package-jars/ javahelp/ javahelp/org/ javahelp/org/openoffice/ javahelp/org/openoffice/extensions/ javahelp/org/openoffice/extensions/docs/ javahelp/or...
Date Fri, 27 Jan 2012 01:29:58 GMT
Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/Loader.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/Loader.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/Loader.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/Loader.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,390 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Loader.java,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.loader;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Enumeration;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ * This class can be used as a loader for application classes which use UNO.
+ *
+ * <p>The Loader class detects a UNO installation on the system and adds the
+ * UNO jar files to the search path of a customized class loader, which is used
+ * for loading the application classes.</p>
+ */
+public final class Loader {
+
+    private static ClassLoader m_Loader = null;
+
+    /**
+     * do not instantiate
+     */
+    private Loader() {}
+
+    /**
+     * The main method instantiates a customized class loader with the
+     * UNO jar files added to the search path and loads the application class,
+     * which is specified in the Main-Class attribute of the
+     * com/sun/star/lib/Loader.class entry of the manifest file or
+     * as first parameter in the argument list.
+     */
+    public static void main( String[] arguments ) throws Exception {
+        
+        // get the name of the class to be loaded from the manifest
+        String className = null;
+        Class clazz = Loader.class;
+        ClassLoader loader = clazz.getClassLoader();
+        Vector res = new Vector();
+        try {
+            Enumeration en = loader.getResources( "META-INF/MANIFEST.MF" );
+            while ( en.hasMoreElements() ) {
+                res.add( (URL) en.nextElement() );
+            }
+            // the jarfile with the com/sun/star/lib/loader/Loader.class
+            // per-entry attribute is most probably the last resource in the
+            // list, therefore search backwards
+            for ( int i = res.size() - 1; i >= 0; i-- ) {
+                URL jarurl = (URL) res.elementAt( i );
+                try {
+                    JarURLConnection jarConnection =
+                        (JarURLConnection) jarurl.openConnection();
+                    Manifest mf = jarConnection.getManifest();
+                    Attributes attrs = (Attributes) mf.getAttributes(
+                        "com/sun/star/lib/loader/Loader.class" );
+                    if ( attrs != null ) {
+                        className = attrs.getValue( "Application-Class" );
+                        if ( className != null )
+                            break;
+                    }
+                } catch ( IOException e ) {
+                    // if an I/O error occurs when opening a new
+                    // JarURLConnection, ignore this manifest file
+                    System.err.println( "com.sun.star.lib.loader.Loader::" +
+                                        "main: bad manifest file: " + e );
+                }
+            }
+        } catch ( IOException e ) {
+            // if an I/O error occurs when getting the manifest resources,
+            // try to get the name of the class to be loaded from the argument
+            // list
+            System.err.println( "com.sun.star.lib.loader.Loader::" +
+                                "main: cannot get manifest resources: " + e );
+        }
+        
+        // if no manifest entry was found, check first the system property
+        // Application-Class and if it is not set get the name of the class
+        // to be loaded from the argument list
+        String[] args = arguments;            
+        if ( className == null ) {
+            className = System.getProperty("Application-Class");
+            
+            if (className == null) {
+                if ( arguments.length > 0 ) {            
+                    className = arguments[0];            
+                    args = new String[arguments.length - 1];
+                    System.arraycopy( arguments, 1, args, 0, args.length );
+                } else {
+                    throw new IllegalArgumentException(
+                        "The name of the class to be loaded must be either " +
+                        "specified in the Main-Class attribute of the " +
+                        "com/sun/star/lib/loader/Loader.class entry " +
+                        "of the manifest file or as a command line argument." );
+                }
+            }
+        }
+        
+        // load the class with the customized class loader and
+        // invoke the main method
+        if ( className != null ) {
+            ClassLoader cl = getCustomLoader();
+            Class c = cl.loadClass( className );
+            Method m = c.getMethod( "main", new Class[] { String[].class } );
+            m.invoke( null, new Object[] { args } );
+        }
+    }
+
+    /**
+     * Gets the customized class loader with the UNO jar files added to the
+     * search path.
+     *
+     * @return the customized class loader       
+     */
+    public static synchronized ClassLoader getCustomLoader() {
+
+        final String CLASSESDIR = "classes";
+        final String JUHJAR = "juh.jar";
+        
+        if ( m_Loader == null ) {
+            
+            // get the urls from which to load classes and resources
+            // from the class path
+            Vector vec = new Vector();
+            String classpath = null;
+            try {
+                classpath = System.getProperty( "java.class.path" );
+            } catch ( SecurityException e ) {
+                // don't add the class path entries to the list of class
+                // loader URLs
+                System.err.println( "com.sun.star.lib.loader.Loader::" +
+                    "getCustomLoader: cannot get system property " +
+                    "java.class.path: " + e );
+            }
+            if ( classpath != null ) {
+                addUrls(vec, classpath, File.pathSeparator);
+            }
+            
+            // get the urls from which to load classes and resources       
+            // from the UNO installation
+            String path = InstallationFinder.getPath();        
+            if ( path != null ) {            
+                File fClassesDir = new File( path, CLASSESDIR );
+                File fJuh = new File( fClassesDir, JUHJAR );
+                if ( fJuh.exists() ) {
+                    URL[] clurls = new URL[1];
+                    try {
+                        clurls[0] = fJuh.toURL();                
+                        ClassLoader cl = new CustomURLClassLoader( clurls );
+                        Class c = cl.loadClass(
+                            "com.sun.star.comp.helper.UnoInfo" );
+                        Method m = c.getMethod( "getJars", (Class[]) null );
+                        URL[] jarurls = (URL[]) m.invoke(
+                            null, (Object[]) null );
+                        for ( int i = 0; i < jarurls.length; i++ ) {
+                            vec.add( jarurls[i] );
+                        }
+                    } catch ( MalformedURLException e ) {
+                        // don't add the UNO jar files to the list of class
+                        // loader URLs
+                        System.err.println( "com.sun.star.lib.loader.Loader::" +
+                            "getCustomLoader: cannot add UNO jar files: " + e );
+                    } catch ( ClassNotFoundException e ) {
+                        // don't add the UNO jar files to the list of class
+                        // loader URLs
+                        System.err.println( "com.sun.star.lib.loader.Loader::" +
+                            "getCustomLoader: cannot add UNO jar files: " + e );
+                    } catch ( NoSuchMethodException e ) {
+                        // don't add the UNO jar files to the list of class
+                        // loader URLs
+                        System.err.println( "com.sun.star.lib.loader.Loader::" +
+                            "getCustomLoader: cannot add UNO jar files: " + e );
+                    } catch ( IllegalAccessException e ) {
+                        // don't add the UNO jar files to the list of class
+                        // loader URLs
+                        System.err.println( "com.sun.star.lib.loader.Loader::" +
+                            "getCustomLoader: cannot add UNO jar files: " + e );
+                    } catch ( InvocationTargetException e ) {
+                        // don't add the UNO jar files to the list of class
+                        // loader URLs
+                        System.err.println( "com.sun.star.lib.loader.Loader::" +
+                            "getCustomLoader: cannot add UNO jar files: " + e );
+                    }
+                } else {
+                    callUnoinfo(path, vec);
+                }
+            } else {
+                System.err.println( "com.sun.star.lib.loader.Loader::" +
+                    "getCustomLoader: no UNO installation found!" );
+            }
+        
+            // copy urls to array
+            URL[] urls = new URL[vec.size()];
+            vec.toArray( urls );
+
+            // instantiate class loader
+            m_Loader = new CustomURLClassLoader( urls );            
+        }
+
+        return m_Loader;        
+    }
+
+    private static void addUrls(Vector urls, String data, String delimiter) {
+        StringTokenizer tokens = new StringTokenizer( data, delimiter );
+        while ( tokens.hasMoreTokens() ) {
+            try {
+                urls.add( new File( tokens.nextToken() ).toURL() );
+            } catch ( MalformedURLException e ) {
+                // don't add this class path entry to the list of class loader
+                // URLs
+                System.err.println( "com.sun.star.lib.loader.Loader::" +
+                    "getCustomLoader: bad pathname: " + e );
+            }
+        }
+    }
+
+    private static void callUnoinfo(String path, Vector urls) {
+        Process p;
+        try {
+            p = Runtime.getRuntime().exec(
+                new String[] { new File(path, "unoinfo").getPath(), "java" });
+        } catch (IOException e) {
+            System.err.println(
+                "com.sun.star.lib.loader.Loader::getCustomLoader: exec" +
+                " unoinfo: " + e);
+            return;
+        }
+        new Drain(p.getErrorStream()).start();
+        int code;
+        byte[] buf = new byte[1000];
+        int n = 0;
+        try {
+            InputStream s = p.getInputStream();
+            code = s.read();
+            for (;;) {
+                if (n == buf.length) {
+                    if (n > Integer.MAX_VALUE / 2) {
+                        System.err.println(
+                            "com.sun.star.lib.loader.Loader::getCustomLoader:" +
+                            " too much unoinfo output");
+                        return;
+                    }
+                    byte[] buf2 = new byte[2 * n];
+                    for (int i = 0; i < n; ++i) {
+                        buf2[i] = buf[i];
+                    }
+                    buf = buf2;
+                }
+                int k = s.read(buf, n, buf.length - n);
+                if (k == -1) {
+                    break;
+                }
+                n += k;
+            }
+        } catch (IOException e) {
+            System.err.println(
+                "com.sun.star.lib.loader.Loader::getCustomLoader: reading" +
+                " unoinfo output: " + e);
+            return;
+        }
+        int ev;
+        try {
+            ev = p.waitFor();
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            System.err.println(
+                "com.sun.star.lib.loader.Loader::getCustomLoader: waiting for" +
+                " unoinfo: " + e);
+            return;
+        }
+        if (ev != 0) {
+            System.err.println(
+                "com.sun.star.lib.loader.Loader::getCustomLoader: unoinfo"
+                + " exit value " + n);
+            return;
+        }
+        String s;
+        if (code == '0') {
+            s = new String(buf);
+        } else if (code == '1') {
+            try {
+                s = new String(buf, "UTF-16LE");
+            } catch (UnsupportedEncodingException e) {
+                System.err.println(
+                    "com.sun.star.lib.loader.Loader::getCustomLoader:" +
+                    " transforming unoinfo output: " + e);
+                return;
+            }
+        } else {
+            System.err.println(
+                "com.sun.star.lib.loader.Loader::getCustomLoader: bad unoinfo"
+                + " output");
+            return;
+        }
+        addUrls(urls, s, "\0");
+    }
+
+    private static final class Drain extends Thread {
+        public Drain(InputStream stream) {
+            super("unoinfo stderr drain");
+            this.stream = stream;
+        }
+
+        public void run() {
+            try {
+                while (stream.read() != -1) {}
+            } catch (IOException e) { /* ignored */ }
+        }
+
+        private final InputStream stream;
+    }
+
+    /**
+     * A customized class loader which is used to load classes and resources
+     * from a search path of user-defined URLs.
+     */
+    private static final class CustomURLClassLoader extends URLClassLoader {
+        
+        public CustomURLClassLoader( URL[] urls ) {
+            super( urls );
+        }
+
+        protected Class findClass( String name ) throws ClassNotFoundException {
+            // This is only called via this.loadClass -> super.loadClass ->
+            // this.findClass, after this.loadClass has already called
+            // super.findClass, so no need to call super.findClass again:
+            throw new ClassNotFoundException( name );
+        }
+
+        protected Class loadClass( String name, boolean resolve )
+            throws ClassNotFoundException
+        {          
+            Class c = findLoadedClass( name );
+            if ( c == null ) {
+                try {
+                    c = super.findClass( name );
+                } catch ( ClassNotFoundException e ) {
+                    return super.loadClass( name, resolve );
+                } catch ( SecurityException e ) {
+                    // A SecurityException "Prohibited package name: java.lang"
+                    // may occur when the user added the JVM's rt.jar to the
+                    // java.class.path:
+                    return super.loadClass( name, resolve );
+                }
+            }
+            if ( resolve ) {
+                resolveClass( c );
+            }
+            return c;
+        }
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKey.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKey.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKey.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKey.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,203 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WinRegKey.java,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.loader;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+
+/**
+ * This class provides functionality for reading string values from the
+ * Windows Registry. It requires the native library unowinreg.dll.
+ */
+final class WinRegKey {
+    
+    private String m_rootKeyName;
+    private String m_subKeyName;
+            
+    // native methods to access the windows registry
+    private static native boolean winreg_RegOpenClassesRoot( long[] hkresult );
+    private static native boolean winreg_RegOpenCurrentConfig(
+        long[] hkresult );
+    private static native boolean winreg_RegOpenCurrentUser( long[] hkresult );
+    private static native boolean winreg_RegOpenLocalMachine( long[] hkresult );
+    private static native boolean winreg_RegOpenUsers( long[] hkresult );
+    private static native boolean winreg_RegOpenKeyEx( long parent, String name,
+        long[] hkresult );
+    private static native boolean winreg_RegCloseKey( long hkey );    
+    private static native boolean winreg_RegQueryValueEx(
+        long hkey, String value, long[] type, 
+        byte[] data, long[] size );
+    private static native boolean winreg_RegQueryInfoKey(
+        long hkey, long[] subkeys, long[] maxSubkeyLen, 
+        long[] values, long[] maxValueNameLen,
+        long[] maxValueLen, long[] secDescriptor );
+    
+    // load the native library unowinreg.dll
+    static {        
+        try {
+            ClassLoader cl = WinRegKey.class.getClassLoader();            
+            InputStream is = cl.getResourceAsStream( "win/unowinreg.dll" );
+            if ( is != null ) {                
+                // generate a temporary name for lib file and write to temp
+                // location
+                BufferedInputStream istream = new BufferedInputStream( is );
+                File libfile = File.createTempFile( "unowinreg", ".dll" );
+                libfile.deleteOnExit(); // ensure deletion
+                BufferedOutputStream ostream = new BufferedOutputStream(
+                    new FileOutputStream( libfile ) );
+                int bsize = 2048; int n = 0;
+                byte[] buffer = new byte[bsize];
+                while ( ( n = istream.read( buffer, 0, bsize ) ) != -1 ) {
+                    ostream.write( buffer, 0, n );
+                }        
+                istream.close();
+                ostream.close();            
+                // load library
+                System.load( libfile.getPath() );
+            } else {
+                // If the library cannot be found as a class loader resource,
+                // try the global System.loadLibrary(). The JVM will look for
+                // it in the java.library.path.            
+                System.loadLibrary( "unowinreg" );
+            }            
+        } catch ( java.lang.Exception e ) {
+            System.err.println( "com.sun.star.lib.loader.WinRegKey: " +
+                "loading of native library failed!" + e );
+        }
+    }
+    
+    /**
+     * Constructs a <code>WinRegKey</code>.
+     */
+    public WinRegKey( String rootKeyName, String subKeyName ) {
+        m_rootKeyName = rootKeyName;
+        m_subKeyName = subKeyName;
+    }
+
+    /**
+     * Reads a string value for the specified value name.
+     */    
+    public String getStringValue( String valueName ) throws WinRegKeyException {
+        byte[] data = getValue( valueName );
+        // remove terminating null character
+        return new String( data, 0, data.length - 1 );
+    }
+
+    /**
+     * Reads a value for the specified value name.
+     */
+    private byte[] getValue( String valueName ) throws WinRegKeyException {
+        
+        byte[] result = null;
+        long[] hkey = {0};
+        
+        // open the specified registry key
+        boolean bRet = false;
+        long[] hroot = {0};
+        if ( m_rootKeyName.equals( "HKEY_CLASSES_ROOT" ) ) {
+            bRet = winreg_RegOpenClassesRoot( hroot );
+        } else if ( m_rootKeyName.equals( "HKEY_CURRENT_CONFIG" ) ) {
+            bRet = winreg_RegOpenCurrentConfig( hroot );
+        } else if ( m_rootKeyName.equals( "HKEY_CURRENT_USER" ) ) {
+            bRet = winreg_RegOpenCurrentUser( hroot );
+        } else if ( m_rootKeyName.equals( "HKEY_LOCAL_MACHINE" ) ) {
+            bRet = winreg_RegOpenLocalMachine( hroot );
+        } else if ( m_rootKeyName.equals( "HKEY_USERS" ) ) {
+            bRet = winreg_RegOpenUsers( hroot );
+        } else {
+            throw new WinRegKeyException( "unknown root registry key!");
+        }
+        if ( !bRet ) {
+            throw new WinRegKeyException( "opening root registry key " +
+                "failed!" );
+        }
+        if ( !winreg_RegOpenKeyEx( hroot[0], m_subKeyName, hkey ) ) {
+            if ( !winreg_RegCloseKey( hroot[0] ) ) {
+                throw new WinRegKeyException( "opening registry key and " +
+                    "releasing root registry key handle failed!" );
+            }            
+            throw new WinRegKeyException( "opening registry key failed!" );
+        }
+            
+        // get the size of the longest data component among the key's values
+        long[] subkeys = {0};
+        long[] maxSubkeyLen = {0};
+        long[] values = {0};
+        long[] maxValueNameLen = {0};
+        long[] maxValueLen = {0};
+        long[] secDescriptor = {0};
+        if ( !winreg_RegQueryInfoKey( hkey[0], subkeys, maxSubkeyLen,
+                 values, maxValueNameLen, maxValueLen, secDescriptor ) ) {
+            if ( !winreg_RegCloseKey( hkey[0] ) ||
+                 !winreg_RegCloseKey( hroot[0] ) ) {
+                throw new WinRegKeyException( "retrieving information about " +
+                    "the registry key and releasing registry key handles " +
+                    "failed!" );
+            }                
+            throw new WinRegKeyException( "retrieving information about " +
+                "the registry key failed!" );
+        }
+        
+        // get the data for the specified value name
+        byte[] buffer = new byte[ (int) maxValueLen[0] ];        
+        long[] size = new long[1];
+        size[0] = buffer.length;
+        long[] type = new long[1];
+        type[0] = 0;
+        if ( !winreg_RegQueryValueEx( hkey[0], valueName, type, buffer,
+                 size ) ) {
+            if ( !winreg_RegCloseKey( hkey[0] ) ||
+                 !winreg_RegCloseKey( hroot[0] ) ) {
+                throw new WinRegKeyException( "retrieving data for the " +
+                    "specified value name and releasing registry key handles " +
+                    "failed!" );
+            }
+            throw new WinRegKeyException( "retrieving data for the " +
+                "specified value name failed!" );
+        }
+        
+        // release registry key handles
+        if ( !winreg_RegCloseKey( hkey[0] ) ||
+             !winreg_RegCloseKey( hroot[0] ) ) {
+            throw new WinRegKeyException( "releasing registry key handles " +
+                "failed!" );
+        }
+        
+        result = new byte[ (int) size[0] ];
+        System.arraycopy( buffer, 0, result, 0, (int)size[0] );
+        
+        return result;
+    } 
+}

Added: incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKeyException.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKeyException.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKeyException.java (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/UNOClientAppProject/src/com/sun/star/lib/loader/WinRegKeyException.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WinRegKeyException.java,v $
+ * $Revision: 1.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org 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 version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.lib.loader;
+
+/**
+ * WinRegKeyException is a checked exception.
+ */
+final class WinRegKeyException extends java.lang.Exception {    
+    
+    /**
+     * Constructs a <code>WinRegKeyException</code>.
+     */
+    public WinRegKeyException() {
+        super();
+    }
+
+    /**
+     * Constructs a <code>WinRegKeyException</code> with the specified
+     * detail message.
+     *
+	 * @param  message   the detail message
+     */
+    public WinRegKeyException( String message ) {
+        super( message );
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/project_templates/build_project_templates.xml
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/project_templates/build_project_templates.xml?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/project_templates/build_project_templates.xml (added)
+++ incubator/ooo/devtools/netbeansintegration/project_templates/build_project_templates.xml Fri Jan 27 01:29:33 2012
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="changeme" default="all" basedir=".">
+    
+    <target name="-init">
+        <property name="AddOnProject" value="AddOnProject"/>
+        <property name="AddinProject" value="AddinProject"/>
+        <property name="ComponentProject" value="ComponentProject"/>
+        <property name="UNOClientAppProject" value="UNOClientAppProject"/>
+        <property name="templates_target_dir" value="${build.classes.dir}/org/openoffice/extensions/projecttemplates"/>
+    </target>
+
+    <!-- do always the same with every project template: zip to target directory -->
+    <macrodef name="zip_one_template_dir">
+        <attribute name="templatename"/>
+        <attribute name="targetdir"/>
+        <sequential>
+            <zip destfile="@{targetdir}/@{templatename}.zip">
+                <!-- take everything from component except special stuff -->
+                <fileset dir="./project_templates/ComponentProject" includes="**" casesensitive="yes"/>
+                <fileset dir="./project_templates/@{templatename}" includes="**" casesensitive="yes"/>
+            </zip>
+        </sequential>    
+    </macrodef>
+    
+    <!-- zip uno client app -->
+    <target name="-zip_client_app" depends="-init">
+        <zip destfile="${templates_target_dir}/unoclientapplication/UNOClientAppProject.zip">
+            <fileset dir="./project_templates/UNOClientAppProject" includes="**" casesensitive="yes"/>
+        </zip>
+    </target>
+    
+    <!-- create zips from templates -->
+    <target name="create_zip_templates" description="zip all project templates" depends="-init,-zip_client_app">
+        <!-- <mkdir dir="${templates_target_dir}"/> -->
+        <zip_one_template_dir templatename="${AddOnProject}" targetdir="${templates_target_dir}/addon"/>
+        <zip_one_template_dir templatename="${AddinProject}" targetdir="${templates_target_dir}/calcaddin"/>
+        <zip_one_template_dir templatename="${ComponentProject}" targetdir="${templates_target_dir}/component"/>
+    </target>
+    
+</project>

Added: incubator/ooo/devtools/netbeansintegration/readme.txt
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/readme.txt?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/readme.txt (added)
+++ incubator/ooo/devtools/netbeansintegration/readme.txt Fri Jan 27 01:29:33 2012
@@ -0,0 +1,11 @@
+Copyright (c) 2007 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 
+California 95054, U.S.A. All rights reserved.
+
+U.S. Government Rights - Commercial software. Government users are subject to 
+the Sun Microsystems, Inc. standard license agreement and applicable provisions 
+of the FAR and its supplements.
+
+Use is subject to license terms.
+
+Sun, Sun Microsystems and the Sun logo are trademarks or registered trademarks 
+of Sun Microsystems, Inc. in the U.S. and other countries.
\ No newline at end of file

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,20 @@
+OpenIDE-Module-Name=OpenOffice.org API Plugin
+
+OpenIDE-Module-Display-Category=Developing OpenOffice.org
+
+OpenIDE-Module-Short-Description=Support of OpenOffice.org extensions development
+
+OpenIDE-Module-Long-Description=\
+    OpenOffice.org API Plugin is developed by Sun Microsystems Inc.\
+    \n\
+    Support of general OpenOffice.org extensions development. \
+    Several new project types have been introduced to simplify the development of \
+    OpenOffice.org extensions. Some of these new project types are a wizard for OpenOffice.org client \
+    applications using the OpenOffice.org API, support of Calc add-in components and \
+    general UNO components including IDL support.
+
+#org_openoffice_extensions_update_center=http://api.openoffice.org/Projects/NetBeansIntegration/org-openoffice_extension-updates.xml
+#Services/AutoupdateType/org_openoffice_extensions_update_center.settings=OpenOffice.org Preview Update Center
+
+Templates/Project/org-openoffice-extensions=OpenOffice.org
+Templates/org-openoffice-extensions=OpenOffice.org

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_ja.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_ja.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_ja.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_ja.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,37 @@
+# OpenIDE-Module-Name=OpenOffice.org API Plugin
+OpenIDE-Module-Name=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3
+
+# OpenIDE-Module-Display-Category=Developing OpenOffice.org
+OpenIDE-Module-Display-Category=OpenOffice.org \u306e\u958b\u767a
+
+# OpenIDE-Module-Short-Description=Support of OpenOffice.org extensions development
+OpenIDE-Module-Short-Description=OpenOffice.org \u62e1\u5f35\u306e\u958b\u767a\u306e\u30b5\u30dd\u30fc\u30c8
+
+# OpenIDE-Module-Long-Description=\
+#     OpenOffice.org API Plugin is developed by Sun Microsystems Inc.\
+#     \n\
+#     Support of general OpenOffice.org extensions development. \
+#     Several new project types have been introduced to simplify the development of \
+#     OpenOffice.org extensions. Some of these new project types are a wizard for OpenOffice.org client \
+#     applications using the OpenOffice.org API, support of Calc add-in components and \
+#     general UNO components including IDL support.
+
+OpenIDE-Module-Long-Description=\
+    OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306f Sun Microsystems Inc. \u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002\
+    \n\
+    \u4e00\u822c\u7684\u306a OpenOffice.org \u62e1\u5f35\u306e\u958b\u767a\u306e\u30b5\u30dd\u30fc\u30c8\u3002 \
+    OpenOffice.org \u62e1\u5f35\u306e\u958b\u767a\u3092\u5358\u7d14\u5316\u3059\u308b\u305f\u3081\u306b\u3001\u3044\u304f\u3064\u304b\u306e\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7a2e\u985e\u304c\u8ffd\u52a0\u3055\u308c\u307e\u3057\u305f\u3002\
+    \u3053\u308c\u3089\u306e\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u7a2e\u985e\u306e\u4e00\u90e8\u3068\u3057\u3066\u3001Calc \u30a2\u30c9\u30a4\u30f3\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3068\u3001IDL \u30b5\u30dd\u30fc\u30c8\u3092\u542b\u3080\u4e00\u822c\u7684\u306a UNO \
+    \u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u3001OpenOffice.org API \u3092\u4f7f\u7528\u3057\u305f OpenOffice.org \u30af\u30e9\u30a4\u30a2\u30f3\u30c8\
+    \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u7528\u306e\u30a6\u30a3\u30b6\u30fc\u30c9\u304c\u3042\u308a\u307e\u3059\u3002
+
+#org_openoffice_extensions_update_center=http://api.openoffice.org/Projects/NetBeansIntegration/org-openoffice_extension-updates.xml
+#Services/AutoupdateType/org_openoffice_extensions_update_center.settings=OpenOffice.org Preview Update Center
+
+# Templates/Project/org-openoffice-extensions=OpenOffice.org
+Templates/Project/org-openoffice-extensions=OpenOffice.org
+# Templates/org-openoffice-extensions=OpenOffice.org
+Templates/org-openoffice-extensions=OpenOffice.org
+
+
+

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_pt_BR.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_pt_BR.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_pt_BR.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,20 @@
+OpenIDE-Module-Name=OpenOffice.org API Plugin
+
+OpenIDE-Module-Display-Category=Developing OpenOffice.org
+
+OpenIDE-Module-Short-Description=Support of OpenOffice.org extensions development
+
+OpenIDE-Module-Long-Description=\
+    OpenOffice.org API Plugin is developed by Sun Microsystems Inc.\
+    \n\
+    Support of general OpenOffice.org extensions development. \
+    Several new project types have been introduced to simplify the development of \
+    OpenOffice.org extensions. Some of these new project types are a wizard for OpenOffice.org client \
+    applications using the OpenOffice.org API, support of Calc add-in components and \
+    general UNO components including IDL support.
+
+#org_openoffice_extensions_update_center=http://api.openoffice.org/Projects/NetBeansIntegration/org-openoffice_extension-updates.xml
+#Services/AutoupdateType/org_openoffice_extensions_update_center.settings=OpenOffice.org Preview Update Center
+
+Templates/Project/org-openoffice-extensions=OpenOffice.org
+Templates/org-openoffice-extensions=OpenOffice.org

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_zh_CN.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_zh_CN.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_zh_CN.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/Bundle_zh_CN.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,14 @@
+OpenIDE-Module-Name=OpenOffice.org API \u63d2\u4ef6
+
+OpenIDE-Module-Display-Category=\u5f00\u53d1 OpenOffice.org
+
+OpenIDE-Module-Short-Description=\u652f\u6301 OpenOffice.org \u6269\u5c55\u7ec4\u4ef6\u5f00\u53d1
+
+OpenIDE-Module-Long-Description=OpenOffice.org API \u63d2\u4ef6\u662f\u7531 Sun Microsystems Inc. \u5f00\u53d1\u7684\u3002\n\u8be5\u63d2\u4ef6\u652f\u6301\u5e38\u89c4 OpenOffice.org \u6269\u5c55\u7ec4\u4ef6\u5f00\u53d1\uff0c\u6b64\u5916\uff0c\u8fd8\u5f15\u5165\u4e86\u51e0\u79cd\u7528\u4e8e\u7b80\u5316 OpenOffice.org \u6269\u5c55\u7ec4\u4ef6\u5f00\u53d1\u7684\u65b0\u9879\u76ee\u7c7b\u578b\uff0c\u5176\u4e2d\u4e00\u4e9b\u65b0\u9879\u76ee\u7c7b\u578b\u5305\u62ec\uff1a\u7528\u4e8e\u521b\u5efa OpenOffice.org \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\uff08\u4f7f\u7528 OpenOffice.org API\uff09\u7684\u5411\u5bfc\uff0c\u4ee5\u53ca\u7528\u4e8e\u521b\u5efa Calc \u63d2\u4ef6\u7ec4\u4ef6\u548c\u901a\u7528 UNO \u7ec4\u4ef6\uff08\u5305\u62ec IDL \u652f\u6301\uff09\u7684\u5411\u5bfc\u3002
+
+#org_openoffice_extensions_update_center=http://api.openoffice.org/Projects/NetBeansIntegration/org-openoffice_extension-updates.xml
+#Services/AutoupdateType/org_openoffice_extensions_update_center.settings=OpenOffice.org Preview Update Center
+
+Templates/Project/org-openoffice-extensions=OpenOffice.org
+
+Templates/org-openoffice-extensions=OpenOffice.org

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,42 @@
+AdvancedOption_DisplayName=OOo API Plugin
+AdvancedOption_Tooltip=Location of OpenOffice.org and OpenOffice.org SDK
+ConfigurationPanel_Title=OpenOffice.org Settings
+ConfigurationDialog_Title=OpenOffice.org API Plugin Settings
+ConfigurationDialog_ShortTitle=OpenOffice.org Settings
+LogOuptutSettingsDialog_ShortTitle=Log Output
+ConfigurationSettingsPropertiesComment=Configuration File for OpenOffice.org Extensions Development
+
+Browse_OfficeInstallation_Title=Select an OpenOffice.org Installation 
+Browse_SDKInstallation_Title=Select an OpenOffice.org SDK Installation
+Error_OfficeInstallation=The selected OpenOffice.org installation directory is not valid!
+Error_SDKInstallation=The selected OpenOffice.org SDK installation directory is not valid!
+Error_UnknownPlatform=This Operating System/Architecture is not supported by the OpenOffice.org API Plugin!
+
+TF_OfficeInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org installation
+TF_SDKInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org SDK installation
+
+LB_OfficeInstallation=OpenOffice.org Installation\:
+LB_SDKInstallation=OpenOffice.org SDK Installation\:
+TP_InitialSettings_SunDevelopment=OpenOffice.org API plugin is developed by Sun Microsystem, Inc.
+TP_LegalNotice=Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.\n\
+Use is subject to license terms.
+TP_InitialSettings_Description=The OpenOffice.org API plugin must be configured when it is used for the first time. Please specify the path to a valid OpenOffice.org and a valid OpenOffice.org SDK installation.
+BUTTON_Office_Browse=Select a valid OpenOffice.org installation
+BUTTON_SDK_Browse=Select a valid OpenOffice.org SDK installation
+
+LBL_BUTTON_BrowseOffice=B&rowse
+LBL_BUTTON_BrowseSDK=Br&owse
+
+# log output settings
+LBL_Log_Checkbox=Log OpenOffice.org API Plugin Actions
+LBL_LogLevel_ComboBox=Lo&g Level:
+LBL_Store_Directory=&Location:
+LBL_FileName=&File Name:
+LBL_LogProperties=Log Settings
+LBL_ButtonClear=&Clear Log
+LBL_GeneratedFileName=Generated Log File:
+ERROR_NoLogCreated=Cannot create a Log File.
+ERROR_WrongDirectory=The chosen Directory does not exist.
+
+# NOI18N
+default.package=com.example

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_ja.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_ja.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_ja.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_ja.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,80 @@
+# AdvancedOption_DisplayName=OpenOffice.org API Plugin Settings
+AdvancedOption_DisplayName=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8a2d\u5b9a
+# AdvancedOption_Tooltip=Location of OpenOffice.org and OpenOffice.org SDK
+AdvancedOption_Tooltip=OpenOffice.org \u304a\u3088\u3073 OpenOffice.org SDK \u306e\u5834\u6240
+# ConfigurationPanel_Title=OpenOffice.org Settings
+ConfigurationPanel_Title=OpenOffice.org \u306e\u8a2d\u5b9a
+# ConfigurationDialog_Title=OpenOffice.org API Plugin Settings
+ConfigurationDialog_Title=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u8a2d\u5b9a
+# ConfigurationDialog_ShortTitle=OpenOffice.org Settings
+ConfigurationDialog_ShortTitle=OpenOffice.org \u306e\u8a2d\u5b9a
+# LogOuptutSettingsDialog_ShortTitle=Log Output
+LogOuptutSettingsDialog_ShortTitle=\u30ed\u30b0\u306e\u51fa\u529b
+# ConfigurationSettingsPropertiesComment=Configuration File for OpenOffice.org Extensions Development
+ConfigurationSettingsPropertiesComment=OpenOffice.org \u62e1\u5f35\u306e\u958b\u767a\u7528\u306e\u69cb\u6210\u30d5\u30a1\u30a4\u30eb
+
+# Browse_OfficeInstallation_Title=Select an OpenOffice.org Installation 
+Browse_OfficeInstallation_Title=OpenOffice.org \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u9078\u629e 
+# Browse_SDKInstallation_Title=Select an OpenOffice.org SDK Installation
+Browse_SDKInstallation_Title=OpenOffice.org SDK \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u9078\u629e
+# Error_OfficeInstallation=The selected OpenOffice.org installation directory is not valid!
+Error_OfficeInstallation=\u9078\u629e\u3057\u305f OpenOffice.org \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u52b9\u3067\u3059\u3002
+# Error_SDKInstallation=The selected OpenOffice.org SDK installation directory is not valid!
+Error_SDKInstallation=\u9078\u629e\u3057\u305f OpenOffice.org SDK \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u7121\u52b9\u3067\u3059\u3002
+# Error_UnknownPlatform=This Operating System/Architecture is not supported by the OpenOffice.org API Plugin!
+Error_UnknownPlatform=\u3053\u306e\u30aa\u30da\u30ec\u30fc\u30c6\u30a3\u30f3\u30b0\u30b7\u30b9\u30c6\u30e0/\u30a2\u30fc\u30ad\u30c6\u30af\u30c1\u30e3\u30fc\u306f OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u3067\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002
+
+# TF_OfficeInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org installation
+TF_OfficeInstallation_Tooltip=\u6709\u52b9\u306a OpenOffice.org \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u306e\u30d1\u30b9
+# TF_SDKInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org SDK installation
+TF_SDKInstallation_Tooltip=\u6709\u52b9\u306a OpenOffice.org SDK \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u306e\u30d1\u30b9
+
+# LB_OfficeInstallation=OpenOffice.org Installation\:
+LB_OfficeInstallation=OpenOffice.org \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\:
+# LB_SDKInstallation=OpenOffice.org SDK Installation\:
+LB_SDKInstallation=OpenOffice.org SDK \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\:
+# TP_InitialSettings_SunDevelopment=OpenOffice.org API plugin is developed by Sun Microsystem, Inc.
+TP_InitialSettings_SunDevelopment=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306f Sun Microsystem, Inc. \u306b\u3088\u3063\u3066\u958b\u767a\u3055\u308c\u307e\u3057\u305f\u3002
+# TP_LegalNotice=Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.\n\
+# Use is subject to license terms.
+
+TP_LegalNotice=Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.\n\
+Use is subject to license terms.
+# TP_InitialSettings_Description=The OpenOffice.org API plugin must be configured when it is used for the first time. Please specify the path to a valid OpenOffice.org and a valid OpenOffice.org SDK installation.
+TP_InitialSettings_Description=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u3001\u6700\u521d\u306b\u4f7f\u7528\u3059\u308b\u3068\u304d\u306b\u69cb\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u6709\u52b9\u306a OpenOffice.org \u304a\u3088\u3073\u6709\u52b9\u306a OpenOffice.org SDK \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3078\u306e\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002
+# BUTTON_Office_Browse=Select a valid OpenOffice.org installation
+BUTTON_Office_Browse=\u6709\u52b9\u306a OpenOffice.org \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u9078\u629e
+# BUTTON_SDK_Browse=Select a valid OpenOffice.org SDK installation
+BUTTON_SDK_Browse=\u6709\u52b9\u306a OpenOffice.org SDK \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u9078\u629e
+
+# LBL_BUTTON_BrowseOffice=B&rowse
+LBL_BUTTON_BrowseOffice=\u53c2\u7167(&R)
+# LBL_BUTTON_BrowseSDK=Br&owse
+LBL_BUTTON_BrowseSDK=\u53c2\u7167(&O)
+
+# log output settings
+# LBL_Log_Checkbox=Log OpenOffice.org API Plugin Actions
+LBL_Log_Checkbox=OpenOffice.org API \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u3092\u30ed\u30b0\u51fa\u529b
+# LBL_LogLevel_ComboBox=Log Level:
+LBL_LogLevel_ComboBox=\u30ed\u30b0\u30ec\u30d9\u30eb:
+# LBL_Store_Directory=Location:
+LBL_Store_Directory=\u5834\u6240:
+# LBL_FileName=File Name:
+LBL_FileName=\u30d5\u30a1\u30a4\u30eb\u540d:
+# LBL_LogProperties=Log Settings
+LBL_LogProperties=\u30ed\u30b0\u306e\u8a2d\u5b9a
+# LBL_ButtonClear=&Clear Log
+LBL_ButtonClear=\u30ed\u30b0\u3092\u6d88\u53bb(&C)
+# LBL_GeneratedFileName=Generated Log File:
+LBL_GeneratedFileName=\u751f\u6210\u3055\u308c\u308b\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb:
+# ERROR_NoLogCreated=Cannot create a Log File.
+ERROR_NoLogCreated=\u30ed\u30b0\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002
+# ERROR_WrongDirectory=The chosen Directory does not exist.
+ERROR_WrongDirectory=\u9078\u629e\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u5b58\u5728\u3057\u307e\u305b\u3093\u3002
+
+# NOI18N
+# default.package=com.example
+default.package=com.example
+
+
+

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_pt_BR.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_pt_BR.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_pt_BR.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_pt_BR.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,42 @@
+AdvancedOption_DisplayName=OpenOffice.org API Plugin Settings
+AdvancedOption_Tooltip=Location of OpenOffice.org and OpenOffice.org SDK
+ConfigurationPanel_Title=OpenOffice.org Settings
+ConfigurationDialog_Title=OpenOffice.org API Plugin Settings
+ConfigurationDialog_ShortTitle=OpenOffice.org Settings
+LogOuptutSettingsDialog_ShortTitle=Log Output
+ConfigurationSettingsPropertiesComment=Configuration File for OpenOffice.org Extensions Development
+
+Browse_OfficeInstallation_Title=Select an OpenOffice.org Installation 
+Browse_SDKInstallation_Title=Select an OpenOffice.org SDK Installation
+Error_OfficeInstallation=The selected OpenOffice.org installation directory is not valid!
+Error_SDKInstallation=The selected OpenOffice.org SDK installation directory is not valid!
+Error_UnknownPlatform=This Operating System/Architecture is not supported by the OpenOffice.org API Plugin!
+
+TF_OfficeInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org installation
+TF_SDKInstallation_Tooltip=The path to the root directory of a valid OpenOffice.org SDK installation
+
+LB_OfficeInstallation=OpenOffice.org Installation\:
+LB_SDKInstallation=OpenOffice.org SDK Installation\:
+TP_InitialSettings_SunDevelopment=OpenOffice.org API plugin is developed by Sun Microsystem, Inc.
+TP_LegalNotice=Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.\n\
+Use is subject to license terms.
+TP_InitialSettings_Description=The OpenOffice.org API plugin must be configured when it is used for the first time. Please specify the path to a valid OpenOffice.org and a valid OpenOffice.org SDK installation.
+BUTTON_Office_Browse=Select a valid OpenOffice.org installation
+BUTTON_SDK_Browse=Select a valid OpenOffice.org SDK installation
+
+LBL_BUTTON_BrowseOffice=B&rowse
+LBL_BUTTON_BrowseSDK=Br&owse
+
+# log output settings
+LBL_Log_Checkbox=Log OpenOffice.org API Plugin Actions
+LBL_LogLevel_ComboBox=Log Level:
+LBL_Store_Directory=Location:
+LBL_FileName=File Name:
+LBL_LogProperties=Log Settings
+LBL_ButtonClear=&Clear Log
+LBL_GeneratedFileName=Generated Log File:
+ERROR_NoLogCreated=Cannot create a Log File.
+ERROR_WrongDirectory=The chosen Directory does not exist.
+
+# NOI18N
+default.package=com.example

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_zh_CN.properties
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_zh_CN.properties?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_zh_CN.properties (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/Bundle_zh_CN.properties Fri Jan 27 01:29:33 2012
@@ -0,0 +1,40 @@
+AdvancedOption_DisplayName=OpenOffice.org API \u63d2\u4ef6\u8bbe\u7f6e
+AdvancedOption_Tooltip=OpenOffice.org \u548c OpenOffice.org SDK \u7684\u4f4d\u7f6e
+ConfigurationPanel_Title=OpenOffice.org \u8bbe\u7f6e
+ConfigurationDialog_Title=OpenOffice.org API \u63d2\u4ef6\u8bbe\u7f6e
+ConfigurationDialog_ShortTitle=OpenOffice.org \u8bbe\u7f6e
+LogOuptutSettingsDialog_ShortTitle=\u65e5\u5fd7\u8f93\u51fa
+ConfigurationSettingsPropertiesComment=\u7528\u4e8e OpenOffice.org \u6269\u5c55\u7ec4\u4ef6\u5f00\u53d1\u7684\u914d\u7f6e\u6587\u4ef6
+
+Browse_OfficeInstallation_Title=\u9009\u62e9\u4e00\u4e2a OpenOffice.org \u5b89\u88c5 
+Browse_SDKInstallation_Title=\u9009\u62e9\u4e00\u4e2a OpenOffice.org SDK \u5b89\u88c5
+Error_OfficeInstallation=\u9009\u5b9a\u7684 OpenOffice.org \u5b89\u88c5\u76ee\u5f55\u65e0\u6548\uff01
+Error_SDKInstallation=\u9009\u5b9a\u7684 OpenOffice.org SDK \u5b89\u88c5\u76ee\u5f55\u65e0\u6548\uff01
+Error_UnknownPlatform=OpenOffice.org API \u63d2\u4ef6\u4e0d\u652f\u6301\u6b64\u64cd\u4f5c\u7cfb\u7edf/\u4f53\u7cfb\u7ed3\u6784\uff01
+
+TF_OfficeInstallation_Tooltip=\u6709\u6548 OpenOffice.org \u5b89\u88c5\u7684\u6839\u76ee\u5f55\u8def\u5f84
+TF_SDKInstallation_Tooltip=\u6709\u6548 OpenOffice.org SDK \u5b89\u88c5\u7684\u6839\u76ee\u5f55\u8def\u5f84
+
+LB_OfficeInstallation=OpenOffice.org \u5b89\u88c5\uff1a
+LB_SDKInstallation=OpenOffice.org SDK \u5b89\u88c5\uff1a
+TP_InitialSettings_SunDevelopment=OpenOffice.org API \u63d2\u4ef6\u662f\u7531 Sun Microsystem, Inc. \u5f00\u53d1\u7684\u3002
+TP_LegalNotice=\u7248\u6743\u6240\u6709 (C) 2007 Sun Microsystems, Inc. \u4fdd\u7559\u6240\u6709\u6743\u5229\u3002\n\u5fc5\u987b\u4f9d\u636e\u8bb8\u53ef\u8bc1\u6761\u6b3e\u4f7f\u7528\u3002
+TP_InitialSettings_Description=\u7b2c\u4e00\u6b21\u4f7f\u7528 OpenOffice.org API \u63d2\u4ef6\u65f6\uff0c\u5fc5\u987b\u5bf9\u5176\u8fdb\u884c\u914d\u7f6e\u3002\u8bf7\u6307\u5b9a\u6709\u6548\u7684 OpenOffice.org \u548c OpenOffice.org SDK \u5b89\u88c5\u8def\u5f84\u3002
+BUTTON_Office_Browse=\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 OpenOffice.org \u5b89\u88c5
+BUTTON_SDK_Browse=\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 OpenOffice.org SDK \u5b89\u88c5
+
+LBL_BUTTON_BrowseOffice=\u6d4f\u89c8(&R)
+LBL_BUTTON_BrowseSDK=\u6d4f\u89c8(&O)
+# log output settings
+LBL_Log_Checkbox=\u8bb0\u5f55 OpenOffice.org API \u63d2\u4ef6\u64cd\u4f5c
+LBL_LogLevel_ComboBox=\u65e5\u5fd7\u7ea7\u522b\uff1a
+LBL_Store_Directory=\u4f4d\u7f6e\uff1a
+LBL_FileName=\u6587\u4ef6\u540d\uff1a
+LBL_LogProperties=\u65e5\u5fd7\u8bbe\u7f6e
+LBL_ButtonClear=\u6e05\u9664\u65e5\u5fd7(&C)
+LBL_GeneratedFileName=\u751f\u6210\u7684\u65e5\u5fd7\u6587\u4ef6\uff1a
+ERROR_NoLogCreated=\u65e0\u6cd5\u521b\u5efa\u65e5\u5fd7\u6587\u4ef6\u3002
+ERROR_WrongDirectory=\u9009\u62e9\u7684\u76ee\u5f55\u4e0d\u5b58\u5728\u3002
+
+# NOI18N
+default.package=com.example

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/CodeTemplates.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/CodeTemplates.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/CodeTemplates.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/CodeTemplates.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,343 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: CodeTemplates.java,v $
+ *
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: jsc $ $Date: 2009/07/16 11:37:09 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+package org.openoffice.extensions.config;
+
+import java.io.BufferedWriter;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.Collection;
+import javax.swing.text.EditorKit;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import org.netbeans.lib.editor.codetemplates.api.CodeTemplate;
+import org.netbeans.lib.editor.codetemplates.api.CodeTemplateManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.FileUtil;
+import org.openide.text.CloneableEditorSupport;
+import org.openide.xml.XMLUtil;
+import org.openoffice.extensions.util.LogWriter;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * Extend the code templates of Java in NetBeans with some cool stuff for 
+ * OpenOffice.org. 
+ * @author sg128468
+ */
+public class CodeTemplates {
+
+    private static final String HEADER = 
+        ("/*************************************************************************\n").concat
+        (" *\n").concat
+        (" * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n").concat
+        (" *\n").concat
+        (" * Copyright 2008 by Sun Microsystems, Inc.\n").concat
+        (" *\n").concat
+        (" * OpenOffice.org - a multi-platform office productivity suite\n").concat
+        (" *\n").concat
+        (" * $").concat("RCSfile: XY.java,v $\n").concat
+        (" * $").concat("Revision: 1.0 $\n").concat
+        (" *\n").concat
+        (" * This file is part of OpenOffice.org.\n").concat
+        (" *\n").concat
+        (" * OpenOffice.org is free software: you can redistribute it and/or modify\n").concat
+        (" * it under the terms of the GNU Lesser General Public License version 3\n").concat
+        (" * only, as published by the Free Software Foundation.\n").concat
+        (" *\n").concat
+        (" * OpenOffice.org is distributed in the hope that it will be useful,\n").concat
+        (" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n").concat
+        (" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n").concat
+        (" * GNU Lesser General Public License version 3 for more details\n").concat
+        (" * (a copy is included in the LICENSE file that accompanied this code).\n").concat
+        (" *\n").concat
+        (" * You should have received a copy of the GNU Lesser General Public License\n").concat
+        (" * version 3 along with OpenOffice.org.  If not, see\n").concat
+        (" * <http://www.openoffice.org/license.html>\n").concat
+        (" * for a copy of the LGPLv3 License.\n").concat
+        (" *\n").concat
+        (" ************************************************************************/\n");
+
+    /**
+     * Array for all templates in form "Abbreviation" and "Expanded Code" 
+     */
+    private static final String[][] theTemplates = new String[][] {
+        // UnoRUntime.queryInterface
+        {"urqi", "X${Interface} x${Interface} = (X${Interface})UnoRuntime.queryInterface(X${Interface}.class, ${EXP leftSideType instanceof=\"java.lang.Object\" default=\"oObject\"});"},
+        // ooo header
+        {"oohd", HEADER},
+//        TODO: add further templates
+//        {"", ""},
+    }; // NOI18N
+    
+    Document m_DescriptionDocument;
+    FileObject m_JavaCustomCodeTemplates;
+    boolean m_FileNeedsSaving;
+    private FileObject m_PreferencesFolder;
+    
+    public CodeTemplates(){
+//         Lookup l = MimeLookup.getLookup(MimePath.parse("text/x-java"));
+//         CodeTemplateSettings cds = l.lookup(CodeTemplateSettings.class);
+//         List<CodeTemplateDescription> codeTemplates = cds.getCodeTemplateDescriptions();
+//         for (Iterator<CodeTemplateDescription> it = codeTemplates.iterator(); it.hasNext();) {
+//             CodeTemplateDescription object = it.next();
+//             System.out.println("Abb " + object.getAbbreviation());
+//        }
+    }
+    
+    public static void createTemplates() {
+        CodeTemplates tem = new CodeTemplates();
+        // get files or create if necessary
+        tem.createNecessaryFolders();
+        // read the file
+        tem.readXmlFile();
+        // crate an empty document if necessary
+        if (tem.m_DescriptionDocument == null) {
+            tem.createDocument();
+        }
+        // insert OOo code templates
+        tem.addTheTemplates();
+        if (tem.m_FileNeedsSaving) {
+            // save back
+            tem.saveTemplates();
+        }
+        
+        // force reading the code templates ??
+        EditorKit kit = CloneableEditorSupport.getEditorKit("text/x-java");
+        javax.swing.text.Document doc = kit.createDefaultDocument();
+        CodeTemplateManager manager = CodeTemplateManager.get(doc);
+        manager.waitLoaded();
+        Collection<? extends CodeTemplate> codeTemplates = manager.getCodeTemplates();
+//        for (CodeTemplate codeTemplate : codeTemplates) {
+//            System.out.println("Abb: " + codeTemplate.getAbbreviation());     
+//        }
+    }
+
+    private void createDocument() {
+        // annoyingly enough, the folowing does not work, no idea why.
+//            try {
+//                DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+//                DocumentBuilder builder = builderFactory.newDocumentBuilder();
+//                DOMImplementation domImpl = builder.getDOMImplementation();
+//                
+//                DocumentType type = domImpl.createDocumentType(
+//                        "codetemplates", 
+//                        "-//NetBeans//DTD Editor Code Templates settings 1.0//EN", 
+//                        "http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd");
+//                m_DescriptionDocument = domImpl.createDocument(null, null, type);
+//            } catch (ParserConfigurationException ex) {
+//                Exceptions.printStackTrace(ex);
+//            }
+        
+        // so instead, write minimal xml doc and load it - any better ideas?
+        OutputStream outStream = null;
+        try {
+            // if description not already exists, create it
+            if (m_JavaCustomCodeTemplates == null) {
+                m_JavaCustomCodeTemplates = m_PreferencesFolder.createData("org-netbeans-modules-editor-settings-CustomCodeTemplates", "xml"); // NOI18N
+            }
+
+            final String dummyXmlDoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n".concat(
+                    "<!DOCTYPE codetemplates PUBLIC \"-//NetBeans//DTD Editor Code Templates settings 1.0//EN\" \"http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd\">\n").concat(
+                    "<codetemplates>\n").concat(
+                    "</codetemplates>\n"); // NOI18N
+
+            outStream = m_JavaCustomCodeTemplates.getOutputStream();
+            BufferedWriter buf = new BufferedWriter(new OutputStreamWriter(outStream));
+            buf.write(dummyXmlDoc);
+            buf.flush();
+            
+        }
+        catch (FileNotFoundException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        catch (IOException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        finally {
+            try {
+                if (outStream != null)
+                    outStream.close();
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+        readXmlFile();
+    }
+    
+    private void addTheTemplates() {
+        m_FileNeedsSaving = false;
+        if (m_DescriptionDocument != null) {
+            NodeList templatesList = m_DescriptionDocument.getElementsByTagName("codetemplates"); // NOI18N
+            Node templatesNode = templatesList.item(0);
+            NodeList codeTemplateList = templatesNode.getChildNodes();
+            for (int i = 0; i < theTemplates.length; i++) {
+                String abbreviation = theTemplates[i][0];
+                if (!hasChildNodeWithAbbreviation(codeTemplateList, abbreviation)) {
+                    Element newTemplate = m_DescriptionDocument.createElement("codetemplate"); // NOI18N
+                    newTemplate.setAttribute("abbreviation", abbreviation); // NOI18N
+                    newTemplate.setAttribute("xml:space", "preserve"); // NOI18N
+                    // worked until (and including) NB 6.1
+/*                    Element newCode = m_DescriptionDocument.createElement("code"); // NOI18N
+                    newCode.setTextContent(theTemplates[i][1]);
+                    newTemplate.appendChild(newCode);
+                    templatesNode.appendChild(newTemplate); */
+                    // new part for NB 6.5
+                    Element newCode = m_DescriptionDocument.createElement("code"); // NOI18N
+                    CDATASection section = m_DescriptionDocument.createCDATASection(theTemplates[i][1]);
+                    newCode.appendChild(section);
+                    newTemplate.appendChild(newCode);
+                    templatesNode.appendChild(newTemplate);
+                    // added at least one template, need saving
+                    m_FileNeedsSaving = true;
+                }
+            }
+        }
+    }
+    
+    private void saveTemplates() {
+        OutputStream outStream = null;
+        try {
+            // if description not already exists, create it
+            if (m_JavaCustomCodeTemplates == null) {
+                m_JavaCustomCodeTemplates = m_PreferencesFolder.createData("org-netbeans-modules-editor-settings-CustomCodeTemplates", "xml"); // NOI18N
+            }
+
+            // Transmit the request document
+            outStream = m_JavaCustomCodeTemplates.getOutputStream();
+
+            XMLUtil.write(m_DescriptionDocument, outStream, "UTF-8"); // NOI18N
+            outStream.flush();
+        }
+        catch (FileNotFoundException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        catch (IOException ex) {
+            LogWriter.getLogWriter().printStackTrace(ex);
+        }
+        finally {
+            try {
+                if (outStream != null)
+                    outStream.close();
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+        }
+    }
+
+    private void createNecessaryFolders() {
+        FileObject editors = FileUtil.getConfigRoot().getFileObject("Editors"); // NOI18N
+        try {
+            FileObject textFolder = getOrCreateFileObject(editors, "text"); // NOI18N
+            FileObject javaFolder = getOrCreateFileObject(textFolder, "x-java"); // NOI18N
+            m_PreferencesFolder = getOrCreateFileObject(javaFolder, "CodeTemplates"); // NOI18N
+            m_JavaCustomCodeTemplates = m_PreferencesFolder.getFileObject("org-netbeans-modules-editor-settings-CustomCodeTemplates", "xml"); // NOI18N
+        } catch (IOException ex) {
+             LogWriter.getLogWriter().printStackTrace(ex);
+        }
+    }
+    
+    private void readXmlFile() {
+        if (m_JavaCustomCodeTemplates != null) {
+            InputStream inStream = null;
+            try {
+                inStream = m_JavaCustomCodeTemplates.getInputStream();
+                DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
+                DocumentBuilder builder = builderFactory.newDocumentBuilder(); 
+                m_DescriptionDocument = builder.parse(inStream);
+
+            } catch (ParserConfigurationException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            } catch (SAXException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            } catch (IOException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            } catch (NullPointerException ex) {
+                LogWriter.getLogWriter().printStackTrace(ex);
+            }
+            finally {
+                try {
+                    if (inStream != null)
+                        inStream.close();
+                } catch (IOException ex) {
+                    LogWriter.getLogWriter().printStackTrace(ex);
+                }
+            }
+        }
+    }
+    
+    private boolean hasChildNodeWithAbbreviation(NodeList parentNode, String abbreviationValue) {
+        if (parentNode != null || abbreviationValue != null) {
+            for (int i = 0; i < parentNode.getLength(); i++) {
+                Node cand = parentNode.item(i);
+                if (cand != null) {
+                    NamedNodeMap attributes = cand.getAttributes();
+                    if (attributes != null) {
+                        Node attrNode = attributes.getNamedItem("abbreviation"); // NOI18N
+                        if (attrNode != null) {
+                            String value = attrNode.getNodeValue();
+                            if (abbreviationValue.equals(value)) {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return false;
+    }
+    
+    private FileObject getOrCreateFileObject(FileObject root, String name) throws IOException {
+        if (root == null) {
+            throw new IOException("Could not create file object " + name); // NOI18N
+        }
+        FileObject newObject = root.getFileObject(name);
+        if (newObject == null) {
+            newObject = root.createFolder(name);
+            if (newObject == null) {
+                throw new IOException("Could not create file object " + name); // NOI18N
+            }
+        }
+        return newObject;
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationAdvancedOption.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationAdvancedOption.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationAdvancedOption.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationAdvancedOption.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: ConfigurationAdvancedOption.java,v $
+ *
+ *  $Revision: 1.2 $
+ *
+ *  last change: $Author: sg $ $Date: 2007/05/03 09:49:48 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.config;
+
+import org.netbeans.spi.options.AdvancedOption;
+import org.netbeans.spi.options.OptionsPanelController;
+import org.openide.util.NbBundle;
+
+public final class ConfigurationAdvancedOption extends AdvancedOption {
+    
+    public String getDisplayName() {
+        return NbBundle.getMessage(ConfigurationAdvancedOption.class, "AdvancedOption_DisplayName"); // NOI18N
+    }
+    
+    public String getTooltip() {
+        return NbBundle.getMessage(ConfigurationAdvancedOption.class, "AdvancedOption_Tooltip"); // NOI18N
+    }
+    
+    public OptionsPanelController create() {
+        return new ConfigurationOptionsPanelController();
+    }
+    
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.form
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.form?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.form (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.form Fri Jan 27 01:29:33 2012
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.3" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <AuxValues>
+    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+  </AuxValues>
+
+  <Layout>
+    <DimensionLayout dim="0">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="0" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="m_ConfigurationTabs" pref="376" max="32767" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+    <DimensionLayout dim="1">
+      <Group type="103" groupAlignment="0" attributes="0">
+          <Group type="102" alignment="1" attributes="0">
+              <EmptySpace max="-2" attributes="0"/>
+              <Component id="m_ConfigurationTabs" pref="276" max="32767" attributes="0"/>
+              <EmptySpace max="-2" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Container class="javax.swing.JTabbedPane" name="m_ConfigurationTabs">
+      <Properties>
+        <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+          <Color blue="ee" green="ee" red="ee" type="rgb"/>
+        </Property>
+      </Properties>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
+    </Container>
+  </SubComponents>
+</Form>

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsContainer.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: ConfigurationOptionsContainer.java,v $
+ *
+ *  $Revision: 1.2 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/07 08:52:40 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.config;
+
+import org.openide.util.NbBundle;
+
+/**
+ *
+ * @author  sg128468
+ */
+public class ConfigurationOptionsContainer extends javax.swing.JPanel {
+    
+    private ConfigurationPanel m_ConfigurationPanel;
+    private LogOutputSettingsDialog m_LogSettingsPanel;
+    
+    /** Creates new form ConfigurationOptionsContainer */
+    public ConfigurationOptionsContainer(String officeInstallation, String sdkInstallation) {
+        initComponents();
+        m_ConfigurationPanel = new ConfigurationPanel(officeInstallation, sdkInstallation);
+        m_LogSettingsPanel = new LogOutputSettingsDialog();
+        String panel1Title = NbBundle.getMessage(ConfigurationPanel.class, "ConfigurationDialog_ShortTitle");
+        String panel2Title = NbBundle.getMessage(ConfigurationPanel.class, "LogOuptutSettingsDialog_ShortTitle");
+        m_ConfigurationTabs.addTab(panel1Title, m_ConfigurationPanel);
+        m_ConfigurationTabs.addTab(panel2Title, m_LogSettingsPanel);
+    }
+    
+    /** This method is called from within the constructor to
+     * initialize the form.
+     * WARNING: Do NOT modify this code. The content of this method is
+     * always regenerated by the Form Editor.
+     */
+    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+    private void initComponents() {
+
+        m_ConfigurationTabs = new javax.swing.JTabbedPane();
+
+        m_ConfigurationTabs.setBackground(new java.awt.Color(238, 238, 238));
+
+        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(layout.createSequentialGroup()
+                .addContainerGap()
+                .add(m_ConfigurationTabs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 376, Short.MAX_VALUE)
+                .addContainerGap())
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
+                .addContainerGap()
+                .add(m_ConfigurationTabs, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE)
+                .addContainerGap())
+        );
+    }// </editor-fold>//GEN-END:initComponents
+    
+    
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JTabbedPane m_ConfigurationTabs;
+    // End of variables declaration//GEN-END:variables
+    
+    public void setOffice(String office) {
+        m_ConfigurationPanel.setOffice(office);
+    }
+    
+    public void setSDK(String sdk) {
+        m_ConfigurationPanel.setSDK(sdk);
+    }
+
+    public String getOffice() {
+        return m_ConfigurationPanel.getOffice();
+    }
+    
+    public String getSDK() {
+        return m_ConfigurationPanel.getSDK();
+    }
+    
+    public void updateLogging() {
+        m_LogSettingsPanel.initializeFields();
+    }
+
+    public String getLogLevel() {
+        return m_LogSettingsPanel.getLogLevel();
+    }
+    
+    public String getLogFile() {
+        return m_LogSettingsPanel.getLogFile();
+    }
+    
+    public boolean valid() {
+        return m_ConfigurationPanel.valid() && m_LogSettingsPanel.valid();
+    }
+}

Added: incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsPanelController.java
URL: http://svn.apache.org/viewvc/incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsPanelController.java?rev=1236486&view=auto
==============================================================================
--- incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsPanelController.java (added)
+++ incubator/ooo/devtools/netbeansintegration/src/org/openoffice/extensions/config/ConfigurationOptionsPanelController.java Fri Jan 27 01:29:33 2012
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
+ *  $RCSfile: ConfigurationOptionsPanelController.java,v $
+ *
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: sg $ $Date: 2008/10/13 08:43:18 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
+ *
+ ************************************************************************/
+
+package org.openoffice.extensions.config;
+
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeSupport;
+import javax.swing.JComponent;
+import org.netbeans.spi.options.OptionsPanelController;
+import org.openide.util.HelpCtx;
+import org.openide.util.Lookup;
+import org.openoffice.extensions.config.office.OpenOfficeLocation;
+
+final class ConfigurationOptionsPanelController extends OptionsPanelController {
+
+    private static final String HELP_CTX_STRING = 
+            "org.openoffice.extensions.config.paths"; // NOI18N
+    
+    private ConfigurationOptionsContainer panel;
+    private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
+    private boolean changed;
+    
+    private ConfigurationSettings settings;
+
+    public void update() {
+        panel.setOffice(settings.getValue(settings.KEY_OFFICE_INSTALLATION));
+        panel.setSDK(settings.getValue(settings.KEY_SDK_INSTALLATION));
+        panel.updateLogging();
+//        getPanel().load();
+//        changed = false;
+    }
+    
+    public void applyChanges() {
+        settings.setValue(settings.KEY_OFFICE_INSTALLATION, panel.getOffice());
+        settings.setValue(settings.KEY_SDK_INSTALLATION, panel.getSDK());
+        settings.setValue(settings.KEY_LOG_LEVEL, panel.getLogLevel());
+        settings.setValue(settings.KEY_LOG_FILE, panel.getLogFile());
+        settings.store();
+        changed=false;        
+//        getPanel().store();
+//        changed = false;
+    }
+    
+    public void cancel() {
+        // need not do anything special, if no changes have been persisted yet
+    }
+    
+    public boolean isValid() {
+        return panel.valid();
+    }
+    
+    public boolean isChanged() {
+        return (panel.getOffice().trim().equals(settings.getValue(settings.KEY_OFFICE_INSTALLATION)) ||
+                panel.getSDK().trim().equals(settings.getValue(settings.KEY_SDK_INSTALLATION)));
+//        return changed;
+    }
+    
+    public HelpCtx getHelpCtx() {
+        return new HelpCtx(HELP_CTX_STRING);
+    }
+    
+    public JComponent getComponent(Lookup masterLookup) {
+        return panel;
+    }
+    
+    public void addPropertyChangeListener(PropertyChangeListener l) {
+        pcs.addPropertyChangeListener(l);
+    }
+    
+    public void removePropertyChangeListener(PropertyChangeListener l) {
+        pcs.removePropertyChangeListener(l);
+    }
+    
+//    private ConfigurationOptionsContainer getPanel() {
+//        if (panel == null) {
+//            panel = new ConfigurationPanel(settings.getValue(settings.KEY_OFFICE_INSTALLATION),
+//                                           settings.getValue(settings.KEY_SDK_INSTALLATION));
+//        }
+//        return panel;
+//    }
+    
+    void changed() {
+        if (!changed) {
+            changed = true;
+            pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true);
+        }
+        pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
+    }
+    
+    public ConfigurationOptionsPanelController() {
+        settings = ConfigurationSettings.getSettings();
+        
+        panel = new ConfigurationOptionsContainer(
+            settings.getValue(settings.KEY_OFFICE_INSTALLATION),
+            settings.getValue(settings.KEY_SDK_INSTALLATION));
+    }
+}



Mime
View raw message