1.1 --- a/dew4nb/manifest.mf Wed Apr 02 17:29:29 2014 +0200
1.2 +++ b/dew4nb/manifest.mf Fri Apr 04 11:32:07 2014 +0200
1.3 @@ -1,6 +1,6 @@
1.4 Manifest-Version: 1.0
1.5 OpenIDE-Module: org.netbeans.modules.dew4nb
1.6 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/dew4nb/Bundle.properties
1.7 -OpenIDE-Module-Specification-Version: 1.0
1.8 +OpenIDE-Module-Specification-Version: 1.1
1.9 OpenIDE-Module-Package-Dependencies: com.sun.jdi[VirtualMachineManager]
1.10
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/LineBreakpointProvider.java Fri Apr 04 11:32:07 2014 +0200
2.3 @@ -0,0 +1,62 @@
2.4 +/*
2.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2.6 + *
2.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
2.8 + *
2.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
2.10 + * Other names may be trademarks of their respective owners.
2.11 + *
2.12 + * The contents of this file are subject to the terms of either the GNU
2.13 + * General Public License Version 2 only ("GPL") or the Common
2.14 + * Development and Distribution License("CDDL") (collectively, the
2.15 + * "License"). You may not use this file except in compliance with the
2.16 + * License. You can obtain a copy of the License at
2.17 + * http://www.netbeans.org/cddl-gplv2.html
2.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
2.19 + * specific language governing permissions and limitations under the
2.20 + * License. When distributing the software, include this License Header
2.21 + * Notice in each file and include the License file at
2.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
2.23 + * particular file as subject to the "Classpath" exception as provided
2.24 + * by Oracle in the GPL Version 2 section of the License file that
2.25 + * accompanied this code. If applicable, add the following below the
2.26 + * License Header, with the fields enclosed by brackets [] replaced by
2.27 + * your own identifying information:
2.28 + * "Portions Copyrighted [year] [name of copyright owner]"
2.29 + *
2.30 + * If you wish your version of this file to be governed by only the CDDL
2.31 + * or only the GPL Version 2, indicate your decision by adding
2.32 + * "[Contributor] elects to include this software in this distribution
2.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
2.34 + * single choice of license, a recipient has the option to distribute
2.35 + * your version of this file under either the CDDL, the GPL Version 2 or
2.36 + * to extend the choice of license to its licensees as provided above.
2.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
2.38 + * Version 2 license, then the option applies only if the new code is
2.39 + * made subject to such option by the copyright holder.
2.40 + *
2.41 + * Contributor(s):
2.42 + *
2.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
2.44 + */
2.45 +
2.46 +package org.netbeans.modules.dew4nb.services.debugger;
2.47 +
2.48 +import org.netbeans.api.debugger.Breakpoint;
2.49 +import org.openide.filesystems.FileObject;
2.50 +
2.51 +/**
2.52 + *
2.53 + * @author Jaroslav Tulach <jtulach@netbeans.org>
2.54 + */
2.55 +public interface LineBreakpointProvider {
2.56 + /** Create a breakpoint if you know how.
2.57 + *
2.58 + * @param fo file to create breakpoint in
2.59 + * @param line the line number in the file
2.60 + * @return a breakpoint representing the location or <code>null</code>
2.61 + * @throws Exception exception that will be logged
2.62 + */
2.63 + public Breakpoint createLineBreakpoint(FileObject fo, int line)
2.64 + throws Exception;
2.65 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/LineBreakpointProviderJS.java Fri Apr 04 11:32:07 2014 +0200
3.3 @@ -0,0 +1,71 @@
3.4 +/*
3.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3.6 + *
3.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
3.8 + *
3.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
3.10 + * Other names may be trademarks of their respective owners.
3.11 + *
3.12 + * The contents of this file are subject to the terms of either the GNU
3.13 + * General Public License Version 2 only ("GPL") or the Common
3.14 + * Development and Distribution License("CDDL") (collectively, the
3.15 + * "License"). You may not use this file except in compliance with the
3.16 + * License. You can obtain a copy of the License at
3.17 + * http://www.netbeans.org/cddl-gplv2.html
3.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
3.19 + * specific language governing permissions and limitations under the
3.20 + * License. When distributing the software, include this License Header
3.21 + * Notice in each file and include the License file at
3.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
3.23 + * particular file as subject to the "Classpath" exception as provided
3.24 + * by Oracle in the GPL Version 2 section of the License file that
3.25 + * accompanied this code. If applicable, add the following below the
3.26 + * License Header, with the fields enclosed by brackets [] replaced by
3.27 + * your own identifying information:
3.28 + * "Portions Copyrighted [year] [name of copyright owner]"
3.29 + *
3.30 + * If you wish your version of this file to be governed by only the CDDL
3.31 + * or only the GPL Version 2, indicate your decision by adding
3.32 + * "[Contributor] elects to include this software in this distribution
3.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
3.34 + * single choice of license, a recipient has the option to distribute
3.35 + * your version of this file under either the CDDL, the GPL Version 2 or
3.36 + * to extend the choice of license to its licensees as provided above.
3.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
3.38 + * Version 2 license, then the option applies only if the new code is
3.39 + * made subject to such option by the copyright holder.
3.40 + *
3.41 + * Contributor(s):
3.42 + *
3.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
3.44 + */
3.45 +
3.46 +package org.netbeans.modules.dew4nb.services.debugger;
3.47 +
3.48 +import java.net.URL;
3.49 +import java.util.logging.Level;
3.50 +import org.netbeans.api.debugger.Breakpoint;
3.51 +import org.openide.filesystems.FileObject;
3.52 +import org.openide.text.Line;
3.53 +import org.openide.util.Lookup;
3.54 +import org.openide.util.lookup.ServiceProvider;
3.55 +
3.56 +/** This calls should be moved into a module that has dependency on avatar_js.project
3.57 + * one.
3.58 + *
3.59 + * @author Jaroslav Tulach <jtulach@netbeans.org>
3.60 + */
3.61 +@ServiceProvider(service = LineBreakpointProvider.class)
3.62 +public final class LineBreakpointProviderJS implements LineBreakpointProvider {
3.63 + @Override
3.64 + public Breakpoint createLineBreakpoint(FileObject file, int line) throws Exception {
3.65 + if (file.hasExt("js")) {
3.66 + ClassLoader l = Lookup.getDefault().lookup(ClassLoader.class);
3.67 + Class<?> fl = Class.forName("org.netbeans.modules.javascript2.debug.breakpoints.FutureLine", true, l);
3.68 + Line ln = (Line) fl.getConstructor(URL.class, int.class).newInstance(file.toURL(), line);
3.69 + Class<?> jslb = Class.forName("org.netbeans.modules.javascript2.debug.breakpoints.JSLineBreakpoint", true, l);
3.70 + return (Breakpoint) jslb.getConstructor(Line.class).newInstance(ln);
3.71 + }
3.72 + return null;
3.73 + }
3.74 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/LineBreakpointProviderJava.java Fri Apr 04 11:32:07 2014 +0200
4.3 @@ -0,0 +1,63 @@
4.4 +/*
4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4.6 + *
4.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
4.8 + *
4.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
4.10 + * Other names may be trademarks of their respective owners.
4.11 + *
4.12 + * The contents of this file are subject to the terms of either the GNU
4.13 + * General Public License Version 2 only ("GPL") or the Common
4.14 + * Development and Distribution License("CDDL") (collectively, the
4.15 + * "License"). You may not use this file except in compliance with the
4.16 + * License. You can obtain a copy of the License at
4.17 + * http://www.netbeans.org/cddl-gplv2.html
4.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
4.19 + * specific language governing permissions and limitations under the
4.20 + * License. When distributing the software, include this License Header
4.21 + * Notice in each file and include the License file at
4.22 + * nbbuild/licenses/CDDL-GPL-2-CP. Oracle designates this
4.23 + * particular file as subject to the "Classpath" exception as provided
4.24 + * by Oracle in the GPL Version 2 section of the License file that
4.25 + * accompanied this code. If applicable, add the following below the
4.26 + * License Header, with the fields enclosed by brackets [] replaced by
4.27 + * your own identifying information:
4.28 + * "Portions Copyrighted [year] [name of copyright owner]"
4.29 + *
4.30 + * If you wish your version of this file to be governed by only the CDDL
4.31 + * or only the GPL Version 2, indicate your decision by adding
4.32 + * "[Contributor] elects to include this software in this distribution
4.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
4.34 + * single choice of license, a recipient has the option to distribute
4.35 + * your version of this file under either the CDDL, the GPL Version 2 or
4.36 + * to extend the choice of license to its licensees as provided above.
4.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
4.38 + * Version 2 license, then the option applies only if the new code is
4.39 + * made subject to such option by the copyright holder.
4.40 + *
4.41 + * Contributor(s):
4.42 + *
4.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
4.44 + */
4.45 +
4.46 +package org.netbeans.modules.dew4nb.services.debugger;
4.47 +
4.48 +import org.netbeans.api.debugger.Breakpoint;
4.49 +import org.netbeans.api.debugger.jpda.LineBreakpoint;
4.50 +import org.openide.filesystems.FileObject;
4.51 +import org.openide.util.lookup.ServiceProvider;
4.52 +
4.53 +/**
4.54 + *
4.55 + * @author Jaroslav Tulach <jtulach@netbeans.org>
4.56 + */
4.57 +@ServiceProvider(service = LineBreakpointProvider.class)
4.58 +public class LineBreakpointProviderJava implements LineBreakpointProvider {
4.59 + @Override
4.60 + public Breakpoint createLineBreakpoint(FileObject fo, int line) throws Exception {
4.61 + if (fo.hasExt("java")) {
4.62 + return LineBreakpoint.create(fo.toURL().toExternalForm(), line);
4.63 + }
4.64 + return null;
4.65 + }
4.66 +}
5.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/SetBreakpointsHandler.java Wed Apr 02 17:29:29 2014 +0200
5.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/SetBreakpointsHandler.java Fri Apr 04 11:32:07 2014 +0200
5.3 @@ -105,11 +105,11 @@
5.4 if (file != null) {
5.5 final String linesStr = line.substring(separator+1);
5.6 for (String lineStr : linesStr.split(":")) { //NOI18N
5.7 + final int lineNo = Integer.parseInt(lineStr);
5.8 try {
5.9 - final int lineNo = Integer.parseInt(lineStr);
5.10 - final LineBreakpoint lb = LineBreakpoint.create(file.toURL().toExternalForm(), lineNo);
5.11 - dbm.addBreakpoint(lb);
5.12 - } catch (NumberFormatException nfe) {
5.13 + Breakpoint b = createLineBreakpoint(file, lineNo);
5.14 + dbm.addBreakpoint(b);
5.15 + } catch (Exception nfe) {
5.16 LOG.log(
5.17 Level.WARNING,
5.18 "Ignoring breakpoint(s) with wrong line number: {0}", //NOI18N
5.19 @@ -134,4 +134,19 @@
5.20 return status;
5.21 }
5.22
5.23 + private static Breakpoint createLineBreakpoint(final FileObject file, final int lineNo)
5.24 + throws Exception {
5.25 + for (LineBreakpointProvider p : Lookup.getDefault().lookupAll(LineBreakpointProvider.class)) {
5.26 + try {
5.27 + Breakpoint b = p.createLineBreakpoint(file, lineNo);
5.28 + if (b != null) {
5.29 + return b;
5.30 + }
5.31 + } catch (Exception ex) {
5.32 + LOG.log(Level.WARNING, "Can't set JavaScript breakpoint ", ex);
5.33 + }
5.34 + }
5.35 + throw new Exception("Cannot find breakpoint for " + file + " and " + lineNo);
5.36 + }
5.37 +
5.38 }