Terminating debugger.
1.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugMessageType.java Fri Jan 31 17:17:15 2014 +0100
1.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugMessageType.java Mon Feb 03 18:56:24 2014 +0100
1.3 @@ -48,6 +48,7 @@
1.4 */
1.5 public enum DebugMessageType {
1.6 attach,
1.7 + detach,
1.8 breakpoints,
1.9 cont,
1.10 stepOver,
2.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugerModels.java Fri Jan 31 17:17:15 2014 +0100
2.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugerModels.java Mon Feb 03 18:56:24 2014 +0100
2.3 @@ -113,6 +113,14 @@
2.4 static final class SuspendResultModel {
2.5 }
2.6
2.7 + @Model(className = "DetachedResult", properties = {
2.8 + @Property(name = "status", type = Status.class),
2.9 + @Property(name = "type", type = DebugMessageType.class),
2.10 + @Property(name = "id", type = int.class),
2.11 + })
2.12 + static final class DetachedResultModel {
2.13 + }
2.14 +
2.15
2.16 @Model(className = "Context", properties = {
2.17 @Property(name="user", type=String.class),
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DetachHandler.java Mon Feb 03 18:56:24 2014 +0100
3.3 @@ -0,0 +1,84 @@
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 org.netbeans.api.annotations.common.NonNull;
3.49 +import org.netbeans.api.debugger.Session;
3.50 +import org.netbeans.modules.dew4nb.endpoint.AsyncRequestHandler;
3.51 +import org.netbeans.modules.dew4nb.endpoint.EndPoint;
3.52 +import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
3.53 +import org.netbeans.modules.dew4nb.endpoint.Status;
3.54 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
3.55 +import org.openide.util.Parameters;
3.56 +import org.openide.util.lookup.ServiceProvider;
3.57 +
3.58 +/**
3.59 + *
3.60 + * @author Tomas Zezula
3.61 + */
3.62 +@ServiceProvider(service = RequestHandler.class)
3.63 +public class DetachHandler extends AsyncRequestHandler<DebugAction, DebugMessageType> {
3.64 +
3.65 + public DetachHandler() {
3.66 + super(DebugerModels.END_POINT, DebugMessageType.detach, DebugAction.class);
3.67 + }
3.68 +
3.69 + @Override
3.70 + protected Status handle(@NonNull final DebugAction request, @NonNull final EndPoint.Env env) {
3.71 + Parameters.notNull("request", request); //NOI18N
3.72 + Parameters.notNull("env", env); //NOI18N
3.73 + final int sessionId = request.getSession();
3.74 + final WorkspaceResolver.Context ctx = ActiveSessions.getInstance().getContext(sessionId);
3.75 + Status result = Status.not_found;
3.76 + if (ctx != null) {
3.77 + final Session session = ActiveSessions.getInstance().getDebugSession(sessionId);
3.78 + if (session == null) {
3.79 + throw new IllegalStateException("No debugger session"); //NOI18N
3.80 + }
3.81 + session.kill();
3.82 + result = Status.accepted;
3.83 + }
3.84 + return result;
3.85 + }
3.86 +
3.87 +}