moving core.browser.djnsswt to contrib
authorS. Aubrecht <saubrecht@netbeans.org>
Thu, 30 Aug 2012 10:56:16 +0200
changeset 178689734b6cc4893
parent 17864 97d2e276491b
child 17870 367d3813e6b7
child 17877 0bb3bf4d65f8
moving core.browser.djnsswt to contrib
core.browser.djnsswt/build.xml
core.browser.djnsswt/manifest.mf
core.browser.djnsswt/nbproject/project.properties
core.browser.djnsswt/nbproject/project.xml
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserCallback.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserFactory.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserFactoryBeanInfo.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserType.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Bundle.properties
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/EmbeddedBrowserEditor.form
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/EmbeddedBrowserEditor.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/ExplorerBrowserFactoryImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/HtmlBrowserImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Installer.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/MozillaBrowserFactoryImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Platform.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebBrowserEventImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebBrowserImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebkitBrowserFactoryImpl.java
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/explorerBrowser.xml
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/layer.xml
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/mozillaBrowser.xml
core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/webkitBrowser.xml
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/core.browser.djnsswt/build.xml	Thu Aug 30 10:56:16 2012 +0200
     1.3 @@ -0,0 +1,5 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<project basedir="." default="netbeans" name="core.browser.djnsswt">
     1.6 +    <description>Builds, tests, and runs the project org.netbeans.core.browser.djnsswt</description>
     1.7 +    <import file="../nbbuild/templates/projectized.xml"/>
     1.8 +</project>
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/core.browser.djnsswt/manifest.mf	Thu Aug 30 10:56:16 2012 +0200
     2.3 @@ -0,0 +1,7 @@
     2.4 +Manifest-Version: 1.0
     2.5 +OpenIDE-Module: org.netbeans.core.browser.djnsswt/1
     2.6 +OpenIDE-Module-Implementation-Version: 1
     2.7 +OpenIDE-Module-Install: org/netbeans/core/browser/djnsswt/Installer.class
     2.8 +OpenIDE-Module-Localizing-Bundle: org/netbeans/core/browser/djnsswt/Bundle.properties
     2.9 +AutoUpdate-Show-In-Client: true
    2.10 +OpenIDE-Module-Layer: org/netbeans/core/browser/djnsswt/layer.xml
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/core.browser.djnsswt/nbproject/project.properties	Thu Aug 30 10:56:16 2012 +0200
     3.3 @@ -0,0 +1,5 @@
     3.4 +javac.source=1.6
     3.5 +javac.compilerargs=-Xlint -Xlint:-serial
     3.6 +
     3.7 +
     3.8 +spec.version.base=1.0.0
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/core.browser.djnsswt/nbproject/project.xml	Thu Aug 30 10:56:16 2012 +0200
     4.3 @@ -0,0 +1,132 @@
     4.4 +<?xml version="1.0" encoding="UTF-8"?>
     4.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     4.6 +    <type>org.netbeans.modules.apisupport.project</type>
     4.7 +    <configuration>
     4.8 +        <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
     4.9 +            <code-name-base>org.netbeans.core.browser.djnsswt</code-name-base>
    4.10 +            <module-dependencies>
    4.11 +                <dependency>
    4.12 +                    <code-name-base>org.apache.commons.logging</code-name-base>
    4.13 +                    <run-dependency/>
    4.14 +                </dependency>
    4.15 +                <dependency>
    4.16 +                    <code-name-base>org.netbeans.api.progress</code-name-base>
    4.17 +                    <build-prerequisite/>
    4.18 +                    <compile-dependency/>
    4.19 +                    <run-dependency>
    4.20 +                        <release-version>1</release-version>
    4.21 +                        <specification-version>1.14</specification-version>
    4.22 +                    </run-dependency>
    4.23 +                </dependency>
    4.24 +                <dependency>
    4.25 +                    <code-name-base>org.netbeans.core</code-name-base>
    4.26 +                    <build-prerequisite/>
    4.27 +                    <compile-dependency/>
    4.28 +                    <run-dependency>
    4.29 +                        <release-version>2</release-version>
    4.30 +                        <specification-version>3.12</specification-version>
    4.31 +                    </run-dependency>
    4.32 +                </dependency>
    4.33 +                <dependency>
    4.34 +                    <code-name-base>org.netbeans.core.browser</code-name-base>
    4.35 +                    <build-prerequisite/>
    4.36 +                    <compile-dependency/>
    4.37 +                    <run-dependency>
    4.38 +                        <release-version>1</release-version>
    4.39 +                        <implementation-version/>
    4.40 +                    </run-dependency>
    4.41 +                </dependency>
    4.42 +                <dependency>
    4.43 +                    <code-name-base>org.netbeans.modules.libs.djnsswt</code-name-base>
    4.44 +                    <build-prerequisite/>
    4.45 +                    <compile-dependency/>
    4.46 +                    <run-dependency>
    4.47 +                        <release-version>1</release-version>
    4.48 +                        <specification-version>1.0</specification-version>
    4.49 +                    </run-dependency>
    4.50 +                </dependency>
    4.51 +                <dependency>
    4.52 +                    <code-name-base>org.openide.awt</code-name-base>
    4.53 +                    <build-prerequisite/>
    4.54 +                    <compile-dependency/>
    4.55 +                    <run-dependency>
    4.56 +                        <specification-version>7.13</specification-version>
    4.57 +                    </run-dependency>
    4.58 +                </dependency>
    4.59 +                <dependency>
    4.60 +                    <code-name-base>org.openide.dialogs</code-name-base>
    4.61 +                    <build-prerequisite/>
    4.62 +                    <compile-dependency/>
    4.63 +                    <run-dependency>
    4.64 +                        <specification-version>7.11</specification-version>
    4.65 +                    </run-dependency>
    4.66 +                </dependency>
    4.67 +                <dependency>
    4.68 +                    <code-name-base>org.openide.explorer</code-name-base>
    4.69 +                    <build-prerequisite/>
    4.70 +                    <compile-dependency/>
    4.71 +                    <run-dependency>
    4.72 +                        <specification-version>6.19</specification-version>
    4.73 +                    </run-dependency>
    4.74 +                </dependency>
    4.75 +                <dependency>
    4.76 +                    <code-name-base>org.openide.filesystems</code-name-base>
    4.77 +                    <build-prerequisite/>
    4.78 +                    <compile-dependency/>
    4.79 +                    <run-dependency>
    4.80 +                        <specification-version>7.22</specification-version>
    4.81 +                    </run-dependency>
    4.82 +                </dependency>
    4.83 +                <dependency>
    4.84 +                    <code-name-base>org.openide.loaders</code-name-base>
    4.85 +                    <build-prerequisite/>
    4.86 +                    <compile-dependency/>
    4.87 +                    <run-dependency>
    4.88 +                        <specification-version>7.6</specification-version>
    4.89 +                    </run-dependency>
    4.90 +                </dependency>
    4.91 +                <dependency>
    4.92 +                    <code-name-base>org.openide.modules</code-name-base>
    4.93 +                    <build-prerequisite/>
    4.94 +                    <compile-dependency/>
    4.95 +                    <run-dependency>
    4.96 +                        <specification-version>7.25</specification-version>
    4.97 +                    </run-dependency>
    4.98 +                </dependency>
    4.99 +                <dependency>
   4.100 +                    <code-name-base>org.openide.nodes</code-name-base>
   4.101 +                    <build-prerequisite/>
   4.102 +                    <compile-dependency/>
   4.103 +                    <run-dependency>
   4.104 +                        <specification-version>7.10</specification-version>
   4.105 +                    </run-dependency>
   4.106 +                </dependency>
   4.107 +                <dependency>
   4.108 +                    <code-name-base>org.openide.util</code-name-base>
   4.109 +                    <build-prerequisite/>
   4.110 +                    <compile-dependency/>
   4.111 +                    <run-dependency>
   4.112 +                        <specification-version>8.0</specification-version>
   4.113 +                    </run-dependency>
   4.114 +                </dependency>
   4.115 +                <dependency>
   4.116 +                    <code-name-base>org.openide.util.lookup</code-name-base>
   4.117 +                    <build-prerequisite/>
   4.118 +                    <compile-dependency/>
   4.119 +                    <run-dependency>
   4.120 +                        <specification-version>8.0</specification-version>
   4.121 +                    </run-dependency>
   4.122 +                </dependency>
   4.123 +                <dependency>
   4.124 +                    <code-name-base>org.openide.windows</code-name-base>
   4.125 +                    <build-prerequisite/>
   4.126 +                    <compile-dependency/>
   4.127 +                    <run-dependency>
   4.128 +                        <specification-version>6.28</specification-version>
   4.129 +                    </run-dependency>
   4.130 +                </dependency>
   4.131 +            </module-dependencies>
   4.132 +            <public-packages/>
   4.133 +        </data>
   4.134 +    </configuration>
   4.135 +</project>
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserCallback.java	Thu Aug 30 10:56:16 2012 +0200
     5.3 @@ -0,0 +1,58 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
     5.8 + *
     5.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    5.10 + * Other names may be trademarks of their respective owners.
    5.11 + *
    5.12 + * The contents of this file are subject to the terms of either the GNU
    5.13 + * General Public License Version 2 only ("GPL") or the Common
    5.14 + * Development and Distribution License("CDDL") (collectively, the
    5.15 + * "License"). You may not use this file except in compliance with the
    5.16 + * License. You can obtain a copy of the License at
    5.17 + * http://www.netbeans.org/cddl-gplv2.html
    5.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    5.19 + * specific language governing permissions and limitations under the
    5.20 + * License.  When distributing the software, include this License Header
    5.21 + * Notice in each file and include the License file at
    5.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    5.23 + * particular file as subject to the "Classpath" exception as provided
    5.24 + * by Oracle in the GPL Version 2 section of the License file that
    5.25 + * accompanied this code. If applicable, add the following below the
    5.26 + * License Header, with the fields enclosed by brackets [] replaced by
    5.27 + * your own identifying information:
    5.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    5.29 + *
    5.30 + * If you wish your version of this file to be governed by only the CDDL
    5.31 + * or only the GPL Version 2, indicate your decision by adding
    5.32 + * "[Contributor] elects to include this software in this distribution
    5.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    5.34 + * single choice of license, a recipient has the option to distribute
    5.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    5.36 + * to extend the choice of license to its licensees as provided above.
    5.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    5.38 + * Version 2 license, then the option applies only if the new code is
    5.39 + * made subject to such option by the copyright holder.
    5.40 + *
    5.41 + * Contributor(s):
    5.42 + *
    5.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
    5.44 + */
    5.45 +
    5.46 +package org.netbeans.core.browser.djnsswt;
    5.47 +
    5.48 +import java.awt.AWTEvent;
    5.49 +import org.w3c.dom.Node;
    5.50 +
    5.51 +/**
    5.52 + * Callback into WebBrowserImpl to fire browser events.
    5.53 + * 
    5.54 + * @author S. Aubrecht
    5.55 + */
    5.56 +public interface BrowserCallback {
    5.57 +
    5.58 +    boolean fireBrowserEvent( int type, String url );
    5.59 +
    5.60 +    void fireBrowserEvent( int type, AWTEvent e, Node n );
    5.61 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserFactory.java	Thu Aug 30 10:56:16 2012 +0200
     6.3 @@ -0,0 +1,152 @@
     6.4 +/*
     6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 + *
     6.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
     6.8 + *
     6.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    6.10 + * Other names may be trademarks of their respective owners.
    6.11 + *
    6.12 + * The contents of this file are subject to the terms of either the GNU
    6.13 + * General Public License Version 2 only ("GPL") or the Common
    6.14 + * Development and Distribution License("CDDL") (collectively, the
    6.15 + * "License"). You may not use this file except in compliance with the
    6.16 + * License. You can obtain a copy of the License at
    6.17 + * http://www.netbeans.org/cddl-gplv2.html
    6.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    6.19 + * specific language governing permissions and limitations under the
    6.20 + * License.  When distributing the software, include this License Header
    6.21 + * Notice in each file and include the License file at
    6.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    6.23 + * particular file as subject to the "Classpath" exception as provided
    6.24 + * by Oracle in the GPL Version 2 section of the License file that
    6.25 + * accompanied this code. If applicable, add the following below the
    6.26 + * License Header, with the fields enclosed by brackets [] replaced by
    6.27 + * your own identifying information:
    6.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    6.29 + *
    6.30 + * If you wish your version of this file to be governed by only the CDDL
    6.31 + * or only the GPL Version 2, indicate your decision by adding
    6.32 + * "[Contributor] elects to include this software in this distribution
    6.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    6.34 + * single choice of license, a recipient has the option to distribute
    6.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    6.36 + * to extend the choice of license to its licensees as provided above.
    6.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    6.38 + * Version 2 license, then the option applies only if the new code is
    6.39 + * made subject to such option by the copyright holder.
    6.40 + *
    6.41 + * Contributor(s):
    6.42 + *
    6.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
    6.44 + */
    6.45 +package org.netbeans.core.browser.djnsswt;
    6.46 +
    6.47 +import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
    6.48 +import java.util.logging.Logger;
    6.49 +import java.util.prefs.Preferences;
    6.50 +import org.netbeans.core.IDESettings;
    6.51 +import org.openide.awt.HtmlBrowser;
    6.52 +import org.openide.awt.HtmlBrowser.Impl;
    6.53 +import org.openide.util.Lookup;
    6.54 +import org.openide.util.NbPreferences;
    6.55 +import org.openide.util.Utilities;
    6.56 +
    6.57 +/**
    6.58 + * Creates internal browser which uses embedded native browser.
    6.59 + *
    6.60 + * @author S. Aubrecht
    6.61 + */
    6.62 +public abstract class BrowserFactory implements HtmlBrowser.Factory {
    6.63 +    
    6.64 +    static String PROP_EXTRA_BROWSER = "ExtraBrowser"; //NOI18N
    6.65 +
    6.66 +    public Impl createHtmlBrowserImpl() {
    6.67 +        HtmlBrowser.Factory extraFactory = _getExtraBrowser();
    6.68 +        if( null != extraFactory ) {
    6.69 +            return extraFactory.createHtmlBrowserImpl();
    6.70 +        }
    6.71 +        return createImpl();
    6.72 +    }
    6.73 +    
    6.74 +    protected abstract Impl createImpl();
    6.75 +
    6.76 +    public static Boolean isExplorerHidden () {
    6.77 +        return !Utilities.isWindows();
    6.78 +    }
    6.79 +
    6.80 +    public static Boolean isMozillaHidden () {
    6.81 +//        return !Platform.platform.is32Bit() || 
    6.82 +                //return null == System.getProperty( "org.eclipse.swt.browser.XULRunnerPath" );
    6.83 +        return Boolean.FALSE;
    6.84 +    }
    6.85 +
    6.86 +    public static Boolean isWebkitHidden () {
    6.87 +        return Boolean.FALSE;
    6.88 +    }
    6.89 +
    6.90 +    public HtmlBrowser.Factory getExtraBrowser() {
    6.91 +        return _getExtraBrowser();
    6.92 +    }
    6.93 +
    6.94 +    public void setExtraBrowser( HtmlBrowser.Factory browser ) {
    6.95 +        _setExtraBrowser(browser);
    6.96 +    }
    6.97 +
    6.98 +    static HtmlBrowser.Factory _getExtraBrowser() {
    6.99 +        String id = NbPreferences.forModule(BrowserFactory.class).get("extraBrowser", null); //NOI18N
   6.100 +        if( null == id || "".equals(id) ) {
   6.101 +            return null;
   6.102 +        }
   6.103 +        Lookup.Item<HtmlBrowser.Factory> item = Lookup.getDefault ().lookupItem (new Lookup.Template<HtmlBrowser.Factory> (HtmlBrowser.Factory.class, id, null));
   6.104 +        return item == null ? null : item.getInstance ();
   6.105 +    }
   6.106 +
   6.107 +    static void _setExtraBrowser(HtmlBrowser.Factory browser) {
   6.108 +        String browserId = null;
   6.109 +        if( null != browser ) {
   6.110 +            Lookup.Item<HtmlBrowser.Factory> item = Lookup.getDefault ().lookupItem (new Lookup.Template<HtmlBrowser.Factory> (HtmlBrowser.Factory.class, null, browser));
   6.111 +            if (item != null) {
   6.112 +                browserId = item.getId ();
   6.113 +            } else {
   6.114 +                // strange
   6.115 +                Logger.getLogger (IDESettings.class.getName ()).warning ("Cannot find browser in lookup " + browser);// NOI18N
   6.116 +            }
   6.117 +        }
   6.118 +        if( null == browserId )
   6.119 +            browserId = ""; //NOI18N
   6.120 +        NbPreferences.forModule(BrowserFactory.class).put("extraBrowser", browserId); //NOI18N
   6.121 +
   6.122 +        //force reset of NbURLDisplayer
   6.123 +        Preferences idePrefs = NbPreferences.forModule(IDESettings.class);
   6.124 +        String wwwBrowser = idePrefs.get(IDESettings.PROP_WWWBROWSER, null);
   6.125 +        idePrefs.put(IDESettings.PROP_WWWBROWSER, "");
   6.126 +        idePrefs.put(IDESettings.PROP_WWWBROWSER, wwwBrowser);
   6.127 +    }
   6.128 +    
   6.129 +    public static HtmlBrowser.Factory createExplorerInstance() {
   6.130 +        return new BrowserFactory() {
   6.131 +            @Override
   6.132 +            protected Impl createImpl() {
   6.133 +                return new HtmlBrowserImpl(BrowserType.Explorer);
   6.134 +            }
   6.135 +        };
   6.136 +    }
   6.137 +    
   6.138 +    public static HtmlBrowser.Factory createMozillaInstance() {
   6.139 +        return new BrowserFactory() {
   6.140 +            @Override
   6.141 +            protected Impl createImpl() {
   6.142 +                return new HtmlBrowserImpl(BrowserType.Mozilla);
   6.143 +            }
   6.144 +        };
   6.145 +    }
   6.146 +    
   6.147 +    public static HtmlBrowser.Factory createWebkitInstance() {
   6.148 +        return new BrowserFactory() {
   6.149 +            @Override
   6.150 +            protected Impl createImpl() {
   6.151 +                return new HtmlBrowserImpl(BrowserType.Webkit);
   6.152 +            }
   6.153 +        };
   6.154 +    }
   6.155 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserFactoryBeanInfo.java	Thu Aug 30 10:56:16 2012 +0200
     7.3 @@ -0,0 +1,145 @@
     7.4 +/*
     7.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 + *
     7.7 + * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
     7.8 + *
     7.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    7.10 + * Other names may be trademarks of their respective owners.
    7.11 + *
    7.12 + * The contents of this file are subject to the terms of either the GNU
    7.13 + * General Public License Version 2 only ("GPL") or the Common
    7.14 + * Development and Distribution License("CDDL") (collectively, the
    7.15 + * "License"). You may not use this file except in compliance with the
    7.16 + * License. You can obtain a copy of the License at
    7.17 + * http://www.netbeans.org/cddl-gplv2.html
    7.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    7.19 + * specific language governing permissions and limitations under the
    7.20 + * License.  When distributing the software, include this License Header
    7.21 + * Notice in each file and include the License file at
    7.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    7.23 + * particular file as subject to the "Classpath" exception as provided
    7.24 + * by Oracle in the GPL Version 2 section of the License file that
    7.25 + * accompanied this code. If applicable, add the following below the
    7.26 + * License Header, with the fields enclosed by brackets [] replaced by
    7.27 + * your own identifying information:
    7.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    7.29 + *
    7.30 + * Contributor(s):
    7.31 + *
    7.32 + * The Original Software is NetBeans. The Initial Developer of the Original
    7.33 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
    7.34 + * Microsystems, Inc. All Rights Reserved.
    7.35 + *
    7.36 + * If you wish your version of this file to be governed by only the CDDL
    7.37 + * or only the GPL Version 2, indicate your decision by adding
    7.38 + * "[Contributor] elects to include this software in this distribution
    7.39 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.40 + * single choice of license, a recipient has the option to distribute
    7.41 + * your version of this file under either the CDDL, the GPL Version 2 or
    7.42 + * to extend the choice of license to its licensees as provided above.
    7.43 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.44 + * Version 2 license, then the option applies only if the new code is
    7.45 + * made subject to such option by the copyright holder.
    7.46 + */
    7.47 +
    7.48 +package org.netbeans.core.browser.djnsswt;
    7.49 +
    7.50 +import java.awt.Component;
    7.51 +import java.awt.Graphics;
    7.52 +import java.awt.Rectangle;
    7.53 +import java.beans.*;
    7.54 +import org.openide.awt.HtmlBrowser;
    7.55 +import org.openide.awt.HtmlBrowser.Factory;
    7.56 +import org.openide.util.Exceptions;
    7.57 +
    7.58 +
    7.59 +public class BrowserFactoryBeanInfo extends SimpleBeanInfo {
    7.60 +
    7.61 +    @Override
    7.62 +    public BeanDescriptor getBeanDescriptor() {
    7.63 +        return new BeanDescriptor(BrowserFactory.class);
    7.64 +    }
    7.65 +
    7.66 +    @Override
    7.67 +    public PropertyDescriptor[] getPropertyDescriptors() {
    7.68 +        PropertyDescriptor[] properties;
    7.69 +        try {
    7.70 +            properties = new PropertyDescriptor [] {
    7.71 +                                new PropertyDescriptor(BrowserFactory.PROP_EXTRA_BROWSER, BrowserFactory.class)
    7.72 +                             };
    7.73 +
    7.74 +            properties[0].setDisplayName("Extra Browser");
    7.75 +            properties[0].setShortDescription ("Extra browser for web development");
    7.76 +            properties[0].setPreferred(true);
    7.77 +            properties[0].setPropertyEditorClass(EBPropertyEditor.class);
    7.78 +
    7.79 +
    7.80 +        } catch (IntrospectionException ie) {
    7.81 +            Exceptions.printStackTrace(ie);
    7.82 +            return null;
    7.83 +        }
    7.84 +        return properties;
    7.85 +    }
    7.86 +
    7.87 +
    7.88 +    public static class EBPropertyEditor implements PropertyEditor {
    7.89 +
    7.90 +        HtmlBrowser.Factory extraBrowser = BrowserFactory._getExtraBrowser();
    7.91 +
    7.92 +        public EBPropertyEditor() {
    7.93 +
    7.94 +        }
    7.95 +
    7.96 +        public void setValue(Object value) {
    7.97 +            if( value instanceof HtmlBrowser.Factory ) {
    7.98 +                extraBrowser = (Factory) value;
    7.99 +            } else {
   7.100 +                extraBrowser = null;
   7.101 +            }
   7.102 +        }
   7.103 +
   7.104 +        public Object getValue() {
   7.105 +            return extraBrowser;
   7.106 +        }
   7.107 +
   7.108 +        public boolean isPaintable() {
   7.109 +            return false;
   7.110 +        }
   7.111 +
   7.112 +        public void paintValue(Graphics gfx, Rectangle box) {
   7.113 +        }
   7.114 +
   7.115 +        public String getJavaInitializationString() {
   7.116 +            return null;
   7.117 +        }
   7.118 +
   7.119 +        public String getAsText() {
   7.120 +            return "";
   7.121 +        }
   7.122 +
   7.123 +        public void setAsText(String text) throws IllegalArgumentException {
   7.124 +        }
   7.125 +
   7.126 +        public String[] getTags() {
   7.127 +            return null;
   7.128 +        }
   7.129 +
   7.130 +        private EmbeddedBrowserEditor editor;
   7.131 +        public Component getCustomEditor() {
   7.132 +            if( null == editor ) {
   7.133 +                editor = new EmbeddedBrowserEditor(this);
   7.134 +            }
   7.135 +            return editor;
   7.136 +        }
   7.137 +
   7.138 +        public boolean supportsCustomEditor() {
   7.139 +            return true;
   7.140 +        }
   7.141 +
   7.142 +        public void addPropertyChangeListener(PropertyChangeListener listener) {
   7.143 +        }
   7.144 +
   7.145 +        public void removePropertyChangeListener(PropertyChangeListener listener) {
   7.146 +        }
   7.147 +    }
   7.148 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/BrowserType.java	Thu Aug 30 10:56:16 2012 +0200
     8.3 @@ -0,0 +1,50 @@
     8.4 +/*
     8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 + *
     8.7 + * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
     8.8 + *
     8.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    8.10 + * Other names may be trademarks of their respective owners.
    8.11 + *
    8.12 + * The contents of this file are subject to the terms of either the GNU
    8.13 + * General Public License Version 2 only ("GPL") or the Common
    8.14 + * Development and Distribution License("CDDL") (collectively, the
    8.15 + * "License"). You may not use this file except in compliance with the
    8.16 + * License. You can obtain a copy of the License at
    8.17 + * http://www.netbeans.org/cddl-gplv2.html
    8.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    8.19 + * specific language governing permissions and limitations under the
    8.20 + * License.  When distributing the software, include this License Header
    8.21 + * Notice in each file and include the License file at
    8.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    8.23 + * particular file as subject to the "Classpath" exception as provided
    8.24 + * by Oracle in the GPL Version 2 section of the License file that
    8.25 + * accompanied this code. If applicable, add the following below the
    8.26 + * License Header, with the fields enclosed by brackets [] replaced by
    8.27 + * your own identifying information:
    8.28 + * "Portions Copyrighted [year] [name of copyright owner]"
    8.29 + *
    8.30 + * If you wish your version of this file to be governed by only the CDDL
    8.31 + * or only the GPL Version 2, indicate your decision by adding
    8.32 + * "[Contributor] elects to include this software in this distribution
    8.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    8.34 + * single choice of license, a recipient has the option to distribute
    8.35 + * your version of this file under either the CDDL, the GPL Version 2 or
    8.36 + * to extend the choice of license to its licensees as provided above.
    8.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    8.38 + * Version 2 license, then the option applies only if the new code is
    8.39 + * made subject to such option by the copyright holder.
    8.40 + *
    8.41 + * Contributor(s):
    8.42 + *
    8.43 + * Portions Copyrighted 2011 Sun Microsystems, Inc.
    8.44 + */
    8.45 +package org.netbeans.core.browser.djnsswt;
    8.46 +
    8.47 +/**
    8.48 + *
    8.49 + * @author stan
    8.50 + */
    8.51 + enum BrowserType {
    8.52 +    Explorer, Mozilla, Webkit
    8.53 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Bundle.properties	Thu Aug 30 10:56:16 2012 +0200
     9.3 @@ -0,0 +1,9 @@
     9.4 +OpenIDE-Module-Display-Category=Base IDE
     9.5 +OpenIDE-Module-Long-Description=\
     9.6 +    <html>Embedded browser implementation based on DJ Native Swing library which
     9.7 +    integrates SWT widgets into Swing component hierarchy.
     9.8 +OpenIDE-Module-Name=Embedded Browser UI - DJ Native Swing (SWT)
     9.9 +Services/Browsers/SWT_Explorer.settings=Embedded Internet Explorer (SWT)
    9.10 +Services/Browsers/SWT_Mozilla.settings=Embedded Mozilla Browser (SWT)
    9.11 +Services/Browsers/SWT_Webkit.settings=Embedded Webkit Browser (SWT)
    9.12 +EmbeddedBrowserEditor.checkAnotherBrowser.text=Use Another Browser for Web Application Development
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/EmbeddedBrowserEditor.form	Thu Aug 30 10:56:16 2012 +0200
    10.3 @@ -0,0 +1,55 @@
    10.4 +<?xml version="1.1" encoding="UTF-8" ?>
    10.5 +
    10.6 +<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
    10.7 +  <AuxValues>
    10.8 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
    10.9 +    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
   10.10 +    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
   10.11 +    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
   10.12 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
   10.13 +    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
   10.14 +    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
   10.15 +    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
   10.16 +    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
   10.17 +  </AuxValues>
   10.18 +
   10.19 +  <Layout>
   10.20 +    <DimensionLayout dim="0">
   10.21 +      <Group type="103" groupAlignment="0" attributes="0">
   10.22 +          <Group type="102" alignment="0" attributes="0">
   10.23 +              <EmptySpace max="-2" attributes="0"/>
   10.24 +              <Group type="103" groupAlignment="0" attributes="0">
   10.25 +                  <Group type="102" alignment="0" attributes="0">
   10.26 +                      <EmptySpace min="21" pref="21" max="21" attributes="0"/>
   10.27 +                      <Component id="comboBrowsers" pref="402" max="32767" attributes="0"/>
   10.28 +                  </Group>
   10.29 +                  <Component id="checkAnotherBrowser" alignment="0" min="-2" max="-2" attributes="0"/>
   10.30 +              </Group>
   10.31 +              <EmptySpace max="-2" attributes="0"/>
   10.32 +          </Group>
   10.33 +      </Group>
   10.34 +    </DimensionLayout>
   10.35 +    <DimensionLayout dim="1">
   10.36 +      <Group type="103" groupAlignment="0" attributes="0">
   10.37 +          <Group type="102" alignment="0" attributes="0">
   10.38 +              <EmptySpace max="-2" attributes="0"/>
   10.39 +              <Component id="checkAnotherBrowser" min="-2" max="-2" attributes="0"/>
   10.40 +              <EmptySpace max="-2" attributes="0"/>
   10.41 +              <Component id="comboBrowsers" min="-2" max="-2" attributes="0"/>
   10.42 +              <EmptySpace max="32767" attributes="0"/>
   10.43 +          </Group>
   10.44 +      </Group>
   10.45 +    </DimensionLayout>
   10.46 +  </Layout>
   10.47 +  <SubComponents>
   10.48 +    <Component class="javax.swing.JCheckBox" name="checkAnotherBrowser">
   10.49 +      <Properties>
   10.50 +        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
   10.51 +          <ResourceString bundle="org/netbeans/core/browser/Bundle.properties" key="EmbeddedBrowserEditor.checkAnotherBrowser.text" replaceFormat="NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
   10.52 +        </Property>
   10.53 +      </Properties>
   10.54 +    </Component>
   10.55 +    <Component class="javax.swing.JComboBox" name="comboBrowsers">
   10.56 +    </Component>
   10.57 +  </SubComponents>
   10.58 +</Form>
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/EmbeddedBrowserEditor.java	Thu Aug 30 10:56:16 2012 +0200
    11.3 @@ -0,0 +1,222 @@
    11.4 +/*
    11.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 + *
    11.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    11.8 + *
    11.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   11.10 + * Other names may be trademarks of their respective owners.
   11.11 + *
   11.12 + * The contents of this file are subject to the terms of either the GNU
   11.13 + * General Public License Version 2 only ("GPL") or the Common
   11.14 + * Development and Distribution License("CDDL") (collectively, the
   11.15 + * "License"). You may not use this file except in compliance with the
   11.16 + * License. You can obtain a copy of the License at
   11.17 + * http://www.netbeans.org/cddl-gplv2.html
   11.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   11.19 + * specific language governing permissions and limitations under the
   11.20 + * License.  When distributing the software, include this License Header
   11.21 + * Notice in each file and include the License file at
   11.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   11.23 + * particular file as subject to the "Classpath" exception as provided
   11.24 + * by Oracle in the GPL Version 2 section of the License file that
   11.25 + * accompanied this code. If applicable, add the following below the
   11.26 + * License Header, with the fields enclosed by brackets [] replaced by
   11.27 + * your own identifying information:
   11.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   11.29 + *
   11.30 + * If you wish your version of this file to be governed by only the CDDL
   11.31 + * or only the GPL Version 2, indicate your decision by adding
   11.32 + * "[Contributor] elects to include this software in this distribution
   11.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   11.34 + * single choice of license, a recipient has the option to distribute
   11.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   11.36 + * to extend the choice of license to its licensees as provided above.
   11.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   11.38 + * Version 2 license, then the option applies only if the new code is
   11.39 + * made subject to such option by the copyright holder.
   11.40 + *
   11.41 + * Contributor(s):
   11.42 + *
   11.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   11.44 + */
   11.45 +
   11.46 +/*
   11.47 + * EmbeddedBrowserEditor.java
   11.48 + *
   11.49 + * Created on 11.8.2009, 13:32:26
   11.50 + */
   11.51 +
   11.52 +package org.netbeans.core.browser.djnsswt;
   11.53 +
   11.54 +import java.awt.event.ItemEvent;
   11.55 +import java.awt.event.ItemListener;
   11.56 +import java.beans.PropertyEditor;
   11.57 +import java.io.IOException;
   11.58 +import java.util.ArrayList;
   11.59 +import java.util.List;
   11.60 +import javax.swing.DefaultComboBoxModel;
   11.61 +import org.openide.awt.HtmlBrowser;
   11.62 +import org.openide.awt.HtmlBrowser.Factory;
   11.63 +import org.openide.cookies.InstanceCookie;
   11.64 +import org.openide.filesystems.FileObject;
   11.65 +import org.openide.filesystems.FileUtil;
   11.66 +import org.openide.loaders.DataFolder;
   11.67 +import org.openide.loaders.DataObject;
   11.68 +import org.openide.util.Exceptions;
   11.69 +import org.openide.util.Lookup;
   11.70 +import org.openide.util.NbBundle;
   11.71 +
   11.72 +/**
   11.73 + *
   11.74 + * @author S. Aubrecht
   11.75 + */
   11.76 +public class EmbeddedBrowserEditor extends javax.swing.JPanel implements ItemListener {
   11.77 +    
   11.78 +    private static final String BROWSERS_FOLDER = "Services/Browsers"; // NOI18N
   11.79 +
   11.80 +    private final List<? extends DataObject> browsers;
   11.81 +    private final PropertyEditor property;
   11.82 +
   11.83 +    /** Creates new form EmbeddedBrowserEditor */
   11.84 +    public EmbeddedBrowserEditor( PropertyEditor prop ) {
   11.85 +        this.property = prop;
   11.86 +        initComponents();
   11.87 +        browsers = loadBrowserList();
   11.88 +        checkAnotherBrowser.setSelected(true);
   11.89 +        String[] names = new String[browsers.size()];
   11.90 +        for( int i=0; i<browsers.size(); i++ ) {
   11.91 +            names[i] = browsers.get( i ).getNodeDelegate().getDisplayName();
   11.92 +        }
   11.93 +        checkAnotherBrowser.setSelected( prop.getValue() != null );
   11.94 +        comboBrowsers.setModel( new DefaultComboBoxModel(names));
   11.95 +        if( browsers.isEmpty() ) {
   11.96 +            checkAnotherBrowser.setEnabled(false);
   11.97 +            checkAnotherBrowser.setSelected(false);
   11.98 +            comboBrowsers.setSelectedIndex(-1);
   11.99 +        } else if( null != prop.getValue() ) {
  11.100 +            selectBrowser( (org.openide.awt.HtmlBrowser.Factory)prop.getValue() );
  11.101 +        }
  11.102 +        checkAnotherBrowser.addItemListener(this);
  11.103 +        comboBrowsers.addItemListener(this);
  11.104 +    }
  11.105 +
  11.106 +    /** This method is called from within the constructor to
  11.107 +     * initialize the form.
  11.108 +     * WARNING: Do NOT modify this code. The content of this method is
  11.109 +     * always regenerated by the Form Editor.
  11.110 +     */
  11.111 +    @SuppressWarnings("unchecked")
  11.112 +    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  11.113 +    private void initComponents() {
  11.114 +
  11.115 +        checkAnotherBrowser = new javax.swing.JCheckBox();
  11.116 +        comboBrowsers = new javax.swing.JComboBox();
  11.117 +
  11.118 +        checkAnotherBrowser.setText(NbBundle.getMessage(EmbeddedBrowserEditor.class, "EmbeddedBrowserEditor.checkAnotherBrowser.text")); // NOI18N
  11.119 +
  11.120 +        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
  11.121 +        this.setLayout(layout);
  11.122 +        layout.setHorizontalGroup(
  11.123 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  11.124 +            .addGroup(layout.createSequentialGroup()
  11.125 +                .addContainerGap()
  11.126 +                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  11.127 +                    .addGroup(layout.createSequentialGroup()
  11.128 +                        .addGap(21, 21, 21)
  11.129 +                        .addComponent(comboBrowsers, 0, 402, Short.MAX_VALUE))
  11.130 +                    .addComponent(checkAnotherBrowser))
  11.131 +                .addContainerGap())
  11.132 +        );
  11.133 +        layout.setVerticalGroup(
  11.134 +            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  11.135 +            .addGroup(layout.createSequentialGroup()
  11.136 +                .addContainerGap()
  11.137 +                .addComponent(checkAnotherBrowser)
  11.138 +                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  11.139 +                .addComponent(comboBrowsers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  11.140 +                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  11.141 +        );
  11.142 +    }// </editor-fold>//GEN-END:initComponents
  11.143 +
  11.144 +
  11.145 +    // Variables declaration - do not modify//GEN-BEGIN:variables
  11.146 +    private javax.swing.JCheckBox checkAnotherBrowser;
  11.147 +    private javax.swing.JComboBox comboBrowsers;
  11.148 +    // End of variables declaration//GEN-END:variables
  11.149 +
  11.150 +    public void itemStateChanged(ItemEvent e) {
  11.151 +        comboBrowsers.setEnabled(checkAnotherBrowser.isSelected());
  11.152 +        storeSettings();
  11.153 +    }
  11.154 +
  11.155 +    private void storeSettings() {
  11.156 +        if( checkAnotherBrowser.isSelected() ) {
  11.157 +            DataObject dob = browsers.get(comboBrowsers.getSelectedIndex());
  11.158 +            HtmlBrowser.Factory newBrowser = null;
  11.159 +            try {
  11.160 +                newBrowser = (Factory) dob.getCookie(InstanceCookie.class).instanceCreate();
  11.161 +                Lookup.Result<HtmlBrowser.Factory> res = Lookup.getDefault ().lookupResult (HtmlBrowser.Factory.class);
  11.162 +                java.util.Iterator<? extends HtmlBrowser.Factory> it = res.allInstances ().iterator ();
  11.163 +                while (it.hasNext ()) {
  11.164 +                    HtmlBrowser.Factory brow = it.next ();
  11.165 +                    if( brow.equals(newBrowser) ) {
  11.166 +                        newBrowser = brow;
  11.167 +                        break;
  11.168 +                    }
  11.169 +                }
  11.170 +                property.setValue(newBrowser);
  11.171 +            } catch( IOException ex ) {
  11.172 +                Exceptions.printStackTrace(ex);
  11.173 +            } catch( ClassNotFoundException ex ) {
  11.174 +                Exceptions.printStackTrace(ex);
  11.175 +            }
  11.176 +        } else {
  11.177 +            property.setValue(null);
  11.178 +        }
  11.179 +    }
  11.180 +
  11.181 +    private List<? extends DataObject> loadBrowserList() {
  11.182 +        ArrayList<DataObject> res = new ArrayList<DataObject>(20);
  11.183 +
  11.184 +        FileObject servicesBrowsers = FileUtil.getConfigFile(BROWSERS_FOLDER);
  11.185 +
  11.186 +        if (servicesBrowsers != null) {
  11.187 +
  11.188 +            DataFolder folder = DataFolder.findFolder(servicesBrowsers);
  11.189 +            DataObject[] browserSettings = folder.getChildren();
  11.190 +
  11.191 +            for (DataObject browserSetting : browserSettings) {
  11.192 +
  11.193 +                InstanceCookie cookie = browserSetting.getCookie(InstanceCookie.class);
  11.194 +                FileObject primaryFile = browserSetting.getPrimaryFile();
  11.195 +                if( "EmbeddedBrowser.settings".equals(primaryFile.getNameExt()) ) {
  11.196 +                    continue;
  11.197 +                }
  11.198 +
  11.199 +                if (cookie != null && !Boolean.TRUE.equals(primaryFile.getAttribute("hidden"))) {
  11.200 +                    res.add(browserSetting);
  11.201 +                }
  11.202 +            }
  11.203 +        }
  11.204 +        return res;
  11.205 +    }
  11.206 +
  11.207 +    private void selectBrowser( HtmlBrowser.Factory browser ) {
  11.208 +        int selIndex = -1;
  11.209 +        for( int i=0; i<browsers.size(); i++ ) {
  11.210 +            DataObject dob = browsers.get(i);
  11.211 +            InstanceCookie cookie = dob.getCookie(InstanceCookie.class);
  11.212 +            try {
  11.213 +                if( browser.equals(cookie.instanceCreate()) ) {
  11.214 +                    selIndex = i;
  11.215 +                    break;
  11.216 +                }
  11.217 +            } catch( IOException ex ) {
  11.218 +                Exceptions.printStackTrace(ex);
  11.219 +            } catch( ClassNotFoundException ex ) {
  11.220 +                Exceptions.printStackTrace(ex);
  11.221 +            }
  11.222 +        }
  11.223 +        comboBrowsers.setSelectedIndex(selIndex);
  11.224 +    }
  11.225 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/ExplorerBrowserFactoryImpl.java	Thu Aug 30 10:56:16 2012 +0200
    12.3 @@ -0,0 +1,84 @@
    12.4 +/*
    12.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 + *
    12.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    12.8 + *
    12.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   12.10 + * Other names may be trademarks of their respective owners.
   12.11 + *
   12.12 + * The contents of this file are subject to the terms of either the GNU
   12.13 + * General Public License Version 2 only ("GPL") or the Common
   12.14 + * Development and Distribution License("CDDL") (collectively, the
   12.15 + * "License"). You may not use this file except in compliance with the
   12.16 + * License. You can obtain a copy of the License at
   12.17 + * http://www.netbeans.org/cddl-gplv2.html
   12.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   12.19 + * specific language governing permissions and limitations under the
   12.20 + * License.  When distributing the software, include this License Header
   12.21 + * Notice in each file and include the License file at
   12.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   12.23 + * particular file as subject to the "Classpath" exception as provided
   12.24 + * by Oracle in the GPL Version 2 section of the License file that
   12.25 + * accompanied this code. If applicable, add the following below the
   12.26 + * License Header, with the fields enclosed by brackets [] replaced by
   12.27 + * your own identifying information:
   12.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   12.29 + *
   12.30 + * If you wish your version of this file to be governed by only the CDDL
   12.31 + * or only the GPL Version 2, indicate your decision by adding
   12.32 + * "[Contributor] elects to include this software in this distribution
   12.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   12.34 + * single choice of license, a recipient has the option to distribute
   12.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   12.36 + * to extend the choice of license to its licensees as provided above.
   12.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   12.38 + * Version 2 license, then the option applies only if the new code is
   12.39 + * made subject to such option by the copyright holder.
   12.40 + *
   12.41 + * Contributor(s):
   12.42 + *
   12.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   12.44 + */
   12.45 +
   12.46 +package org.netbeans.core.browser.djnsswt;
   12.47 +
   12.48 +import java.beans.PropertyChangeListener;
   12.49 +import java.beans.PropertyChangeSupport;
   12.50 +import org.netbeans.core.browser.api.EmbeddedBrowserFactory;
   12.51 +import org.netbeans.core.browser.api.WebBrowser;
   12.52 +import org.openide.util.lookup.ServiceProvider;
   12.53 +
   12.54 +/**
   12.55 + * Embedded browser factory.
   12.56 + * 
   12.57 + * @author S. Aubrecht
   12.58 + */
   12.59 +@ServiceProvider(service=EmbeddedBrowserFactory.class)
   12.60 +public class ExplorerBrowserFactoryImpl extends EmbeddedBrowserFactory {
   12.61 +
   12.62 +    private final PropertyChangeSupport propSupport = new PropertyChangeSupport(this);
   12.63 +    public ExplorerBrowserFactoryImpl() {
   12.64 +    }
   12.65 +
   12.66 +    @Override
   12.67 +    public boolean isEnabled() {
   12.68 +        return !BrowserFactory.isExplorerHidden();
   12.69 +    }
   12.70 +
   12.71 +    @Override
   12.72 +    public WebBrowser createEmbeddedBrowser() {
   12.73 +        if( !isEnabled() )
   12.74 +            throw new IllegalStateException();
   12.75 +        return new WebBrowserImpl(BrowserType.Explorer);
   12.76 +    }
   12.77 +
   12.78 +    @Override
   12.79 +    public void addPropertyChangeListener(PropertyChangeListener l) {
   12.80 +        propSupport.addPropertyChangeListener(l);
   12.81 +    }
   12.82 +
   12.83 +    @Override
   12.84 +    public void removePropertyChangeListener(PropertyChangeListener l) {
   12.85 +        propSupport.removePropertyChangeListener(l);
   12.86 +    }
   12.87 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/HtmlBrowserImpl.java	Thu Aug 30 10:56:16 2012 +0200
    13.3 @@ -0,0 +1,193 @@
    13.4 +/*
    13.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 + *
    13.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    13.8 + *
    13.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   13.10 + * Other names may be trademarks of their respective owners.
   13.11 + *
   13.12 + * The contents of this file are subject to the terms of either the GNU
   13.13 + * General Public License Version 2 only ("GPL") or the Common
   13.14 + * Development and Distribution License("CDDL") (collectively, the
   13.15 + * "License"). You may not use this file except in compliance with the
   13.16 + * License. You can obtain a copy of the License at
   13.17 + * http://www.netbeans.org/cddl-gplv2.html
   13.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   13.19 + * specific language governing permissions and limitations under the
   13.20 + * License.  When distributing the software, include this License Header
   13.21 + * Notice in each file and include the License file at
   13.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   13.23 + * particular file as subject to the "Classpath" exception as provided
   13.24 + * by Oracle in the GPL Version 2 section of the License file that
   13.25 + * accompanied this code. If applicable, add the following below the
   13.26 + * License Header, with the fields enclosed by brackets [] replaced by
   13.27 + * your own identifying information:
   13.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   13.29 + *
   13.30 + * If you wish your version of this file to be governed by only the CDDL
   13.31 + * or only the GPL Version 2, indicate your decision by adding
   13.32 + * "[Contributor] elects to include this software in this distribution
   13.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   13.34 + * single choice of license, a recipient has the option to distribute
   13.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   13.36 + * to extend the choice of license to its licensees as provided above.
   13.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   13.38 + * Version 2 license, then the option applies only if the new code is
   13.39 + * made subject to such option by the copyright holder.
   13.40 + *
   13.41 + * Contributor(s):
   13.42 + *
   13.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   13.44 + */
   13.45 +package org.netbeans.core.browser.djnsswt;
   13.46 +
   13.47 +import java.awt.Component;
   13.48 +import java.beans.PropertyChangeListener;
   13.49 +import java.net.MalformedURLException;
   13.50 +import java.net.URL;
   13.51 +import java.util.logging.Level;
   13.52 +import java.util.logging.Logger;
   13.53 +import javax.swing.SwingUtilities;
   13.54 +import org.netbeans.core.browser.api.WebBrowser;
   13.55 +import org.openide.awt.HtmlBrowser;
   13.56 +
   13.57 +/**
   13.58 + * HTML browser implementation which uses embedded native browser component.
   13.59 + *
   13.60 + * @author S. Aubrecht
   13.61 + */
   13.62 +class HtmlBrowserImpl extends HtmlBrowser.Impl {
   13.63 +
   13.64 +    private WebBrowser browser;
   13.65 +    private final Object LOCK = new Object();
   13.66 +    private final BrowserType type;
   13.67 +
   13.68 +    public HtmlBrowserImpl(BrowserType type) {
   13.69 +        super();
   13.70 +        this.type = type;
   13.71 +    }
   13.72 +
   13.73 +    @Override
   13.74 +    public Component getComponent() {
   13.75 +        return getBrowser().getComponent();
   13.76 +    }
   13.77 +
   13.78 +    private WebBrowser getBrowser() {
   13.79 +        synchronized( LOCK ) {
   13.80 +            if( null == browser ) {
   13.81 +                browser = new WebBrowserImpl(type);
   13.82 +            }
   13.83 +            return browser;
   13.84 +        }
   13.85 +    }
   13.86 +
   13.87 +    @Override
   13.88 +    public void reloadDocument() {
   13.89 +        getBrowser().reloadDocument();
   13.90 +    }
   13.91 +
   13.92 +    @Override
   13.93 +    public void stopLoading() {
   13.94 +        getBrowser().stopLoading();
   13.95 +    }
   13.96 +
   13.97 +    @Override
   13.98 +    public void setURL(final URL url) {
   13.99 +//        if( !SwingUtilities.isEventDispatchThread() ) {
  13.100 +//            SwingUtilities.invokeLater( new Runnable() {
  13.101 +//
  13.102 +//                @Override
  13.103 +//                public void run() {
  13.104 +//                    setURL( url );
  13.105 +//                }
  13.106 +//            });
  13.107 +//            return;
  13.108 +//        }
  13.109 +        getBrowser().setURL(url.toString());
  13.110 +    }
  13.111 +
  13.112 +    @Override
  13.113 +    public URL getURL() {
  13.114 +        if( !SwingUtilities.isEventDispatchThread() )
  13.115 +            return null;
  13.116 +        String strUrl = getBrowser().getURL();
  13.117 +        if( null == strUrl )
  13.118 +            return null;
  13.119 +        try {
  13.120 +            return new URL(strUrl);
  13.121 +        } catch( MalformedURLException ex ) {
  13.122 +            Logger.getLogger(HtmlBrowserImpl.class.getName()).log(Level.FINE, null, ex);
  13.123 +        }
  13.124 +        return null;
  13.125 +    }
  13.126 +
  13.127 +    @Override
  13.128 +    public String getLocation() {
  13.129 +        return getBrowser().getURL();
  13.130 +    }
  13.131 +
  13.132 +    @Override
  13.133 +    public void setLocation(String str) {
  13.134 +        getBrowser().setURL(str);
  13.135 +    }
  13.136 +
  13.137 +    @Override
  13.138 +    public String getStatusMessage() {
  13.139 +        return getBrowser().getStatusMessage();
  13.140 +    }
  13.141 +
  13.142 +    @Override
  13.143 +    public String getTitle() {
  13.144 +        return getBrowser().getTitle();
  13.145 +    }
  13.146 +
  13.147 +    @Override
  13.148 +    public boolean isForward() {
  13.149 +        return getBrowser().isForward();
  13.150 +    }
  13.151 +
  13.152 +    @Override
  13.153 +    public void forward() {
  13.154 +        getBrowser().forward();
  13.155 +    }
  13.156 +
  13.157 +    @Override
  13.158 +    public boolean isBackward() {
  13.159 +        return getBrowser().isBackward();
  13.160 +    }
  13.161 +
  13.162 +    @Override
  13.163 +    public void backward() {
  13.164 +        getBrowser().backward();
  13.165 +    }
  13.166 +
  13.167 +    @Override
  13.168 +    public boolean isHistory() {
  13.169 +        return getBrowser().isHistory();
  13.170 +    }
  13.171 +
  13.172 +    @Override
  13.173 +    public void showHistory() {
  13.174 +        getBrowser().showHistory();
  13.175 +    }
  13.176 +
  13.177 +    @Override
  13.178 +    public void addPropertyChangeListener(PropertyChangeListener l) {
  13.179 +        getBrowser().addPropertyChangeListener(l);
  13.180 +    }
  13.181 +
  13.182 +    @Override
  13.183 +    public void removePropertyChangeListener(PropertyChangeListener l) {
  13.184 +        getBrowser().removePropertyChangeListener(l);
  13.185 +    }
  13.186 +
  13.187 +    @Override
  13.188 +    public void dispose() {
  13.189 +        synchronized( LOCK ) {
  13.190 +            if( null != browser ) {
  13.191 +                browser.dispose();
  13.192 +            }
  13.193 +            browser = null;
  13.194 +        }
  13.195 +    }
  13.196 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Installer.java	Thu Aug 30 10:56:16 2012 +0200
    14.3 @@ -0,0 +1,59 @@
    14.4 +/*
    14.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 + *
    14.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    14.8 + *
    14.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   14.10 + * Other names may be trademarks of their respective owners.
   14.11 + *
   14.12 + * The contents of this file are subject to the terms of either the GNU
   14.13 + * General Public License Version 2 only ("GPL") or the Common
   14.14 + * Development and Distribution License("CDDL") (collectively, the
   14.15 + * "License"). You may not use this file except in compliance with the
   14.16 + * License. You can obtain a copy of the License at
   14.17 + * http://www.netbeans.org/cddl-gplv2.html
   14.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   14.19 + * specific language governing permissions and limitations under the
   14.20 + * License.  When distributing the software, include this License Header
   14.21 + * Notice in each file and include the License file at
   14.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   14.23 + * particular file as subject to the "Classpath" exception as provided
   14.24 + * by Oracle in the GPL Version 2 section of the License file that
   14.25 + * accompanied this code. If applicable, add the following below the
   14.26 + * License Header, with the fields enclosed by brackets [] replaced by
   14.27 + * your own identifying information:
   14.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   14.29 + *
   14.30 + * If you wish your version of this file to be governed by only the CDDL
   14.31 + * or only the GPL Version 2, indicate your decision by adding
   14.32 + * "[Contributor] elects to include this software in this distribution
   14.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   14.34 + * single choice of license, a recipient has the option to distribute
   14.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   14.36 + * to extend the choice of license to its licensees as provided above.
   14.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   14.38 + * Version 2 license, then the option applies only if the new code is
   14.39 + * made subject to such option by the copyright holder.
   14.40 + *
   14.41 + * Contributor(s):
   14.42 + *
   14.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   14.44 + */
   14.45 +package org.netbeans.core.browser.djnsswt;
   14.46 +
   14.47 +import chrriis.dj.nativeswing.swtimpl.netbeans.NativeInterfaceNetBeansHandler;
   14.48 +import org.openide.modules.ModuleInstall;
   14.49 +
   14.50 +/**
   14.51 + * Manages a module's lifecycle. Remember that an installer is optional and
   14.52 + * often not needed at all.
   14.53 + */
   14.54 +public class Installer extends ModuleInstall {
   14.55 +
   14.56 +    @Override
   14.57 +    public void restored() {
   14.58 +//        System.setProperty( "nativeswing.webbrowser.xulrunner.home", "C:\\lib\\xulrunner");
   14.59 +//        System.setProperty( "org.eclipse.swt.browser.XULRunnerPath", "C:\\lib\\xulrunner");
   14.60 +        NativeInterfaceNetBeansHandler.initialize();
   14.61 +    }
   14.62 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/MozillaBrowserFactoryImpl.java	Thu Aug 30 10:56:16 2012 +0200
    15.3 @@ -0,0 +1,84 @@
    15.4 +/*
    15.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 + *
    15.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    15.8 + *
    15.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   15.10 + * Other names may be trademarks of their respective owners.
   15.11 + *
   15.12 + * The contents of this file are subject to the terms of either the GNU
   15.13 + * General Public License Version 2 only ("GPL") or the Common
   15.14 + * Development and Distribution License("CDDL") (collectively, the
   15.15 + * "License"). You may not use this file except in compliance with the
   15.16 + * License. You can obtain a copy of the License at
   15.17 + * http://www.netbeans.org/cddl-gplv2.html
   15.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   15.19 + * specific language governing permissions and limitations under the
   15.20 + * License.  When distributing the software, include this License Header
   15.21 + * Notice in each file and include the License file at
   15.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   15.23 + * particular file as subject to the "Classpath" exception as provided
   15.24 + * by Oracle in the GPL Version 2 section of the License file that
   15.25 + * accompanied this code. If applicable, add the following below the
   15.26 + * License Header, with the fields enclosed by brackets [] replaced by
   15.27 + * your own identifying information:
   15.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   15.29 + *
   15.30 + * If you wish your version of this file to be governed by only the CDDL
   15.31 + * or only the GPL Version 2, indicate your decision by adding
   15.32 + * "[Contributor] elects to include this software in this distribution
   15.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   15.34 + * single choice of license, a recipient has the option to distribute
   15.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   15.36 + * to extend the choice of license to its licensees as provided above.
   15.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   15.38 + * Version 2 license, then the option applies only if the new code is
   15.39 + * made subject to such option by the copyright holder.
   15.40 + *
   15.41 + * Contributor(s):
   15.42 + *
   15.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   15.44 + */
   15.45 +
   15.46 +package org.netbeans.core.browser.djnsswt;
   15.47 +
   15.48 +import java.beans.PropertyChangeListener;
   15.49 +import java.beans.PropertyChangeSupport;
   15.50 +import org.netbeans.core.browser.api.EmbeddedBrowserFactory;
   15.51 +import org.netbeans.core.browser.api.WebBrowser;
   15.52 +import org.openide.util.lookup.ServiceProvider;
   15.53 +
   15.54 +/**
   15.55 + * Embedded browser factory.
   15.56 + * 
   15.57 + * @author S. Aubrecht
   15.58 + */
   15.59 +@ServiceProvider(service=EmbeddedBrowserFactory.class)
   15.60 +public class MozillaBrowserFactoryImpl extends EmbeddedBrowserFactory {
   15.61 +
   15.62 +    private final PropertyChangeSupport propSupport = new PropertyChangeSupport(this);
   15.63 +    public MozillaBrowserFactoryImpl() {
   15.64 +    }
   15.65 +
   15.66 +    @Override
   15.67 +    public boolean isEnabled() {
   15.68 +        return !BrowserFactory.isMozillaHidden();
   15.69 +    }
   15.70 +
   15.71 +    @Override
   15.72 +    public WebBrowser createEmbeddedBrowser() {
   15.73 +        if( !isEnabled() )
   15.74 +            throw new IllegalStateException();
   15.75 +        return new WebBrowserImpl(BrowserType.Mozilla);
   15.76 +    }
   15.77 +
   15.78 +    @Override
   15.79 +    public void addPropertyChangeListener(PropertyChangeListener l) {
   15.80 +        propSupport.addPropertyChangeListener(l);
   15.81 +    }
   15.82 +
   15.83 +    @Override
   15.84 +    public void removePropertyChangeListener(PropertyChangeListener l) {
   15.85 +        propSupport.removePropertyChangeListener(l);
   15.86 +    }
   15.87 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/Platform.java	Thu Aug 30 10:56:16 2012 +0200
    16.3 @@ -0,0 +1,174 @@
    16.4 +/*
    16.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.6 + *
    16.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    16.8 + *
    16.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   16.10 + * Other names may be trademarks of their respective owners.
   16.11 + *
   16.12 + * The contents of this file are subject to the terms of either the GNU
   16.13 + * General Public License Version 2 only ("GPL") or the Common
   16.14 + * Development and Distribution License("CDDL") (collectively, the
   16.15 + * "License"). You may not use this file except in compliance with the
   16.16 + * License. You can obtain a copy of the License at
   16.17 + * http://www.netbeans.org/cddl-gplv2.html
   16.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   16.19 + * specific language governing permissions and limitations under the
   16.20 + * License.  When distributing the software, include this License Header
   16.21 + * Notice in each file and include the License file at
   16.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   16.23 + * particular file as subject to the "Classpath" exception as provided
   16.24 + * by Oracle in the GPL Version 2 section of the License file that
   16.25 + * accompanied this code. If applicable, add the following below the
   16.26 + * License Header, with the fields enclosed by brackets [] replaced by
   16.27 + * your own identifying information:
   16.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   16.29 + *
   16.30 + * If you wish your version of this file to be governed by only the CDDL
   16.31 + * or only the GPL Version 2, indicate your decision by adding
   16.32 + * "[Contributor] elects to include this software in this distribution
   16.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   16.34 + * single choice of license, a recipient has the option to distribute
   16.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   16.36 + * to extend the choice of license to its licensees as provided above.
   16.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   16.38 + * Version 2 license, then the option applies only if the new code is
   16.39 + * made subject to such option by the copyright holder.
   16.40 + *
   16.41 + * Contributor(s):
   16.42 + *
   16.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   16.44 + */
   16.45 +package org.netbeans.core.browser.djnsswt;
   16.46 +
   16.47 +import java.util.StringTokenizer;
   16.48 +
   16.49 +/**
   16.50 + * List of supported platforms.
   16.51 + * 
   16.52 + * @author S. Aubrecht
   16.53 + */
   16.54 +public enum Platform {
   16.55 +    OSX("macosx"), Linux("linux"), Win32("win32"), Solaris("solaris-x86"), Unsupported(""); //NOI18N //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
   16.56 +
   16.57 +    public static final Platform platform;
   16.58 +    public static final String arch;
   16.59 +    public static final String codeNameBase;
   16.60 +    static final String xulRunnerHome;
   16.61 +
   16.62 +    static {
   16.63 +        String osname = System.getProperty("os.name"); //NOI18N
   16.64 +        if ("Mac OS X".equals(osname)) { //NOI18N
   16.65 +            platform = Platform.OSX;
   16.66 +            codeNameBase = "org.netbeans.core.browser.xulrunner.macosx"; //NOI18N
   16.67 +            xulRunnerHome = "modules/lib/native/macosx/xulrunner"; //NOI18N
   16.68 +        } else if ("Linux".equals(osname)) { //NOI18N
   16.69 +            platform = Platform.Linux;
   16.70 +            codeNameBase = "org.netbeans.core.browser.xulrunner.linux"; //NOI18N
   16.71 +            xulRunnerHome = "modules/lib/native/linux/xulrunner"; //NOI18N
   16.72 +        } else if ("SunOS".equals(osname)) { //NOI18N
   16.73 +            platform = Platform.Solaris;
   16.74 +            codeNameBase = "org.netbeans.core.browser.xulrunner.solaris"; //NOI18N
   16.75 +            xulRunnerHome = "modules/lib/native/solaris-x86/xulrunner"; //NOI18N
   16.76 +        } else if (osname.contains("Windows")) {
   16.77 +            platform = Platform.Win32;
   16.78 +            codeNameBase = "org.netbeans.core.browser.xulrunner.win"; //NOI18N
   16.79 +            xulRunnerHome = "modules/lib/native/win32/xulrunner"; //NOI18N
   16.80 +        } else {
   16.81 +            platform = Platform.Unsupported;
   16.82 +            codeNameBase = "org.netbeans.core.browser.xulrunner.unsupported"; //NOI18N
   16.83 +            xulRunnerHome = "modules/lib/native/unsupported/xulrunner"; //NOI18N
   16.84 +        }
   16.85 +
   16.86 +        String osarch = System.getProperty("os.arch"); //NOI18N
   16.87 +        String archTemp = osarch;
   16.88 +        for (String x : new String[]{"i386", "i486", "i586", "i686"}) { //NOI18N //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
   16.89 +            if (x.equals(osarch)) {
   16.90 +                archTemp = "x86"; //NOI18N
   16.91 +                break;
   16.92 +            }
   16.93 +        }
   16.94 +        arch = archTemp;
   16.95 +    }
   16.96 +
   16.97 +    private final String libDir;
   16.98 +
   16.99 +    private Platform(String libDir) {
  16.100 +        this.libDir = libDir;
  16.101 +    }
  16.102 +
  16.103 +    public String libDir() {
  16.104 +        return libDir;
  16.105 +    }
  16.106 +
  16.107 +    public String arch() {
  16.108 +        return arch;
  16.109 +    }
  16.110 +
  16.111 +    public boolean is32Bit() {
  16.112 +        return "x86".equals(arch);
  16.113 +    }
  16.114 +
  16.115 +    public static boolean usingGTK2Toolkit() {
  16.116 +        return platform==Linux || platform==Solaris;
  16.117 +    }
  16.118 +
  16.119 +    public static long getJavaVersion() {
  16.120 +        String v = System.getProperty("java.version"); //NOI18N
  16.121 +        return jdkVersionToNumber(v);
  16.122 +    }
  16.123 +
  16.124 +    public static boolean checkJavaVersion(String minVersion, String maxVersion) {
  16.125 +        long current = getJavaVersion();
  16.126 +
  16.127 +        if (minVersion!=null && minVersion.length()>0) {
  16.128 +            long min = jdkVersionToNumber(minVersion);
  16.129 +            if (current<min) return false;
  16.130 +        }
  16.131 +
  16.132 +        if (maxVersion!=null && maxVersion.length()>0) {
  16.133 +            long max = jdkVersionToNumber(maxVersion);
  16.134 +            if (current>max) return false;
  16.135 +        }
  16.136 +
  16.137 +        return true;
  16.138 +    }
  16.139 +
  16.140 +    private static long jdkVersionToNumber(String verStr) {
  16.141 +        try {
  16.142 +            String numStr;
  16.143 +            String buildStr;
  16.144 +            int idx = verStr.indexOf("_"); //NOI18N
  16.145 +            if (idx>=0) {
  16.146 +                numStr = verStr.substring(0, idx);
  16.147 +                buildStr = verStr.substring(idx+1);
  16.148 +            } else {
  16.149 +                numStr = verStr;
  16.150 +                buildStr = ""; //NOI18N
  16.151 +            }
  16.152 +
  16.153 +            long num = 0;
  16.154 +            StringTokenizer st = new StringTokenizer(numStr, "."); //NOI18N
  16.155 +            long shift = 100*100*100;
  16.156 +            while (st.hasMoreTokens()) {
  16.157 +                String s = st.nextToken();
  16.158 +                int n = Integer.parseInt(s);
  16.159 +                num += n*shift;
  16.160 +                shift /= 100;
  16.161 +            }
  16.162 +
  16.163 +            if (buildStr.startsWith("b")) buildStr = buildStr.substring(1); //NOI18N
  16.164 +            if( buildStr.contains("-") ) //NOI18N
  16.165 +                buildStr = buildStr.substring(0, buildStr.indexOf("-")); //NOI18N
  16.166 +            if (buildStr.length()>0) {
  16.167 +                int n = Integer.parseInt(buildStr);
  16.168 +                num += n;
  16.169 +            }
  16.170 +
  16.171 +            return num;
  16.172 +        } catch (NumberFormatException e) {
  16.173 +            throw new RuntimeException("Error parsing java version: "+verStr); //NOI18N
  16.174 +        }
  16.175 +    }
  16.176 +
  16.177 +}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebBrowserEventImpl.java	Thu Aug 30 10:56:16 2012 +0200
    17.3 @@ -0,0 +1,112 @@
    17.4 +/*
    17.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.6 + *
    17.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    17.8 + *
    17.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   17.10 + * Other names may be trademarks of their respective owners.
   17.11 + *
   17.12 + * The contents of this file are subject to the terms of either the GNU
   17.13 + * General Public License Version 2 only ("GPL") or the Common
   17.14 + * Development and Distribution License("CDDL") (collectively, the
   17.15 + * "License"). You may not use this file except in compliance with the
   17.16 + * License. You can obtain a copy of the License at
   17.17 + * http://www.netbeans.org/cddl-gplv2.html
   17.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   17.19 + * specific language governing permissions and limitations under the
   17.20 + * License.  When distributing the software, include this License Header
   17.21 + * Notice in each file and include the License file at
   17.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   17.23 + * particular file as subject to the "Classpath" exception as provided
   17.24 + * by Oracle in the GPL Version 2 section of the License file that
   17.25 + * accompanied this code. If applicable, add the following below the
   17.26 + * License Header, with the fields enclosed by brackets [] replaced by
   17.27 + * your own identifying information:
   17.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   17.29 + *
   17.30 + * If you wish your version of this file to be governed by only the CDDL
   17.31 + * or only the GPL Version 2, indicate your decision by adding
   17.32 + * "[Contributor] elects to include this software in this distribution
   17.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   17.34 + * single choice of license, a recipient has the option to distribute
   17.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   17.36 + * to extend the choice of license to its licensees as provided above.
   17.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   17.38 + * Version 2 license, then the option applies only if the new code is
   17.39 + * made subject to such option by the copyright holder.
   17.40 + *
   17.41 + * Contributor(s):
   17.42 + *
   17.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   17.44 + */
   17.45 +
   17.46 +package org.netbeans.core.browser.djnsswt;
   17.47 +
   17.48 +import org.netbeans.core.browser.api.*;
   17.49 +import java.awt.AWTEvent;
   17.50 +import org.w3c.dom.Node;
   17.51 +
   17.52 +/**
   17.53 + * Browser event implementation.
   17.54 + * 
   17.55 + * @author S. Aubrecht
   17.56 + */
   17.57 +class WebBrowserEventImpl extends WebBrowserEvent {
   17.58 +
   17.59 +    private final int type;
   17.60 +    private final WebBrowser browser;
   17.61 +    private final Node node;
   17.62 +    private final AWTEvent event;
   17.63 +    private boolean cancelled = false;
   17.64 +    private final String url;
   17.65 +
   17.66 +    public WebBrowserEventImpl( int type, WebBrowser browser, String url ) {
   17.67 +        this.type = type;
   17.68 +        this.browser = browser;
   17.69 +        this.url = url;
   17.70 +        this.event = null;
   17.71 +        this.node = null;
   17.72 +    }
   17.73 +
   17.74 +    public WebBrowserEventImpl( int type, WebBrowser browser, AWTEvent event, Node node ) {
   17.75 +        this.type = type;
   17.76 +        this.browser = browser;
   17.77 +        this.event = event;
   17.78 +        this.node = node;
   17.79 +        this.url = null;
   17.80 +    }
   17.81 +
   17.82 +    @Override
   17.83 +    public int getType() {
   17.84 +        return type;
   17.85 +    }
   17.86 +
   17.87 +    @Override
   17.88 +    public WebBrowser getWebBrowser() {
   17.89 +        return browser;
   17.90 +    }
   17.91 +
   17.92 +    @Override
   17.93 +    public String getURL() {
   17.94 +        return null != url ? url : browser.getURL();
   17.95 +    }
   17.96 +
   17.97 +    @Override
   17.98 +    public AWTEvent getAWTEvent() {
   17.99 +        return event;
  17.100 +    }
  17.101 +
  17.102 +    @Override
  17.103 +    public Node getNode() {
  17.104 +        return node;
  17.105 +    }
  17.106 +
  17.107 +    @Override
  17.108 +    public void cancel() {
  17.109 +        cancelled = true;
  17.110 +    }
  17.111 +
  17.112 +    boolean isCancelled() {
  17.113 +        return cancelled;
  17.114 +    }
  17.115 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebBrowserImpl.java	Thu Aug 30 10:56:16 2012 +0200
    18.3 @@ -0,0 +1,446 @@
    18.4 +/*
    18.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.6 + *
    18.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    18.8 + *
    18.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   18.10 + * Other names may be trademarks of their respective owners.
   18.11 + *
   18.12 + * The contents of this file are subject to the terms of either the GNU
   18.13 + * General Public License Version 2 only ("GPL") or the Common
   18.14 + * Development and Distribution License("CDDL") (collectively, the
   18.15 + * "License"). You may not use this file except in compliance with the
   18.16 + * License. You can obtain a copy of the License at
   18.17 + * http://www.netbeans.org/cddl-gplv2.html
   18.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   18.19 + * specific language governing permissions and limitations under the
   18.20 + * License.  When distributing the software, include this License Header
   18.21 + * Notice in each file and include the License file at
   18.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   18.23 + * particular file as subject to the "Classpath" exception as provided
   18.24 + * by Oracle in the GPL Version 2 section of the License file that
   18.25 + * accompanied this code. If applicable, add the following below the
   18.26 + * License Header, with the fields enclosed by brackets [] replaced by
   18.27 + * your own identifying information:
   18.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   18.29 + *
   18.30 + * If you wish your version of this file to be governed by only the CDDL
   18.31 + * or only the GPL Version 2, indicate your decision by adding
   18.32 + * "[Contributor] elects to include this software in this distribution
   18.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   18.34 + * single choice of license, a recipient has the option to distribute
   18.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   18.36 + * to extend the choice of license to its licensees as provided above.
   18.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   18.38 + * Version 2 license, then the option applies only if the new code is
   18.39 + * made subject to such option by the copyright holder.
   18.40 + *
   18.41 + * Contributor(s):
   18.42 + *
   18.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   18.44 + */
   18.45 +
   18.46 +package org.netbeans.core.browser.djnsswt;
   18.47 +
   18.48 +import chrriis.dj.nativeswing.NSOption;
   18.49 +import chrriis.dj.nativeswing.swtimpl.NativeInterface;
   18.50 +import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
   18.51 +import chrriis.dj.nativeswing.swtimpl.components.WebBrowserCommandEvent;
   18.52 +import chrriis.dj.nativeswing.swtimpl.components.WebBrowserNavigationEvent;
   18.53 +import chrriis.dj.nativeswing.swtimpl.components.WebBrowserWindowOpeningEvent;
   18.54 +import chrriis.dj.nativeswing.swtimpl.components.WebBrowserWindowWillOpenEvent;
   18.55 +import java.awt.AWTEvent;
   18.56 +import java.awt.BorderLayout;
   18.57 +import java.awt.Component;
   18.58 +import java.beans.PropertyChangeListener;
   18.59 +import java.beans.PropertyChangeSupport;
   18.60 +import java.util.ArrayList;
   18.61 +import java.util.HashMap;
   18.62 +import java.util.List;
   18.63 +import java.util.Map;
   18.64 +import java.util.logging.Logger;
   18.65 +import javax.swing.JPanel;
   18.66 +import org.netbeans.core.browser.api.WebBrowser;
   18.67 +import org.netbeans.core.browser.api.WebBrowserEvent;
   18.68 +import org.netbeans.core.browser.api.WebBrowserListener;
   18.69 +import org.openide.windows.TopComponent;
   18.70 +import org.w3c.dom.Document;
   18.71 +import org.w3c.dom.Node;
   18.72 +
   18.73 +/**
   18.74 + * Browser component implementation.
   18.75 + *
   18.76 + * @author S. Aubrecht
   18.77 + */
   18.78 +class WebBrowserImpl extends WebBrowser implements BrowserCallback, chrriis.dj.nativeswing.swtimpl.components.WebBrowserListener {
   18.79 +    
   18.80 +    private JPanel container;
   18.81 +    private JWebBrowser browser;
   18.82 +    private String urlToLoad;
   18.83 +    private final PropertyChangeSupport propSupport = new PropertyChangeSupport(this);
   18.84 +    private final List<WebBrowserListener> browserListners = new ArrayList<WebBrowserListener>(10);
   18.85 +    private final Object LOCK = new Object();
   18.86 +    private PropertyChangeListener tcListener;
   18.87 +
   18.88 +
   18.89 +    private static final Logger LOG = Logger.getLogger(WebBrowserImpl.class.getName());
   18.90 +
   18.91 +    private static final String CA_DOMAIN = "domain"; //NOI18N
   18.92 +    private static final String CA_PATH = "path"; //NOI18N
   18.93 +    private static final String CA_NAME = "name"; //NOI18N
   18.94 +    private static final String CA_VALUE = "value"; //NOI18N
   18.95 +    private static final String CA_IS_SECURE = "isSecure"; //NOI18N
   18.96 +    private static final String CA_IS_HTTP_ONLY = "isHttpOnly"; //NOI18N
   18.97 +    private static final String CA_IS_SESSION = "isSession"; //NOI18N
   18.98 +    private static final String CA_EXPIRY = "expiry"; //NOI18N
   18.99 +
  18.100 +    private final BrowserType type;
  18.101 +    
  18.102 +    public WebBrowserImpl( BrowserType type ) {
  18.103 +        this.type = type;
  18.104 +    }
  18.105 +
  18.106 +    @Override
  18.107 +    public Component getComponent() {
  18.108 +        synchronized( LOCK ) {
  18.109 +            if( null == container ) {
  18.110 +                NativeInterface.open();
  18.111 +                container = new JPanel( new BorderLayout() ) {
  18.112 +                    public void addNotify() {
  18.113 +                        super.addNotify();
  18.114 +                    }
  18.115 +                };
  18.116 +                browser = createBrowser();
  18.117 +                container.add( browser, BorderLayout.CENTER );
  18.118 +            }
  18.119 +        }
  18.120 +        return container;
  18.121 +    }
  18.122 +
  18.123 +    @Override
  18.124 +    public void reloadDocument() {
  18.125 +        if( !isInitialized() )
  18.126 +            return;
  18.127 +        browser.reloadPage();
  18.128 +    }
  18.129 +
  18.130 +    @Override
  18.131 +    public void stopLoading() {
  18.132 +        if( !isInitialized() )
  18.133 +            return;
  18.134 +        browser.stopLoading();
  18.135 +    }
  18.136 +
  18.137 +    @Override
  18.138 +    public void setURL(String url) {
  18.139 +        if( !isInitialized() ) {
  18.140 +            urlToLoad = url;
  18.141 +            return;
  18.142 +        }
  18.143 +        browser.navigate( url);
  18.144 +    }
  18.145 +
  18.146 +    @Override
  18.147 +    public String getURL() {
  18.148 +        if( !isInitialized() )
  18.149 +            return null;
  18.150 +        String url = browser.getResourceLocation();
  18.151 +        if( null == url )
  18.152 +            url = urlToLoad;
  18.153 +        return url;
  18.154 +    }
  18.155 +
  18.156 +    @Override
  18.157 +    public String getStatusMessage() {
  18.158 +        if( !isInitialized() )
  18.159 +            return null;
  18.160 +        return browser.getStatusText();
  18.161 +    }
  18.162 +
  18.163 +    @Override
  18.164 +    public String getTitle() {
  18.165 +        if( !isInitialized() )
  18.166 +            return null;
  18.167 +        return browser.getPageTitle();
  18.168 +    }
  18.169 +
  18.170 +    @Override
  18.171 +    public boolean isForward() {
  18.172 +        if( !isInitialized() )
  18.173 +            return false;
  18.174 +        return browser.isForwardNavigationEnabled();
  18.175 +    }
  18.176 +
  18.177 +    @Override
  18.178 +    public void forward() {
  18.179 +        if( !isInitialized() )
  18.180 +            return;
  18.181 +        browser.navigateForward();
  18.182 +    }
  18.183 +
  18.184 +    @Override
  18.185 +    public boolean isBackward() {
  18.186 +        if( !isInitialized() )
  18.187 +            return false;
  18.188 +        return browser.isBackNavigationEnabled();
  18.189 +    }
  18.190 +
  18.191 +    @Override
  18.192 +    public void backward() {
  18.193 +        if( !isInitialized() )
  18.194 +            return;
  18.195 +        browser.navigateBack();
  18.196 +    }
  18.197 +
  18.198 +    @Override
  18.199 +    public boolean isHistory() {
  18.200 +        return false; //TODO implement this
  18.201 +    }
  18.202 +
  18.203 +    @Override
  18.204 +    public void showHistory() {
  18.205 +        //TODO implement this
  18.206 +    }
  18.207 +
  18.208 +    @Override
  18.209 +    public void addPropertyChangeListener(PropertyChangeListener l) {
  18.210 +        propSupport.addPropertyChangeListener(l);
  18.211 +    }
  18.212 +
  18.213 +    @Override
  18.214 +    public void removePropertyChangeListener(PropertyChangeListener l) {
  18.215 +        propSupport.removePropertyChangeListener(l);
  18.216 +    }
  18.217 +
  18.218 +    @Override
  18.219 +    public void setContent(String content) {
  18.220 +        if( !isInitialized() ) {
  18.221 +            return;
  18.222 +        }
  18.223 +        browser.setHTMLContent( content );
  18.224 +    }
  18.225 +
  18.226 +    @Override
  18.227 +    public Document getDocument() {
  18.228 +        if( !isInitialized() )
  18.229 +            return null;
  18.230 +        return null;//browser.getWebBrowserWindow().Document();
  18.231 +    }
  18.232 +
  18.233 +    @Override
  18.234 +    public void dispose() {
  18.235 +        synchronized( LOCK ) {
  18.236 +            if( isInitialized() ) {
  18.237 +                container.removeAll();
  18.238 +                browser.disposeNativePeer();
  18.239 +                browser = null;
  18.240 +            }
  18.241 +            browserListners.clear();
  18.242 +            container = null;
  18.243 +        }
  18.244 +        if( null != tcListener ) {
  18.245 +            TopComponent.getRegistry().removePropertyChangeListener( tcListener );
  18.246 +        }
  18.247 +    }
  18.248 +
  18.249 +    @Override
  18.250 +    public void addWebBrowserListener(WebBrowserListener l) {
  18.251 +        synchronized( browserListners ) {
  18.252 +            browserListners.add(l);
  18.253 +        }
  18.254 +    }
  18.255 +
  18.256 +    @Override
  18.257 +    public void removeWebBrowserListener(WebBrowserListener l) {
  18.258 +        synchronized( browserListners ) {
  18.259 +            browserListners.remove(l);
  18.260 +        }
  18.261 +    }
  18.262 +
  18.263 +    @Override
  18.264 +    public Map<String, String> getCookie(String domain, String name, String path) {
  18.265 +        if( isInitialized() ) {
  18.266 +//            nsICookieManager cm = XPCOMUtils.getService(SERVICE_COOKIE_MANAGER, nsICookieManager.class);
  18.267 +//            if( null != cm ) {
  18.268 +//                nsISimpleEnumerator enumerator = cm.getEnumerator();
  18.269 +//                nsICookie theCookie = null;
  18.270 +//                while( enumerator.hasMoreElements() ) {
  18.271 +//                    nsISupports obj = enumerator.getNext();
  18.272 +//                    nsICookie cookie = XPCOMUtils.qi(obj, nsICookie.class);
  18.273 +//                    if( null == cookie )
  18.274 +//                        continue;
  18.275 +//                    LOG.log(Level.FINER, "Cookie: domain={0}, name={1}, path={2}, value={3}", //NOI18N
  18.276 +//                        new Object[] { cookie.getHost(), cookie.getName(), cookie.getPath(), cookie.getValue() });
  18.277 +//
  18.278 +//                    if( (null == domain || domain.equals(cookie.getHost()))
  18.279 +//                            && (null == name || name.equals(cookie.getName()))
  18.280 +//                            && (null == path || path.equals(cookie.getPath()))) {
  18.281 +//                        theCookie = cookie;
  18.282 +//                        break;
  18.283 +//                    }
  18.284 +//                }
  18.285 +//                if( null == theCookie ) {
  18.286 +//                    LOG.log(Level.FINE, "Cookie not found, domain={0}, name={1}, path={2}", //NOI18N
  18.287 +//                            new Object[] {domain, name, path} );
  18.288 +//                } else {
  18.289 +//                    return cookie2map( theCookie );
  18.290 +//                }
  18.291 +//            } else {
  18.292 +//                LOG.info("CookieManager interface not found."); //NOI18N
  18.293 +//            }
  18.294 +        }
  18.295 +        return new HashMap<String, String>(0);
  18.296 +
  18.297 +    }
  18.298 +
  18.299 +    @Override
  18.300 +    public void deleteCookie(String domain, String name, String path) {
  18.301 +        if( !isInitialized() )
  18.302 +            return;
  18.303 +//        nsICookieManager cm = XPCOMUtils.getService(SERVICE_COOKIE_MANAGER, nsICookieManager.class);
  18.304 +//        if( null != cm ) {
  18.305 +//            cm.remove(domain, name, path, false);
  18.306 +//            LOG.log(Level.FINE, "Cookie removed, domain={0}, name={1}, path={2}",  //NOI18N
  18.307 +//                    new Object[] {domain, name, path} );
  18.308 +//        } else {
  18.309 +//            LOG.info("CookieManager interface not found."); //NOI18N
  18.310 +//        }
  18.311 +    }
  18.312 +
  18.313 +    @Override
  18.314 +    public void addCookie(Map<String, String> cookie) {
  18.315 +        if( !isInitialized() )
  18.316 +            return;
  18.317 +//        nsICookieManager2 cm = XPCOMUtils.getService(SERVICE_COOKIE_MANAGER, nsICookieManager2.class);
  18.318 +//        if( null != cm ) {
  18.319 +//            String aDomain = cookie.get(CA_DOMAIN);
  18.320 +//            String aPath = cookie.get(CA_PATH);
  18.321 +//            String aName = cookie.get(CA_NAME);
  18.322 +//            String aValue = cookie.get(CA_VALUE);
  18.323 +//            boolean aIsSecure = Boolean.valueOf(cookie.get(CA_IS_SECURE));
  18.324 +//            boolean aIsHttpOnly = Boolean.valueOf(cookie.get(CA_IS_HTTP_ONLY));
  18.325 +//            boolean aIsSession = Boolean.valueOf(cookie.get(CA_IS_SESSION));
  18.326 +//            long aExpiry = 0; //TODO use default expiration interval
  18.327 +//            String expiry = cookie.get(CA_EXPIRY);
  18.328 +//            if( null != expiry ) {
  18.329 +//                aExpiry = Long.valueOf(expiry).longValue();
  18.330 +//            }
  18.331 +//            cm.add(aDomain, aPath, aName, aValue, aIsSecure, aIsHttpOnly, aIsSession, aExpiry);
  18.332 +//        } else {
  18.333 +//            LOG.info("CookieManager2 interface not found."); //NOI18N
  18.334 +//        }
  18.335 +    }
  18.336 +
  18.337 +    @Override
  18.338 +    public Object executeJavaScript(String script) {
  18.339 +        if( !isInitialized() )
  18.340 +            return null;
  18.341 +        return browser.executeJavascriptWithResult(script);
  18.342 +    }
  18.343 +
  18.344 +    private boolean isInitialized() {
  18.345 +        synchronized( LOCK ) {
  18.346 +            return null != browser;
  18.347 +        }
  18.348 +    }
  18.349 +
  18.350 +    public boolean fireBrowserEvent(int type, String url) {
  18.351 +        WebBrowserEventImpl event = new WebBrowserEventImpl(type, this, url);
  18.352 +        urlToLoad = url;
  18.353 +        synchronized( browserListners ) {
  18.354 +            for( WebBrowserListener l : browserListners ) {
  18.355 +                l.onDispatchEvent(event);
  18.356 +            }
  18.357 +        }
  18.358 +        return event.isCancelled();
  18.359 +    }
  18.360 +
  18.361 +    public void fireBrowserEvent(int type, AWTEvent e, Node n) {
  18.362 +        WebBrowserEvent event = new WebBrowserEventImpl(type, this, e, n);
  18.363 +        synchronized( browserListners ) {
  18.364 +            for( WebBrowserListener l : browserListners ) {
  18.365 +                l.onDispatchEvent(event);
  18.366 +            }
  18.367 +        }
  18.368 +    }
  18.369 +
  18.370 +
  18.371 +//    private static Map<String, String> cookie2map(nsICookie cookie) {
  18.372 +//        Map<String, String> res = new HashMap<String, String>(10);
  18.373 +//        res.put(CA_PATH, cookie.getPath());
  18.374 +//        res.put(CA_DOMAIN, cookie.getHost());
  18.375 +////        res.put(CA_EXPIRY, String.valueOf(cookie.getExpiry()));
  18.376 +////        res.put(CA_IS_HTTP_ONLY, String.valueOf(cookie.getIsHttpOnly()));
  18.377 +//        res.put(CA_IS_SECURE, String.valueOf(cookie.getIsSecure()));
  18.378 +////        res.put(CA_IS_SESSION, String.valueOf(cookie.getIsSession()));
  18.379 +//        res.put(CA_NAME, cookie.getName());
  18.380 +//        res.put(CA_VALUE, cookie.getValue());
  18.381 +//        return res;
  18.382 +//    }
  18.383 +
  18.384 +    @Override
  18.385 +    public void windowWillOpen( WebBrowserWindowWillOpenEvent wbwwoe ) {
  18.386 +        browser.getWebBrowserWindow().setBarsVisible( false );
  18.387 +    }
  18.388 +
  18.389 +    @Override
  18.390 +    public void windowOpening( WebBrowserWindowOpeningEvent wbwoe ) {
  18.391 +    }
  18.392 +
  18.393 +    @Override
  18.394 +    public void windowClosing( chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent wbe ) {
  18.395 +    }
  18.396 +
  18.397 +    @Override
  18.398 +    public void locationChanging( WebBrowserNavigationEvent wbne ) {
  18.399 +    }
  18.400 +
  18.401 +    @Override
  18.402 +    public void locationChanged( WebBrowserNavigationEvent wbne ) {
  18.403 +        boolean isBack = isBackward();
  18.404 +        boolean isForward = isForward();
  18.405 +        propSupport.firePropertyChange(HtmlBrowserImpl.PROP_BACKWARD, !isBack, isBack);
  18.406 +        propSupport.firePropertyChange(HtmlBrowserImpl.PROP_FORWARD, !isForward, isForward);
  18.407 +        propSupport.firePropertyChange(HtmlBrowserImpl.PROP_URL, null, wbne.getNewResourceLocation());
  18.408 +    }
  18.409 +
  18.410 +    @Override
  18.411 +    public void locationChangeCanceled( WebBrowserNavigationEvent wbne ) {
  18.412 +    }
  18.413 +
  18.414 +    @Override
  18.415 +    public void loadingProgressChanged( chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent wbe ) {
  18.416 +    }
  18.417 +
  18.418 +    @Override
  18.419 +    public void titleChanged( chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent wbe ) {
  18.420 +        propSupport.firePropertyChange(HtmlBrowserImpl.PROP_TITLE, null, browser.getPageTitle());
  18.421 +    }
  18.422 +
  18.423 +    @Override
  18.424 +    public void statusChanged( chrriis.dj.nativeswing.swtimpl.components.WebBrowserEvent wbe ) {
  18.425 +        propSupport.firePropertyChange(HtmlBrowserImpl.PROP_STATUS_MESSAGE, null, browser.getStatusText());
  18.426 +    }
  18.427 +
  18.428 +    @Override
  18.429 +    public void commandReceived( WebBrowserCommandEvent wbce ) {
  18.430 +    }
  18.431 +    
  18.432 +    private JWebBrowser createBrowser() {
  18.433 +        List<NSOption> options = new ArrayList<NSOption>( 4 );
  18.434 +        options.add( JWebBrowser.destroyOnFinalization() );
  18.435 +        options.add( JWebBrowser.proxyComponentHierarchy() );
  18.436 +        switch( type ) {
  18.437 +            case Mozilla:
  18.438 +                options.add( JWebBrowser.useXULRunnerRuntime() );
  18.439 +                break;
  18.440 +            case Webkit:
  18.441 +                options.add( JWebBrowser.useWebkitRuntime() );
  18.442 +                break;
  18.443 +        }
  18.444 +        JWebBrowser res = new JWebBrowser( options.toArray( new NSOption[options.size()] ) );  
  18.445 +        res.addWebBrowserListener( this );
  18.446 +        res.setBarsVisible( false );
  18.447 +        return res;
  18.448 +    }
  18.449 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/WebkitBrowserFactoryImpl.java	Thu Aug 30 10:56:16 2012 +0200
    19.3 @@ -0,0 +1,84 @@
    19.4 +/*
    19.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    19.6 + *
    19.7 + * Copyright 2010 Oracle and/or its affiliates. All rights reserved.
    19.8 + *
    19.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   19.10 + * Other names may be trademarks of their respective owners.
   19.11 + *
   19.12 + * The contents of this file are subject to the terms of either the GNU
   19.13 + * General Public License Version 2 only ("GPL") or the Common
   19.14 + * Development and Distribution License("CDDL") (collectively, the
   19.15 + * "License"). You may not use this file except in compliance with the
   19.16 + * License. You can obtain a copy of the License at
   19.17 + * http://www.netbeans.org/cddl-gplv2.html
   19.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   19.19 + * specific language governing permissions and limitations under the
   19.20 + * License.  When distributing the software, include this License Header
   19.21 + * Notice in each file and include the License file at
   19.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   19.23 + * particular file as subject to the "Classpath" exception as provided
   19.24 + * by Oracle in the GPL Version 2 section of the License file that
   19.25 + * accompanied this code. If applicable, add the following below the
   19.26 + * License Header, with the fields enclosed by brackets [] replaced by
   19.27 + * your own identifying information:
   19.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   19.29 + *
   19.30 + * If you wish your version of this file to be governed by only the CDDL
   19.31 + * or only the GPL Version 2, indicate your decision by adding
   19.32 + * "[Contributor] elects to include this software in this distribution
   19.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   19.34 + * single choice of license, a recipient has the option to distribute
   19.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   19.36 + * to extend the choice of license to its licensees as provided above.
   19.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   19.38 + * Version 2 license, then the option applies only if the new code is
   19.39 + * made subject to such option by the copyright holder.
   19.40 + *
   19.41 + * Contributor(s):
   19.42 + *
   19.43 + * Portions Copyrighted 2009 Sun Microsystems, Inc.
   19.44 + */
   19.45 +
   19.46 +package org.netbeans.core.browser.djnsswt;
   19.47 +
   19.48 +import java.beans.PropertyChangeListener;
   19.49 +import java.beans.PropertyChangeSupport;
   19.50 +import org.netbeans.core.browser.api.EmbeddedBrowserFactory;
   19.51 +import org.netbeans.core.browser.api.WebBrowser;
   19.52 +import org.openide.util.lookup.ServiceProvider;
   19.53 +
   19.54 +/**
   19.55 + * Embedded browser factory.
   19.56 + * 
   19.57 + * @author S. Aubrecht
   19.58 + */
   19.59 +@ServiceProvider(service=EmbeddedBrowserFactory.class)
   19.60 +public class WebkitBrowserFactoryImpl extends EmbeddedBrowserFactory {
   19.61 +
   19.62 +    private final PropertyChangeSupport propSupport = new PropertyChangeSupport(this);
   19.63 +    public WebkitBrowserFactoryImpl() {
   19.64 +    }
   19.65 +
   19.66 +    @Override
   19.67 +    public boolean isEnabled() {
   19.68 +        return !BrowserFactory.isWebkitHidden();
   19.69 +    }
   19.70 +
   19.71 +    @Override
   19.72 +    public WebBrowser createEmbeddedBrowser() {
   19.73 +        if( !isEnabled() )
   19.74 +            throw new IllegalStateException();
   19.75 +        return new WebBrowserImpl(BrowserType.Webkit);
   19.76 +    }
   19.77 +
   19.78 +    @Override
   19.79 +    public void addPropertyChangeListener(PropertyChangeListener l) {
   19.80 +        propSupport.addPropertyChangeListener(l);
   19.81 +    }
   19.82 +
   19.83 +    @Override
   19.84 +    public void removePropertyChangeListener(PropertyChangeListener l) {
   19.85 +        propSupport.removePropertyChangeListener(l);
   19.86 +    }
   19.87 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/explorerBrowser.xml	Thu Aug 30 10:56:16 2012 +0200
    20.3 @@ -0,0 +1,9 @@
    20.4 +<?xml version="1.0"?>
    20.5 +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
    20.6 +<settings version="1.0">
    20.7 +    <module name="org.netbeans.core.browser.djnsswt/1"/>
    20.8 +    <instanceof class="java.lang.Object"/>
    20.9 +    <instanceof class="org.openide.awt.HtmlBrowser$Factory"/>
   20.10 +    <instanceof class="java.io.Serializable"/>
   20.11 +    <instance method="createExplorerInstance"  class="org.netbeans.core.browser.djnsswt.BrowserFactory"/>
   20.12 +</settings>
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/layer.xml	Thu Aug 30 10:56:16 2012 +0200
    21.3 @@ -0,0 +1,29 @@
    21.4 +<?xml version="1.0" encoding="UTF-8"?>
    21.5 +<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.2//EN" "http://www.netbeans.org/dtds/filesystem-1_2.dtd">
    21.6 +<filesystem>
    21.7 +    <folder name="Services">
    21.8 +        <folder name="Browsers">
    21.9 +            <file name="SWT_Explorer.settings" url="explorerBrowser.xml">
   21.10 +                <attr name="hidden" methodvalue="org.netbeans.core.browser.djnsswt.BrowserFactory.isExplorerHidden"/>
   21.11 +                <attr name="internal" boolvalue="true"/>
   21.12 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.core.browser.djnsswt.Bundle"/>
   21.13 +                <attr name="SystemFileSystem.icon" urlvalue="nbres:/org/netbeans/modules/extbrowser/resources/extbrowser.gif"/>
   21.14 +                <attr name="position" intvalue="10100"/>
   21.15 +            </file>
   21.16 +            <file name="SWT_Mozilla.settings" url="mozillaBrowser.xml">
   21.17 +                <attr name="hidden" methodvalue="org.netbeans.core.browser.djnsswt.BrowserFactory.isMozillaHidden"/>
   21.18 +                <attr name="internal" boolvalue="true"/>
   21.19 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.core.browser.djnsswt.Bundle"/>
   21.20 +                <attr name="SystemFileSystem.icon" urlvalue="nbres:/org/netbeans/modules/extbrowser/resources/extbrowser.gif"/>
   21.21 +                <attr name="position" intvalue="10200"/>
   21.22 +            </file>
   21.23 +            <file name="SWT_Webkit.settings" url="webkitBrowser.xml">
   21.24 +                <attr name="hidden" methodvalue="org.netbeans.core.browser.djnsswt.BrowserFactory.isWebkitHidden"/>
   21.25 +                <attr name="internal" boolvalue="true"/>
   21.26 +                <attr name="SystemFileSystem.localizingBundle" stringvalue="org.netbeans.core.browser.djnsswt.Bundle"/>
   21.27 +                <attr name="SystemFileSystem.icon" urlvalue="nbres:/org/netbeans/modules/extbrowser/resources/extbrowser.gif"/>
   21.28 +                <attr name="position" intvalue="10300"/>
   21.29 +            </file>
   21.30 +        </folder>
   21.31 +    </folder>
   21.32 +</filesystem>
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/mozillaBrowser.xml	Thu Aug 30 10:56:16 2012 +0200
    22.3 @@ -0,0 +1,9 @@
    22.4 +<?xml version="1.0"?>
    22.5 +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
    22.6 +<settings version="1.0">
    22.7 +    <module name="org.netbeans.core.browser.djnsswt/1"/>
    22.8 +    <instanceof class="java.lang.Object"/>
    22.9 +    <instanceof class="org.openide.awt.HtmlBrowser$Factory"/>
   22.10 +    <instanceof class="java.io.Serializable"/>
   22.11 +    <instance method="createMozillaInstance"  class="org.netbeans.core.browser.djnsswt.BrowserFactory"/>
   22.12 +</settings>
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/core.browser.djnsswt/src/org/netbeans/core/browser/djnsswt/webkitBrowser.xml	Thu Aug 30 10:56:16 2012 +0200
    23.3 @@ -0,0 +1,9 @@
    23.4 +<?xml version="1.0"?>
    23.5 +<!DOCTYPE settings PUBLIC "-//NetBeans//DTD Session settings 1.0//EN" "http://www.netbeans.org/dtds/sessionsettings-1_0.dtd">
    23.6 +<settings version="1.0">
    23.7 +    <module name="org.netbeans.core.browser.djnsswt/1"/>
    23.8 +    <instanceof class="java.lang.Object"/>
    23.9 +    <instanceof class="org.openide.awt.HtmlBrowser$Factory"/>
   23.10 +    <instanceof class="java.io.Serializable"/>
   23.11 +    <instance method="createWebkitInstance" class="org.netbeans.core.browser.djnsswt.BrowserFactory"/>
   23.12 +</settings>