ko4j.debugging has been moved to main repository
authorJaroslav Tulach <jtulach@netbeans.org>
Tue, 22 Jul 2014 05:39:31 +0200
changeset 182004374f01d7aca
parent 18199 c81b23c64961
child 18201 de3f3986d3a0
ko4j.debugging has been moved to main repository
ko4j.debugging/build.xml
ko4j.debugging/manifest.mf
ko4j.debugging/nbproject/project.properties
ko4j.debugging/nbproject/project.xml
ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Bundle.properties
ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/MessageDispatcherImpl.java
ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Server.java
ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Transport.java
ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/TurnInspectOn.java
     1.1 --- a/ko4j.debugging/build.xml	Sat Jul 05 22:50:03 2014 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,5 +0,0 @@
     1.4 -<?xml version="1.0" encoding="UTF-8"?>
     1.5 -<project basedir="." default="netbeans" name="contrib/ko4j.debugging">
     1.6 -    <description>Builds, tests, and runs the project org.netbeans.modules.ko4j.debugging</description>
     1.7 -    <import file="../../nbbuild/templates/projectized.xml"/>
     1.8 -</project>
     2.1 --- a/ko4j.debugging/manifest.mf	Sat Jul 05 22:50:03 2014 +0200
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,7 +0,0 @@
     2.4 -Manifest-Version: 1.0
     2.5 -AutoUpdate-Show-In-Client: true
     2.6 -OpenIDE-Module: org.netbeans.modules.ko4j.debugging
     2.7 -OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/ko4j/debugging/Bundle.properties
     2.8 -OpenIDE-Module-Specification-Version: 0.4
     2.9 -OpenIDE-Module-Needs: org.netbeans.modules.web.browser.api.PageInspector
    2.10 -
     3.1 --- a/ko4j.debugging/nbproject/project.properties	Sat Jul 05 22:50:03 2014 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,5 +0,0 @@
     3.4 -javac.source=1.6
     3.5 -javac.compilerargs=-Xlint -Xlint:-serial
     3.6 -
     3.7 -nbm.homepage=http://bits.netbeans.org/html+java/
     3.8 -nbm.module.author=Jaroslav Tulach
     4.1 --- a/ko4j.debugging/nbproject/project.xml	Sat Jul 05 22:50:03 2014 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,79 +0,0 @@
     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.modules.ko4j.debugging</code-name-base>
    4.10 -            <module-dependencies>
    4.11 -                <dependency>
    4.12 -                    <code-name-base>org.netbeans.libs.json_simple</code-name-base>
    4.13 -                    <build-prerequisite/>
    4.14 -                    <compile-dependency/>
    4.15 -                    <run-dependency>
    4.16 -                        <release-version>1</release-version>
    4.17 -                        <specification-version>0.6</specification-version>
    4.18 -                    </run-dependency>
    4.19 -                </dependency>
    4.20 -                <dependency>
    4.21 -                    <code-name-base>org.netbeans.modules.maven</code-name-base>
    4.22 -                    <build-prerequisite/>
    4.23 -                    <compile-dependency/>
    4.24 -                    <run-dependency>
    4.25 -                        <release-version>2</release-version>
    4.26 -                        <specification-version>2.86</specification-version>
    4.27 -                    </run-dependency>
    4.28 -                </dependency>
    4.29 -                <dependency>
    4.30 -                    <code-name-base>org.netbeans.modules.projectapi</code-name-base>
    4.31 -                    <build-prerequisite/>
    4.32 -                    <compile-dependency/>
    4.33 -                    <run-dependency>
    4.34 -                        <release-version>1</release-version>
    4.35 -                        <specification-version>1.54</specification-version>
    4.36 -                    </run-dependency>
    4.37 -                </dependency>
    4.38 -                <dependency>
    4.39 -                    <code-name-base>org.netbeans.modules.web.browser.api</code-name-base>
    4.40 -                    <build-prerequisite/>
    4.41 -                    <compile-dependency/>
    4.42 -                    <run-dependency>
    4.43 -                        <specification-version>1.30</specification-version>
    4.44 -                    </run-dependency>
    4.45 -                </dependency>
    4.46 -                <dependency>
    4.47 -                    <code-name-base>org.netbeans.modules.web.webkit.debugging</code-name-base>
    4.48 -                    <build-prerequisite/>
    4.49 -                    <compile-dependency/>
    4.50 -                    <run-dependency>
    4.51 -                        <specification-version>1.27</specification-version>
    4.52 -                    </run-dependency>
    4.53 -                </dependency>
    4.54 -                <dependency>
    4.55 -                    <code-name-base>org.openide.awt</code-name-base>
    4.56 -                    <build-prerequisite/>
    4.57 -                    <compile-dependency/>
    4.58 -                    <run-dependency>
    4.59 -                        <specification-version>7.59</specification-version>
    4.60 -                    </run-dependency>
    4.61 -                </dependency>
    4.62 -                <dependency>
    4.63 -                    <code-name-base>org.openide.util</code-name-base>
    4.64 -                    <build-prerequisite/>
    4.65 -                    <compile-dependency/>
    4.66 -                    <run-dependency>
    4.67 -                        <specification-version>8.33</specification-version>
    4.68 -                    </run-dependency>
    4.69 -                </dependency>
    4.70 -                <dependency>
    4.71 -                    <code-name-base>org.openide.util.lookup</code-name-base>
    4.72 -                    <build-prerequisite/>
    4.73 -                    <compile-dependency/>
    4.74 -                    <run-dependency>
    4.75 -                        <specification-version>8.22</specification-version>
    4.76 -                    </run-dependency>
    4.77 -                </dependency>
    4.78 -            </module-dependencies>
    4.79 -            <public-packages/>
    4.80 -        </data>
    4.81 -    </configuration>
    4.82 -</project>
     5.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Bundle.properties	Sat Jul 05 22:50:03 2014 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,6 +0,0 @@
     5.4 -OpenIDE-Module-Display-Category=HTML5
     5.5 -OpenIDE-Module-Long-Description=\
     5.6 -    Web inspector for HTML with Java technology. \
     5.7 -    Whenever an HTML+Java application is started from NetBeans it opens a socket connection and shows the applications HTML page inside of NetBeans IDE's DOM inspector and CSS style navigator.
     5.8 -OpenIDE-Module-Name=KO for Java Inspection
     5.9 -OpenIDE-Module-Short-Description=Web inspector for HTML with Java
     6.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/MessageDispatcherImpl.java	Sat Jul 05 22:50:03 2014 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,57 +0,0 @@
     6.4 -/*
     6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 - *
     6.7 - * Copyright 2013 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 2013 Sun Microsystems, Inc.
    6.44 - */
    6.45 -package org.netbeans.modules.ko4j.debugging;
    6.46 -
    6.47 -import org.netbeans.modules.web.browser.spi.MessageDispatcher;
    6.48 -
    6.49 -/**
    6.50 - *
    6.51 - * @author Jan Stola
    6.52 - */
    6.53 -public class MessageDispatcherImpl extends MessageDispatcher {
    6.54 -
    6.55 -    @Override
    6.56 -    protected void dispatchMessage(String featureId, String message) {
    6.57 -        super.dispatchMessage(featureId, message);
    6.58 -    }
    6.59 -
    6.60 -}
     7.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Server.java	Sat Jul 05 22:50:03 2014 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,99 +0,0 @@
     7.4 -/*
     7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 - *
     7.7 - * Copyright 2013 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 - * If you wish your version of this file to be governed by only the CDDL
    7.31 - * or only the GPL Version 2, indicate your decision by adding
    7.32 - * "[Contributor] elects to include this software in this distribution
    7.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    7.34 - * single choice of license, a recipient has the option to distribute
    7.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    7.36 - * to extend the choice of license to its licensees as provided above.
    7.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    7.38 - * Version 2 license, then the option applies only if the new code is
    7.39 - * made subject to such option by the copyright holder.
    7.40 - *
    7.41 - * Contributor(s):
    7.42 - *
    7.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
    7.44 - */
    7.45 -package org.netbeans.modules.ko4j.debugging;
    7.46 -
    7.47 -import java.io.IOException;
    7.48 -import java.net.ServerSocket;
    7.49 -import java.net.Socket;
    7.50 -import org.netbeans.modules.web.browser.api.PageInspector;
    7.51 -import org.netbeans.modules.web.webkit.debugging.api.WebKitDebugging;
    7.52 -import org.netbeans.modules.web.webkit.debugging.spi.Factory;
    7.53 -import org.openide.util.Exceptions;
    7.54 -import org.openide.util.Lookup;
    7.55 -import org.openide.util.lookup.Lookups;
    7.56 -
    7.57 -/**
    7.58 - * 
    7.59 - * @author Jan Stola
    7.60 - */
    7.61 -final class Server {
    7.62 -    private static final Server INSTANCE = new Server();
    7.63 -    private ServerSocket socket;
    7.64 -
    7.65 -    public static Server getInstance() {
    7.66 -        return INSTANCE;
    7.67 -    }
    7.68 -    
    7.69 -    public int acceptClient() {
    7.70 -        ensureStarted();
    7.71 -        Thread t = new Thread(new Runnable() {
    7.72 -            @Override
    7.73 -            public void run() {
    7.74 -                try {
    7.75 -                    Socket client = socket.accept();
    7.76 -                    MessageDispatcherImpl dispatcher = new MessageDispatcherImpl();
    7.77 -                    Transport transport = new Transport(client, dispatcher);
    7.78 -                    WebKitDebugging webKit = Factory.createWebKitDebugging(transport);
    7.79 -                    Lookup context = Lookups.fixed(transport, webKit, dispatcher);
    7.80 -                    PageInspector.getDefault().inspectPage(context);
    7.81 -                } catch (IOException ioex) {
    7.82 -                    Exceptions.printStackTrace(ioex);
    7.83 -                }
    7.84 -            }
    7.85 -        });
    7.86 -        t.start();
    7.87 -        return socket.getLocalPort();
    7.88 -    }
    7.89 -
    7.90 -    private synchronized void ensureStarted() {
    7.91 -        if (socket != null) {
    7.92 -            return;
    7.93 -        }
    7.94 -        try {
    7.95 -            socket = new ServerSocket();
    7.96 -            socket.bind(null);
    7.97 -        } catch (IOException ioex) {
    7.98 -            Exceptions.printStackTrace(ioex);
    7.99 -        }
   7.100 -    }
   7.101 -
   7.102 -}
     8.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Transport.java	Sat Jul 05 22:50:03 2014 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,145 +0,0 @@
     8.4 -/*
     8.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 - *
     8.7 - * Copyright 2013 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 2013 Sun Microsystems, Inc.
    8.44 - */
    8.45 -package org.netbeans.modules.ko4j.debugging;
    8.46 -
    8.47 -import java.io.IOException;
    8.48 -import java.io.ObjectInputStream;
    8.49 -import java.io.ObjectOutputStream;
    8.50 -import java.net.Socket;
    8.51 -import java.net.URL;
    8.52 -import java.nio.charset.StandardCharsets;
    8.53 -import org.json.simple.JSONObject;
    8.54 -import org.json.simple.JSONValue;
    8.55 -import org.json.simple.parser.ParseException;
    8.56 -import org.netbeans.modules.web.browser.api.PageInspector;
    8.57 -import org.netbeans.modules.web.webkit.debugging.api.TransportStateException;
    8.58 -import org.netbeans.modules.web.webkit.debugging.spi.Command;
    8.59 -import org.netbeans.modules.web.webkit.debugging.spi.Response;
    8.60 -import org.netbeans.modules.web.webkit.debugging.spi.ResponseCallback;
    8.61 -import org.netbeans.modules.web.webkit.debugging.spi.TransportImplementation;
    8.62 -import org.openide.util.Exceptions;
    8.63 -
    8.64 -/**
    8.65 - *
    8.66 - * @author Jan Stola
    8.67 - */
    8.68 -public class Transport implements TransportImplementation {
    8.69 -    private ObjectInputStream input;
    8.70 -    private ObjectOutputStream output;
    8.71 -    private ResponseCallback callback;
    8.72 -    private MessageDispatcherImpl messageDispatcher;
    8.73 -    
    8.74 -    public Transport(Socket socket, MessageDispatcherImpl messageDispatcher) {
    8.75 -        try {
    8.76 -            this.messageDispatcher = messageDispatcher;
    8.77 -            input = new ObjectInputStream(socket.getInputStream());
    8.78 -            output = new ObjectOutputStream(socket.getOutputStream());
    8.79 -            Thread t = new Thread(new Runnable() {
    8.80 -                @Override
    8.81 -                public void run() {
    8.82 -                    try {
    8.83 -                        while (true) {
    8.84 -                            int length = input.readInt();
    8.85 -                            byte[] bytes = new byte[length];
    8.86 -                            input.readFully(bytes);
    8.87 -                            String message = new String(bytes, StandardCharsets.UTF_8);
    8.88 -                            JSONObject json = (JSONObject)JSONValue.parseWithException(message);
    8.89 -                            callback.handleResponse(new Response(json));
    8.90 -                        }
    8.91 -                    } catch (IOException ioex) {
    8.92 -                        ioex.printStackTrace();
    8.93 -                    } catch (ParseException pex) {
    8.94 -                        pex.printStackTrace();
    8.95 -                    }
    8.96 -                    Transport.this.messageDispatcher.dispatchMessage(PageInspector.MESSAGE_DISPATCHER_FEATURE_ID, null);
    8.97 -                }                
    8.98 -            });
    8.99 -            t.start();
   8.100 -        } catch (IOException ioex) {
   8.101 -            Exceptions.printStackTrace(ioex);
   8.102 -        }
   8.103 -    }
   8.104 -
   8.105 -    @Override
   8.106 -    public boolean attach() {
   8.107 -        return true;
   8.108 -    }
   8.109 -
   8.110 -    @Override
   8.111 -    public boolean detach() {
   8.112 -        return true;
   8.113 -    }
   8.114 -
   8.115 -    @Override
   8.116 -    public synchronized void sendCommand(Command command) throws TransportStateException {
   8.117 -        try {
   8.118 -            String message = command.toString();
   8.119 -            byte[] bytes = message.getBytes(StandardCharsets.UTF_8);
   8.120 -            output.writeInt(bytes.length);
   8.121 -            output.write(bytes);
   8.122 -            output.flush();
   8.123 -        } catch (IOException ioex) {
   8.124 -            ioex.printStackTrace();
   8.125 -        }
   8.126 -    }
   8.127 -
   8.128 -    @Override
   8.129 -    public void registerResponseCallback(ResponseCallback callback) {
   8.130 -        this.callback = callback;
   8.131 -    }
   8.132 -
   8.133 -    @Override
   8.134 -    public String getConnectionName() {
   8.135 -        return "";
   8.136 -    }
   8.137 -
   8.138 -    @Override
   8.139 -    public URL getConnectionURL() {
   8.140 -        return null;
   8.141 -    }
   8.142 -
   8.143 -    @Override
   8.144 -    public String getVersion() {
   8.145 -        return VERSION_1;
   8.146 -    }
   8.147 -    
   8.148 -}
     9.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/TurnInspectOn.java	Sat Jul 05 22:50:03 2014 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,92 +0,0 @@
     9.4 -/*
     9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 - *
     9.7 - * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
     9.8 - *
     9.9 - * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
    9.10 - * Other names may be trademarks of their respective owners.
    9.11 - *
    9.12 - * The contents of this file are subject to the terms of either the GNU
    9.13 - * General Public License Version 2 only ("GPL") or the Common
    9.14 - * Development and Distribution License("CDDL") (collectively, the
    9.15 - * "License"). You may not use this file except in compliance with the
    9.16 - * License. You can obtain a copy of the License at
    9.17 - * http://www.netbeans.org/cddl-gplv2.html
    9.18 - * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    9.19 - * specific language governing permissions and limitations under the
    9.20 - * License.  When distributing the software, include this License Header
    9.21 - * Notice in each file and include the License file at
    9.22 - * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
    9.23 - * particular file as subject to the "Classpath" exception as provided
    9.24 - * by Oracle in the GPL Version 2 section of the License file that
    9.25 - * accompanied this code. If applicable, add the following below the
    9.26 - * License Header, with the fields enclosed by brackets [] replaced by
    9.27 - * your own identifying information:
    9.28 - * "Portions Copyrighted [year] [name of copyright owner]"
    9.29 - *
    9.30 - * If you wish your version of this file to be governed by only the CDDL
    9.31 - * or only the GPL Version 2, indicate your decision by adding
    9.32 - * "[Contributor] elects to include this software in this distribution
    9.33 - * under the [CDDL or GPL Version 2] license." If you do not indicate a
    9.34 - * single choice of license, a recipient has the option to distribute
    9.35 - * your version of this file under either the CDDL, the GPL Version 2 or
    9.36 - * to extend the choice of license to its licensees as provided above.
    9.37 - * However, if you add GPL Version 2 code and therefore, elected the GPL
    9.38 - * Version 2 license, then the option applies only if the new code is
    9.39 - * made subject to such option by the copyright holder.
    9.40 - *
    9.41 - * Contributor(s):
    9.42 - *
    9.43 - * Portions Copyrighted 2013 Sun Microsystems, Inc.
    9.44 - */
    9.45 -package org.netbeans.modules.ko4j.debugging;
    9.46 -
    9.47 -import java.lang.reflect.Method;
    9.48 -import java.util.Set;
    9.49 -import java.util.logging.Level;
    9.50 -import java.util.logging.Logger;
    9.51 -import org.netbeans.modules.maven.api.execute.ExecutionContext;
    9.52 -import org.netbeans.modules.maven.api.execute.LateBoundPrerequisitesChecker;
    9.53 -import org.netbeans.modules.maven.api.execute.RunConfig;
    9.54 -import org.netbeans.spi.project.ProjectServiceProvider;
    9.55 -
    9.56 -/**
    9.57 - * 
    9.58 - * @author Jan Stola
    9.59 - */
    9.60 -@ProjectServiceProvider(
    9.61 -    projectType = "org-netbeans-modules-maven",
    9.62 -    service = LateBoundPrerequisitesChecker.class
    9.63 -)
    9.64 -public final class TurnInspectOn implements LateBoundPrerequisitesChecker {
    9.65 -    private static final Logger LOG = Logger.getLogger(TurnInspectOn.class.getName());
    9.66 -    
    9.67 -    @Override
    9.68 -    public boolean checkRunConfig(RunConfig config, ExecutionContext con) {
    9.69 -        if (
    9.70 -            ("debug".equals(config.getActionName()) || "run".equals(config.getActionName()))
    9.71 -            && isBootFXOn(config)
    9.72 -        ) {
    9.73 -            int port = Server.getInstance().acceptClient();
    9.74 -            config.setProperty("netbeans.inspect.port", "" + port);
    9.75 -        }
    9.76 -        Object o = config.getActionName();
    9.77 -        return true;
    9.78 -    }
    9.79 -
    9.80 -    private static boolean isBootFXOn(RunConfig config) {
    9.81 -        try {
    9.82 -            Method mpMethod = config.getClass().getMethod("getMavenProject");
    9.83 -            Object mp = mpMethod.invoke(config);
    9.84 -            Method artiMethod = mp.getClass().getMethod("getArtifacts");
    9.85 -            Set<?> s = (Set<?>)artiMethod.invoke(mp);
    9.86 -            final String text = s.toString();
    9.87 -            return text.contains("org.apidesign.html:boot-fx:") ||
    9.88 -                text.contains("org.netbeans.html:net.java.html.boot.fx:") ||
    9.89 -                text.contains("org.apidesign.bck2brwsr:bck2brwsr-maven-plugin");
    9.90 -        } catch (Exception ex) {
    9.91 -            LOG.log(Level.SEVERE, "Problems obtaining list of artifacts", ex);
    9.92 -        }
    9.93 -        return false;
    9.94 -    }
    9.95 -}