Inspection mode is enabled on Run and Debug if boot-fx module is in the list of dependencies. Adding forgotten licenses.
1.1 --- a/ko4j.debugging/nbproject/project.xml Wed Aug 14 16:00:07 2013 +0200
1.2 +++ b/ko4j.debugging/nbproject/project.xml Wed Aug 14 18:17:54 2013 +0200
1.3 @@ -15,6 +15,15 @@
1.4 </run-dependency>
1.5 </dependency>
1.6 <dependency>
1.7 + <code-name-base>org.netbeans.modules.maven</code-name-base>
1.8 + <build-prerequisite/>
1.9 + <compile-dependency/>
1.10 + <run-dependency>
1.11 + <release-version>2</release-version>
1.12 + <specification-version>2.86</specification-version>
1.13 + </run-dependency>
1.14 + </dependency>
1.15 + <dependency>
1.16 <code-name-base>org.netbeans.modules.projectapi</code-name-base>
1.17 <build-prerequisite/>
1.18 <compile-dependency/>
1.19 @@ -24,6 +33,14 @@
1.20 </run-dependency>
1.21 </dependency>
1.22 <dependency>
1.23 + <code-name-base>org.netbeans.modules.web.browser.api</code-name-base>
1.24 + <build-prerequisite/>
1.25 + <compile-dependency/>
1.26 + <run-dependency>
1.27 + <specification-version>1.30</specification-version>
1.28 + </run-dependency>
1.29 + </dependency>
1.30 + <dependency>
1.31 <code-name-base>org.netbeans.modules.web.webkit.debugging</code-name-base>
1.32 <build-prerequisite/>
1.33 <compile-dependency/>
1.34 @@ -55,14 +72,6 @@
1.35 <specification-version>8.22</specification-version>
1.36 </run-dependency>
1.37 </dependency>
1.38 - <dependency>
1.39 - <code-name-base>org.netbeans.modules.web.browser.api</code-name-base>
1.40 - <build-prerequisite/>
1.41 - <compile-dependency/>
1.42 - <run-dependency>
1.43 - <specification-version>1.30</specification-version>
1.44 - </run-dependency>
1.45 - </dependency>
1.46 </module-dependencies>
1.47 <public-packages/>
1.48 </data>
2.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Bundle.properties Wed Aug 14 16:00:07 2013 +0200
2.2 +++ b/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Bundle.properties Wed Aug 14 18:17:54 2013 +0200
2.3 @@ -1,1 +1,1 @@
2.4 -OpenIDE-Module-Name=KO4J Inspection
2.5 +OpenIDE-Module-Name=KO for Java Inspection
3.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/InspectAction.java Wed Aug 14 16:00:07 2013 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,72 +0,0 @@
3.4 -/*
3.5 - * To change this license header, choose License Headers in Project Properties.
3.6 - * To change this template file, choose Tools | Templates
3.7 - * and open the template in the editor.
3.8 - */
3.9 -package org.netbeans.modules.ko4j.debugging;
3.10 -
3.11 -import java.awt.event.ActionEvent;
3.12 -import javax.swing.AbstractAction;
3.13 -import javax.swing.Action;
3.14 -import org.netbeans.api.project.Project;
3.15 -import org.netbeans.spi.project.ActionProvider;
3.16 -import org.openide.awt.ActionID;
3.17 -import org.openide.awt.ActionReference;
3.18 -import org.openide.awt.ActionRegistration;
3.19 -import org.openide.util.ContextAwareAction;
3.20 -import org.openide.util.Lookup;
3.21 -import org.openide.util.NbBundle;
3.22 -
3.23 -/**
3.24 - *
3.25 - * @author Jan Stola
3.26 - */
3.27 -@ActionID(category="Project", id="org.netbeans.modules.ko4j.debugging.InspectAction") // NOI18N
3.28 -@ActionRegistration(displayName="#ACT_Inspect", lazy=false) // NOI18N
3.29 -@ActionReference(path="Projects/org-netbeans-modules-maven/Actions", position=987) // NOI18N
3.30 -@NbBundle.Messages("ACT_Inspect=Inspect") // NOI18N
3.31 -public class InspectAction extends AbstractAction implements ContextAwareAction {
3.32 - private static final String INSPECT_ACTION = "inspect"; // NOI18N
3.33 - private Lookup context;
3.34 -
3.35 - public InspectAction() {
3.36 - putValue(NAME, Bundle.ACT_Inspect());
3.37 - }
3.38 -
3.39 - private InspectAction(Lookup context) {
3.40 - this();
3.41 - this.context = context;
3.42 - }
3.43 -
3.44 - @Override
3.45 - public boolean isEnabled() {
3.46 - boolean enable = false;
3.47 - if (context != null) {
3.48 - Project project = context.lookup(Project.class);
3.49 - ActionProvider provider = project.getLookup().lookup(ActionProvider.class);
3.50 - if (provider != null) {
3.51 - enable = provider.isActionEnabled(INSPECT_ACTION, context);
3.52 - }
3.53 - }
3.54 - return enable;
3.55 - }
3.56 -
3.57 -
3.58 - @Override
3.59 - public void actionPerformed(ActionEvent e) {
3.60 - Project project = context.lookup(Project.class);
3.61 - ActionProvider provider = project.getLookup().lookup(ActionProvider.class);
3.62 - if (provider != null
3.63 -// && Arrays.asList(provider.getSupportedActions()).contains(INSPECT_ACTION)
3.64 - && provider.isActionEnabled(INSPECT_ACTION, context)) {
3.65 - Server.getInstance().acceptClient();
3.66 - provider.invokeAction(INSPECT_ACTION, context);
3.67 - }
3.68 - }
3.69 -
3.70 - @Override
3.71 - public Action createContextAwareInstance(Lookup actionContext) {
3.72 - return new InspectAction(actionContext);
3.73 - }
3.74 -
3.75 -}
4.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/MessageDispatcherImpl.java Wed Aug 14 16:00:07 2013 +0200
4.2 +++ b/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/MessageDispatcherImpl.java Wed Aug 14 18:17:54 2013 +0200
4.3 @@ -1,7 +1,43 @@
4.4 /*
4.5 - * To change this license header, choose License Headers in Project Properties.
4.6 - * To change this template file, choose Tools | Templates
4.7 - * and open the template in the editor.
4.8 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.9 + *
4.10 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
4.11 + *
4.12 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
4.13 + * Other names may be trademarks of their respective owners.
4.14 + *
4.15 + * The contents of this file are subject to the terms of either the GNU
4.16 + * General Public License Version 2 only ("GPL") or the Common
4.17 + * Development and Distribution License("CDDL") (collectively, the
4.18 + * "License"). You may not use this file except in compliance with the
4.19 + * License. You can obtain a copy of the License at
4.20 + * http://www.netbeans.org/cddl-gplv2.html
4.21 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.22 + * specific language governing permissions and limitations under the
4.23 + * License. When distributing the software, include this License Header
4.24 + * Notice in each file and include the License file at
4.25 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
4.26 + * particular file as subject to the "Classpath" exception as provided
4.27 + * by Oracle in the GPL Version 2 section of the License file that
4.28 + * accompanied this code. If applicable, add the following below the
4.29 + * License Header, with the fields enclosed by brackets [] replaced by
4.30 + * your own identifying information:
4.31 + * "Portions Copyrighted [year] [name of copyright owner]"
4.32 + *
4.33 + * If you wish your version of this file to be governed by only the CDDL
4.34 + * or only the GPL Version 2, indicate your decision by adding
4.35 + * "[Contributor] elects to include this software in this distribution
4.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.37 + * single choice of license, a recipient has the option to distribute
4.38 + * your version of this file under either the CDDL, the GPL Version 2 or
4.39 + * to extend the choice of license to its licensees as provided above.
4.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
4.41 + * Version 2 license, then the option applies only if the new code is
4.42 + * made subject to such option by the copyright holder.
4.43 + *
4.44 + * Contributor(s):
4.45 + *
4.46 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
4.47 */
4.48 package org.netbeans.modules.ko4j.debugging;
4.49
5.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Server.java Wed Aug 14 16:00:07 2013 +0200
5.2 +++ b/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Server.java Wed Aug 14 18:17:54 2013 +0200
5.3 @@ -1,3 +1,44 @@
5.4 +/*
5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5.6 + *
5.7 + * Copyright 2013 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 2013 Sun Microsystems, Inc.
5.44 + */
5.45 package org.netbeans.modules.ko4j.debugging;
5.46
5.47 import java.io.IOException;
5.48 @@ -14,16 +55,15 @@
5.49 *
5.50 * @author Jan Stola
5.51 */
5.52 -public class Server {
5.53 +final class Server {
5.54 private static final Server INSTANCE = new Server();
5.55 - private boolean started = false;
5.56 private ServerSocket socket;
5.57
5.58 public static Server getInstance() {
5.59 return INSTANCE;
5.60 }
5.61 -
5.62 - public void acceptClient() {
5.63 +
5.64 + public int acceptClient() {
5.65 ensureStarted();
5.66 Thread t = new Thread(new Runnable() {
5.67 @Override
5.68 @@ -41,15 +81,16 @@
5.69 }
5.70 });
5.71 t.start();
5.72 + return socket.getLocalPort();
5.73 }
5.74
5.75 private synchronized void ensureStarted() {
5.76 - if (started) {
5.77 + if (socket != null) {
5.78 return;
5.79 }
5.80 try {
5.81 - socket = new ServerSocket(9876);
5.82 - started = true;
5.83 + socket = new ServerSocket();
5.84 + socket.bind(null);
5.85 } catch (IOException ioex) {
5.86 Exceptions.printStackTrace(ioex);
5.87 }
6.1 --- a/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Transport.java Wed Aug 14 16:00:07 2013 +0200
6.2 +++ b/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/Transport.java Wed Aug 14 18:17:54 2013 +0200
6.3 @@ -1,7 +1,43 @@
6.4 /*
6.5 - * To change this license header, choose License Headers in Project Properties.
6.6 - * To change this template file, choose Tools | Templates
6.7 - * and open the template in the editor.
6.8 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
6.9 + *
6.10 + * Copyright 2013 Oracle and/or its affiliates. All rights reserved.
6.11 + *
6.12 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6.13 + * Other names may be trademarks of their respective owners.
6.14 + *
6.15 + * The contents of this file are subject to the terms of either the GNU
6.16 + * General Public License Version 2 only ("GPL") or the Common
6.17 + * Development and Distribution License("CDDL") (collectively, the
6.18 + * "License"). You may not use this file except in compliance with the
6.19 + * License. You can obtain a copy of the License at
6.20 + * http://www.netbeans.org/cddl-gplv2.html
6.21 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
6.22 + * specific language governing permissions and limitations under the
6.23 + * License. When distributing the software, include this License Header
6.24 + * Notice in each file and include the License file at
6.25 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
6.26 + * particular file as subject to the "Classpath" exception as provided
6.27 + * by Oracle in the GPL Version 2 section of the License file that
6.28 + * accompanied this code. If applicable, add the following below the
6.29 + * License Header, with the fields enclosed by brackets [] replaced by
6.30 + * your own identifying information:
6.31 + * "Portions Copyrighted [year] [name of copyright owner]"
6.32 + *
6.33 + * If you wish your version of this file to be governed by only the CDDL
6.34 + * or only the GPL Version 2, indicate your decision by adding
6.35 + * "[Contributor] elects to include this software in this distribution
6.36 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
6.37 + * single choice of license, a recipient has the option to distribute
6.38 + * your version of this file under either the CDDL, the GPL Version 2 or
6.39 + * to extend the choice of license to its licensees as provided above.
6.40 + * However, if you add GPL Version 2 code and therefore, elected the GPL
6.41 + * Version 2 license, then the option applies only if the new code is
6.42 + * made subject to such option by the copyright holder.
6.43 + *
6.44 + * Contributor(s):
6.45 + *
6.46 + * Portions Copyrighted 2013 Sun Microsystems, Inc.
6.47 */
6.48 package org.netbeans.modules.ko4j.debugging;
6.49
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
7.2 +++ b/ko4j.debugging/src/org/netbeans/modules/ko4j/debugging/TurnInspectOn.java Wed Aug 14 18:17:54 2013 +0200
7.3 @@ -0,0 +1,89 @@
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.lang.reflect.Method;
7.48 +import java.util.Set;
7.49 +import java.util.logging.Level;
7.50 +import java.util.logging.Logger;
7.51 +import org.netbeans.modules.maven.api.execute.ExecutionContext;
7.52 +import org.netbeans.modules.maven.api.execute.LateBoundPrerequisitesChecker;
7.53 +import org.netbeans.modules.maven.api.execute.RunConfig;
7.54 +import org.netbeans.spi.project.ProjectServiceProvider;
7.55 +
7.56 +/**
7.57 + *
7.58 + * @author Jan Stola
7.59 + */
7.60 +@ProjectServiceProvider(
7.61 + projectType = "org-netbeans-modules-maven",
7.62 + service = LateBoundPrerequisitesChecker.class
7.63 +)
7.64 +public final class TurnInspectOn implements LateBoundPrerequisitesChecker {
7.65 + private static final Logger LOG = Logger.getLogger(TurnInspectOn.class.getName());
7.66 +
7.67 + @Override
7.68 + public boolean checkRunConfig(RunConfig config, ExecutionContext con) {
7.69 + if (
7.70 + ("debug".equals(config.getActionName()) || "run".equals(config.getActionName()))
7.71 + && isBootFXOn(config)
7.72 + ) {
7.73 + int port = Server.getInstance().acceptClient();
7.74 + config.setProperty("netbeans.inspect.port", "" + port);
7.75 + }
7.76 + Object o = config.getActionName();
7.77 + return true;
7.78 + }
7.79 +
7.80 + private static boolean isBootFXOn(RunConfig config) {
7.81 + try {
7.82 + Method mpMethod = config.getClass().getMethod("getMavenProject");
7.83 + Object mp = mpMethod.invoke(config);
7.84 + Method artiMethod = mp.getClass().getMethod("getArtifacts");
7.85 + Set s = (Set)artiMethod.invoke(mp);
7.86 + return s.toString().contains("org.apidesign.html:boot-fx:");
7.87 + } catch (Exception ex) {
7.88 + LOG.log(Level.SEVERE, "Problems obtaining list of artifacts", ex);
7.89 + }
7.90 + return false;
7.91 + }
7.92 +}