Project channel.
authorTomas Zezula <tzezula@netbeans.org>
Tue, 28 Jan 2014 21:59:12 +0100
changeset 18123d383d631bbd4
parent 18122 696613694f2b
child 18124 03e0b3965817
Project channel.
dew4nb/nbproject/project.xml
dew4nb/src/org/netbeans/modules/dew4nb/SourceProvider.java
dew4nb/src/org/netbeans/modules/dew4nb/api/Server.java
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ActiveSessions.java
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AttachHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ContinueHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugerModels.java
dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/SetBreakpointsHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/AutocompleteHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/ErrorHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacMessageType.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacModels.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/TypeHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/ActiveSessions.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/AttachHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/ContinueHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/DebugerModels.java
dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/SetBreakpointsHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/GetFileContentHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/IORedirectProvider.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/InvokeProjectActionHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/IsProjectActionEnabledHandler.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectEndPoint.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectMessageType.java
dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectModels.java
     1.1 --- a/dew4nb/nbproject/project.xml	Tue Jan 28 13:57:53 2014 +0100
     1.2 +++ b/dew4nb/nbproject/project.xml	Tue Jan 28 21:59:12 2014 +0100
     1.3 @@ -55,7 +55,7 @@
     1.4                      <compile-dependency/>
     1.5                      <run-dependency>
     1.6                          <release-version>2</release-version>
     1.7 -                        <specification-version>1.63</specification-version>
     1.8 +                        <implementation-version/>
     1.9                      </run-dependency>
    1.10                  </dependency>
    1.11                  <dependency>
     2.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/SourceProvider.java	Tue Jan 28 13:57:53 2014 +0100
     2.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/SourceProvider.java	Tue Jan 28 21:59:12 2014 +0100
     2.3 @@ -59,7 +59,6 @@
     2.4  import org.netbeans.api.annotations.common.CheckForNull;
     2.5  import org.netbeans.api.annotations.common.NonNull;
     2.6  import org.netbeans.api.annotations.common.NullAllowed;
     2.7 -import org.netbeans.modules.dew4nb.services.javac.Context;
     2.8  import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
     2.9  import org.netbeans.modules.parsing.api.Source;
    2.10  import org.openide.cookies.EditorCookie;
    2.11 @@ -106,7 +105,7 @@
    2.12  
    2.13      @CheckForNull
    2.14      public Source getSource(
    2.15 -            @NullAllowed Context ctx,
    2.16 +            @NullAllowed WorkspaceResolver.Context ctx,
    2.17              @NullAllowed String content) {
    2.18          FileObject file = null;
    2.19          if (ctx != null) {
    2.20 @@ -114,10 +113,7 @@
    2.21              if (resolver == null) {
    2.22                  LOG.warning("No WorkspaceResolver in Lookup."); //NOI18N
    2.23              } else {
    2.24 -                file = resolver.resolveFile(new WorkspaceResolver.Context(
    2.25 -                    ctx.getUser(),
    2.26 -                    ctx.getWorkspace(),
    2.27 -                    ctx.getPath()));                
    2.28 +                file = resolver.resolveFile(ctx);
    2.29              }
    2.30          }
    2.31          boolean tmpFile = false;
     3.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/api/Server.java	Tue Jan 28 13:57:53 2014 +0100
     3.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/api/Server.java	Tue Jan 28 21:59:12 2014 +0100
     3.3 @@ -73,7 +73,9 @@
     3.4   */
     3.5  public final class Server {
     3.6  
     3.7 -    private final static Charset UTF8 = Charset.forName("UTF-8");  //NOI18N
     3.8 +    private static final Charset UTF8 = Charset.forName("UTF-8");  //NOI18N
     3.9 +    private static final int MAX_CHANNEL_LEN = 256;
    3.10 +    private static final char CHANNEL_SEPARATOR = '|';  //NOI18N
    3.11      private final HttpServer http;
    3.12  
    3.13      private Server(
    3.14 @@ -182,15 +184,26 @@
    3.15  
    3.16          @Override
    3.17          public void onMessage(WebSocket socket, String text) {
    3.18 -            final EndPoint ep = registry.getEndPoint("javac");
    3.19 +            int index = -1;
    3.20 +            for (int i = 0; i < MAX_CHANNEL_LEN; i++) {
    3.21 +                if (text.charAt(i) == CHANNEL_SEPARATOR) {
    3.22 +                    index = i;
    3.23 +                    break;
    3.24 +                }
    3.25 +            }
    3.26              Status status = Status.not_found;
    3.27              Exception ex = null;
    3.28 -            if (ep != null) {
    3.29 -                try {
    3.30 -                    status = ep.handle(socket, text);
    3.31 -                } catch (Exception e) {
    3.32 -                    status = Status.runtime_error;
    3.33 -                    ex = e;
    3.34 +            if (index > 0) {
    3.35 +                final String channel = text.substring(0, index);
    3.36 +                final String message = text.substring(index+1);
    3.37 +                final EndPoint ep = registry.getEndPoint(channel);
    3.38 +                if (ep != null) {
    3.39 +                    try {
    3.40 +                        status = ep.handle(socket, message);
    3.41 +                    } catch (Exception e) {
    3.42 +                        status = Status.runtime_error;
    3.43 +                        ex = e;
    3.44 +                    }
    3.45                  }
    3.46              }
    3.47              if (!status.isSuccess()) {
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ActiveSessions.java	Tue Jan 28 21:59:12 2014 +0100
     4.3 @@ -0,0 +1,133 @@
     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 java.util.concurrent.ConcurrentHashMap;
    4.49 +import java.util.concurrent.ConcurrentMap;
    4.50 +import java.util.concurrent.atomic.AtomicInteger;
    4.51 +import org.netbeans.api.annotations.common.CheckForNull;
    4.52 +import org.netbeans.api.annotations.common.NonNull;
    4.53 +import org.netbeans.api.debugger.DebuggerManager;
    4.54 +import org.netbeans.api.debugger.Session;
    4.55 +import org.netbeans.modules.dew4nb.endpoint.EndPoint;
    4.56 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
    4.57 +import org.openide.util.Parameters;
    4.58 +
    4.59 +/**
    4.60 + *
    4.61 + * @author Tomas Zezula
    4.62 + */
    4.63 +final class ActiveSessions {
    4.64 +
    4.65 +    //@GuardedBy("ActiveSessions.class")
    4.66 +    private static ActiveSessions instance;
    4.67 +
    4.68 +    private final ConcurrentMap<Integer,Data> active;
    4.69 +    private final AtomicInteger sequencer;
    4.70 +
    4.71 +    private ActiveSessions() {
    4.72 +        this.active = new ConcurrentHashMap<>();
    4.73 +        this.sequencer = new AtomicInteger();
    4.74 +    }
    4.75 +
    4.76 +
    4.77 +    int createSession(
    4.78 +            @NonNull final WorkspaceResolver.Context context,
    4.79 +            @NonNull final EndPoint.Env env) {
    4.80 +        Parameters.notNull("context", context); //NOI18N
    4.81 +        Parameters.notNull("env", env); //NOI18N
    4.82 +        final int id = sequencer.incrementAndGet();
    4.83 +        final Session session = DebuggerManager.getDebuggerManager().getCurrentSession();
    4.84 +        if (active.putIfAbsent(id, new Data(context, env, session)) != null) {
    4.85 +            throw new IllegalStateException("Trying to reuse active session");  //NOI18N
    4.86 +        }
    4.87 +        return id;
    4.88 +    }
    4.89 +
    4.90 +    @CheckForNull
    4.91 +    WorkspaceResolver.Context getContext(final int sessionId) {
    4.92 +        final Data data = active.get(sessionId);
    4.93 +        return data == null ? null : data.ctx;
    4.94 +    }
    4.95 +
    4.96 +    @CheckForNull
    4.97 +    EndPoint.Env getEnv(final int sessionId) {
    4.98 +        final Data data = active.get(sessionId);
    4.99 +        return data == null ? null : data.env;
   4.100 +    }
   4.101 +
   4.102 +    @CheckForNull
   4.103 +    Session getDebugSession(final int sessionId) {
   4.104 +        final Data data = active.get(sessionId);
   4.105 +        return data == null ? null : data.session;
   4.106 +    }
   4.107 +
   4.108 +
   4.109 +    @NonNull
   4.110 +    static synchronized ActiveSessions getInstance() {
   4.111 +        if (instance == null) {
   4.112 +            instance = new ActiveSessions();
   4.113 +        }
   4.114 +        return instance;
   4.115 +    }
   4.116 +
   4.117 +    private static final class Data {
   4.118 +        final WorkspaceResolver.Context ctx;
   4.119 +        final EndPoint.Env env;
   4.120 +        final Session session;
   4.121 +
   4.122 +
   4.123 +        private Data(
   4.124 +            @NonNull final WorkspaceResolver.Context ctx,
   4.125 +            @NonNull final EndPoint.Env env,
   4.126 +            @NonNull final Session session) {
   4.127 +            Parameters.notNull("ctx", ctx); //NOI18N
   4.128 +            Parameters.notNull("env", env); //NOI18N
   4.129 +            Parameters.notNull("session", session); //NOI18N
   4.130 +            this.ctx = ctx;
   4.131 +            this.env = env;
   4.132 +            this.session = session;
   4.133 +        }
   4.134 +    }
   4.135 +
   4.136 +}
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/AttachHandler.java	Tue Jan 28 21:59:12 2014 +0100
     5.3 @@ -0,0 +1,118 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 2014 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 2014 Sun Microsystems, Inc.
    5.44 + */
    5.45 +
    5.46 +package org.netbeans.modules.dew4nb.services.debugger;
    5.47 +
    5.48 +import java.util.concurrent.Executor;
    5.49 +import org.netbeans.api.annotations.common.NonNull;
    5.50 +import org.netbeans.modules.dew4nb.endpoint.AsyncRequestHandler;
    5.51 +import org.netbeans.modules.dew4nb.endpoint.EndPoint;
    5.52 +import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
    5.53 +import org.netbeans.modules.dew4nb.endpoint.Status;
    5.54 +import org.netbeans.modules.dew4nb.services.javac.Context;
    5.55 +import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    5.56 +import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
    5.57 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
    5.58 +import org.openide.filesystems.FileObject;
    5.59 +import org.openide.util.Lookup;
    5.60 +import org.openide.util.RequestProcessor;
    5.61 +import org.openide.util.lookup.ServiceProvider;
    5.62 +
    5.63 +/**
    5.64 + *
    5.65 + * @author Tomas Zezula
    5.66 + */
    5.67 +@ServiceProvider(service = RequestHandler.class)
    5.68 +public class AttachHandler extends AsyncRequestHandler<JavacQuery, JavacMessageType> {
    5.69 +
    5.70 +    private static final Executor RP = new RequestProcessor(AttachHandler.class);    
    5.71 +
    5.72 +
    5.73 +    public AttachHandler() {
    5.74 +        super(DebugerModels.END_POINT, JavacMessageType.attach, JavacQuery.class);        
    5.75 +    }
    5.76 +
    5.77 +    @Override
    5.78 +    @NonNull
    5.79 +    protected Status handle(@NonNull final JavacQuery request, @NonNull final EndPoint.Env env) {
    5.80 +        final JavacMessageType type = request.getType();
    5.81 +        if (type != JavacMessageType.attach) {
    5.82 +            throw new IllegalStateException("Wrong message type:" + type);  //NOI18N
    5.83 +        }
    5.84 +        final Context ctx = request.getContext();
    5.85 +        if (ctx != null) {
    5.86 +            throw new IllegalArgumentException("Missing context");  //NOI18N
    5.87 +        }
    5.88 +        final String state = request.getState();
    5.89 +        if (state == null) {
    5.90 +            throw new IllegalArgumentException("Missing state");       //NOI18N
    5.91 +        }
    5.92 +        final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
    5.93 +        if (resolver == null) {
    5.94 +            throw new IllegalStateException("No WorkspaceResolver");    //NOI18N
    5.95 +        }
    5.96 +        RP.execute(new Runnable() {
    5.97 +            @Override
    5.98 +            public void run() {                
    5.99 +                final WorkspaceResolver.Context serverCtx = new WorkspaceResolver.Context(
   5.100 +                   ctx.getUser(),
   5.101 +                   ctx.getWorkspace(),
   5.102 +                   ""   //NOI18N
   5.103 +                );
   5.104 +                Status status = Status.not_found;
   5.105 +                int id = -1;
   5.106 +                final FileObject workspace = resolver.resolveFile(serverCtx);                
   5.107 +                if (workspace != null) {
   5.108 +                    id = ActiveSessions.getInstance().createSession(serverCtx, env);
   5.109 +                    status = Status.done;
   5.110 +                }
   5.111 +                final AttachResult attachResult = new AttachResult();
   5.112 +                attachResult.setId(id);
   5.113 +                attachResult.setType(type);
   5.114 +                attachResult.setState(state);
   5.115 +                attachResult.setStatus(status);
   5.116 +                env.sendObject(attachResult);
   5.117 +            }
   5.118 +        });
   5.119 +        return Status.accepted;
   5.120 +    }
   5.121 +}
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/ContinueHandler.java	Tue Jan 28 21:59:12 2014 +0100
     6.3 @@ -0,0 +1,95 @@
     6.4 +/*
     6.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 + *
     6.7 + * Copyright 2014 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 2014 Sun Microsystems, Inc.
    6.44 + */
    6.45 +
    6.46 +package org.netbeans.modules.dew4nb.services.debugger;
    6.47 +
    6.48 +import org.netbeans.api.annotations.common.NonNull;
    6.49 +import org.netbeans.api.debugger.Session;
    6.50 +import org.netbeans.api.debugger.jpda.JPDADebugger;
    6.51 +import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
    6.52 +import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
    6.53 +import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
    6.54 +import org.netbeans.modules.dew4nb.endpoint.Status;
    6.55 +import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    6.56 +import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
    6.57 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
    6.58 +import org.openide.util.Parameters;
    6.59 +import org.openide.util.lookup.ServiceProvider;
    6.60 +
    6.61 +/**
    6.62 + *
    6.63 + * @author Tomas Zezula
    6.64 + */
    6.65 +@ServiceProvider(service=RequestHandler.class)
    6.66 +public class ContinueHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, ContinueResult> {
    6.67 +
    6.68 +    public ContinueHandler() {
    6.69 +        super(DebugerModels.END_POINT, JavacMessageType.cont, JavacQuery.class, ContinueResult.class);
    6.70 +    }
    6.71 +
    6.72 +    @Override
    6.73 +    @NonNull
    6.74 +    protected Status handle(@NonNull final JavacQuery request, @NonNull final ContinueResult response) {
    6.75 +        Parameters.notNull("request", request); //NOI18N
    6.76 +        Parameters.notNull("response", response);   //NOI18N
    6.77 +        if (request.getType() != JavacMessageType.cont) {
    6.78 +            throw new IllegalStateException("Invalid message type: " + request.getType());  //NOI18N
    6.79 +        }
    6.80 +        Status status = Status.not_found;
    6.81 +        final int sessionId = request.getOffset();
    6.82 +        final WorkspaceResolver.Context ctx = ActiveSessions.getInstance().getContext(sessionId);
    6.83 +        if (ctx != null) {
    6.84 +            final Session debugSession = ActiveSessions.getInstance().getDebugSession(sessionId);
    6.85 +            if (debugSession == null) {
    6.86 +                throw new IllegalStateException("No debugger session.");    //NOI18N
    6.87 +            }
    6.88 +            final JPDADebugger jpda = debugSession.lookupFirst(null, JPDADebugger.class);
    6.89 +            if (!(jpda instanceof JPDADebuggerImpl)) {
    6.90 +                throw new IllegalStateException("Wrong debugger service.");    //NOI18N
    6.91 +            }
    6.92 +            ((JPDADebuggerImpl)jpda).resume();
    6.93 +            status = Status.done;
    6.94 +        }
    6.95 +        return status;
    6.96 +    }
    6.97 +
    6.98 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/DebugerModels.java	Tue Jan 28 21:59:12 2014 +0100
     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 2014 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 2014 Sun Microsystems, Inc.
    7.44 + */
    7.45 +
    7.46 +package org.netbeans.modules.dew4nb.services.debugger;
    7.47 +
    7.48 +import net.java.html.json.Model;
    7.49 +import net.java.html.json.Property;
    7.50 +import org.netbeans.modules.dew4nb.endpoint.Status;
    7.51 +import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    7.52 +
    7.53 +/**
    7.54 + *
    7.55 + * @author Tomas Zezula
    7.56 + */
    7.57 +public final class DebugerModels {
    7.58 +
    7.59 +    static final String END_POINT = "javac"; //NOI18N
    7.60 +
    7.61 +    private DebugerModels() {
    7.62 +        throw new IllegalStateException("No instance allowed.");    //NOI18N
    7.63 +    }
    7.64 +
    7.65 +
    7.66 +    @Model(className = "AttachResult", properties = {
    7.67 +        @Property(name = "status", type = Status.class),
    7.68 +        @Property(name = "type", type = JavacMessageType.class),
    7.69 +        @Property(name = "state", type = String.class),
    7.70 +        @Property(name = "id", type = int.class)
    7.71 +    })
    7.72 +    static final class AttachResultModel {
    7.73 +    }
    7.74 +
    7.75 +
    7.76 +    @Model(className = "SetBreakpointsResult", properties = {
    7.77 +        @Property(name = "status", type = Status.class),
    7.78 +        @Property(name = "type", type = JavacMessageType.class),
    7.79 +        @Property(name = "state", type = String.class),
    7.80 +    })
    7.81 +    static final class SetBreakpointsResultModel {
    7.82 +    }
    7.83 +
    7.84 +    @Model(className = "ContinueResult", properties = {
    7.85 +        @Property(name = "status", type = Status.class),
    7.86 +        @Property(name = "type", type = JavacMessageType.class),
    7.87 +        @Property(name = "state", type = String.class),
    7.88 +    })
    7.89 +    static final class ContinueResultModel {
    7.90 +    }
    7.91 +
    7.92 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/debugger/SetBreakpointsHandler.java	Tue Jan 28 21:59:12 2014 +0100
     8.3 @@ -0,0 +1,128 @@
     8.4 +/*
     8.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     8.6 + *
     8.7 + * Copyright 2014 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 2014 Sun Microsystems, Inc.
    8.44 + */
    8.45 +
    8.46 +package org.netbeans.modules.dew4nb.services.debugger;
    8.47 +
    8.48 +import java.util.logging.Level;
    8.49 +import java.util.logging.Logger;
    8.50 +import org.netbeans.api.annotations.common.NonNull;
    8.51 +import org.netbeans.api.debugger.DebuggerManager;
    8.52 +import org.netbeans.api.debugger.jpda.LineBreakpoint;
    8.53 +import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
    8.54 +import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
    8.55 +import org.netbeans.modules.dew4nb.endpoint.Status;
    8.56 +import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    8.57 +import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
    8.58 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
    8.59 +import org.openide.filesystems.FileObject;
    8.60 +import org.openide.util.Lookup;
    8.61 +import org.openide.util.Parameters;
    8.62 +import org.openide.util.lookup.ServiceProvider;
    8.63 +
    8.64 +/**
    8.65 + *
    8.66 + * @author Tomas Zezula
    8.67 + */
    8.68 +@ServiceProvider(service = RequestHandler.class)
    8.69 +public class SetBreakpointsHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, SetBreakpointsResult> {
    8.70 +    
    8.71 +    private static final Logger LOG = Logger.getLogger(SetBreakpointsHandler.class.getName());
    8.72 +
    8.73 +    public SetBreakpointsHandler() {
    8.74 +        super(DebugerModels.END_POINT, JavacMessageType.breakpoints, JavacQuery.class, SetBreakpointsResult.class);
    8.75 +    }
    8.76 +
    8.77 +    @Override
    8.78 +    protected Status handle(@NonNull final JavacQuery request, @NonNull final SetBreakpointsResult response) {
    8.79 +        Parameters.notNull("request", request); //NOI18N
    8.80 +        Parameters.notNull("response", response);   //NOI18N;
    8.81 +        if (request.getType() != JavacMessageType.breakpoints) {
    8.82 +            throw new IllegalStateException("Wrong message type: " + request.getType());    //NOI18N
    8.83 +        }
    8.84 +        Status status = Status.not_found;
    8.85 +        final int sessionId = request.getOffset();
    8.86 +        final WorkspaceResolver.Context ctx = ActiveSessions.getInstance().getContext(sessionId);
    8.87 +        if (ctx != null) {
    8.88 +            final String lines = request.getJava();
    8.89 +            if (lines != null) {
    8.90 +                final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
    8.91 +                if (resolver == null) {
    8.92 +                    throw new IllegalStateException("No WorkspaceResolver."); //NOI18N
    8.93 +                }
    8.94 +                final DebuggerManager dbm = DebuggerManager.getDebuggerManager();
    8.95 +                for (String line : lines.split(",")) {  //NOI18N
    8.96 +                    final int separator = line.lastIndexOf(':');    //NOI18N
    8.97 +                    if (separator > 0 && separator < line.length() - 1) {
    8.98 +                        try {
    8.99 +                            final String path = line.substring(0, separator);
   8.100 +                            final String lineStr = line.substring(separator+1);
   8.101 +                            final int lineNo = Integer.parseInt(lineStr);
   8.102 +                            final FileObject file = resolver.resolveFile(new WorkspaceResolver.Context(ctx.getUser(), ctx.getWorkspace(), path));
   8.103 +                            if (file != null) {
   8.104 +                                final LineBreakpoint lb = LineBreakpoint.create(file.toURL().toExternalForm(), lineNo);
   8.105 +                                dbm.addBreakpoint(lb);
   8.106 +                            } else {
   8.107 +                                LOG.log(
   8.108 +                                    Level.WARNING,
   8.109 +                                    "Ignoring breakpoint in unresolvable file: {0}",   //NOI18N
   8.110 +                                    line);
   8.111 +                            }
   8.112 +                        } catch (NumberFormatException nfe) {
   8.113 +                            LOG.log(
   8.114 +                                Level.WARNING,
   8.115 +                                "Ignoring breakpoint with wrong line number: {0}",   //NOI18N
   8.116 +                                line);
   8.117 +                        }
   8.118 +                    } else {
   8.119 +                        LOG.log(
   8.120 +                            Level.WARNING,
   8.121 +                            "Ignoring wrong breakpoint: {0}",   //NOI18N
   8.122 +                            line);
   8.123 +                    }
   8.124 +                }
   8.125 +            }
   8.126 +            status = Status.done;
   8.127 +        }
   8.128 +        return status;
   8.129 +    }
   8.130 +
   8.131 +}
     9.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/AutocompleteHandler.java	Tue Jan 28 13:57:53 2014 +0100
     9.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/AutocompleteHandler.java	Tue Jan 28 21:59:12 2014 +0100
     9.3 @@ -74,6 +74,7 @@
     9.4  import org.netbeans.modules.dew4nb.SourceProvider;
     9.5  import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
     9.6  import org.netbeans.modules.dew4nb.endpoint.Status;
     9.7 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
     9.8  import org.netbeans.modules.editor.completion.CompletionItemComparator;
     9.9  import org.netbeans.modules.editor.java.JavaCompletionItem;
    9.10  import org.netbeans.modules.editor.java.JavaCompletionItemFactory;
    9.11 @@ -106,7 +107,12 @@
    9.12                  ctx.getPath());
    9.13          Status status = Status.runtime_error;
    9.14          try {
    9.15 -            final Source s = SourceProvider.getInstance().getSource(ctx, java);
    9.16 +            final Source s = SourceProvider.getInstance().getSource(
    9.17 +                new WorkspaceResolver.Context(
    9.18 +                    ctx.getUser(),
    9.19 +                    ctx.getWorkspace(),
    9.20 +                    ctx.getPath()),
    9.21 +                java);
    9.22              if (s != null) {
    9.23                  List<? extends org.netbeans.spi.editor.completion.CompletionItem> items = JavaCompletionProvider.query(s, CompletionProvider.COMPLETION_QUERY_TYPE, offset, offset, new Item.Factory());
    9.24                  Collections.sort(items, CompletionItemComparator.BY_PRIORITY);
    10.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/ErrorHandler.java	Tue Jan 28 13:57:53 2014 +0100
    10.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/ErrorHandler.java	Tue Jan 28 21:59:12 2014 +0100
    10.3 @@ -56,6 +56,7 @@
    10.4  import org.netbeans.modules.dew4nb.SourceProvider;
    10.5  import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
    10.6  import org.netbeans.modules.dew4nb.endpoint.Status;
    10.7 +import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
    10.8  import org.netbeans.modules.parsing.api.ParserManager;
    10.9  import org.netbeans.modules.parsing.api.ResultIterator;
   10.10  import org.netbeans.modules.parsing.api.Source;
   10.11 @@ -88,7 +89,12 @@
   10.12          }
   10.13          final String java = request.getJava();
   10.14          final Context ctx = request.getContext();
   10.15 -        final Source src = SourceProvider.getInstance().getSource(ctx, java);
   10.16 +        final Source src = SourceProvider.getInstance().getSource(
   10.17 +            new WorkspaceResolver.Context(
   10.18 +                ctx.getUser(),
   10.19 +                ctx.getWorkspace(),
   10.20 +                ctx.getPath()),
   10.21 +            java);
   10.22          Status status = Status.runtime_error;
   10.23          if (src != null) {
   10.24              try {
    11.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacMessageType.java	Tue Jan 28 13:57:53 2014 +0100
    11.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacMessageType.java	Tue Jan 28 21:59:12 2014 +0100
    11.3 @@ -45,14 +45,9 @@
    11.4  public enum JavacMessageType {
    11.5      //javac
    11.6      autocomplete,
    11.7 -    types,
    11.8      symbols,
    11.9      checkForErrors,
   11.10      compile,
   11.11 -    //project
   11.12 -    getfile,
   11.13 -    isActionEnabled,
   11.14 -    invokeAction,
   11.15      //debugger
   11.16      attach,
   11.17      breakpoints,
    12.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacModels.java	Tue Jan 28 13:57:53 2014 +0100
    12.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/JavacModels.java	Tue Jan 28 21:59:12 2014 +0100
    12.3 @@ -46,7 +46,6 @@
    12.4  import net.java.html.json.Model;
    12.5  import net.java.html.json.Property;
    12.6  import org.netbeans.modules.dew4nb.endpoint.Status;
    12.7 -import org.netbeans.modules.dew4nb.services.project.BuildResult;
    12.8  
    12.9  /**
   12.10   *
   12.11 @@ -63,7 +62,7 @@
   12.12      @Model(className = "JavacQuery", properties = {
   12.13          @Property(name = "type", type = JavacMessageType.class),
   12.14          @Property(name = "state", type = String.class),
   12.15 -        @Property(name = "context", type=Context.class),
   12.16 +        @Property(name = "context", type = Context.class),
   12.17          @Property(name = "java", type = String.class),
   12.18          @Property(name = "offset", type = int.class)
   12.19      })
   12.20 @@ -116,27 +115,6 @@
   12.21      static final class FileContentResultModel {
   12.22      }
   12.23  
   12.24 -    @Model(className="IsProjectActionEnabledResult", properties = {
   12.25 -        @Property(name = "status", type = Status.class),
   12.26 -        @Property(name = "type", type = JavacMessageType.class),
   12.27 -        @Property(name = "state", type = String.class),
   12.28 -        @Property(name = "enabled", type = Boolean.class)
   12.29 -    })
   12.30 -    static final class IsProjectActionEnabledResultModel {
   12.31 -    }
   12.32 -
   12.33 -    @Model(className = "InvokeProjectActionResult", properties = {
   12.34 -        @Property(name = "status", type = Status.class),
   12.35 -        @Property(name = "type", type = JavacMessageType.class),
   12.36 -        @Property(name = "state", type = String.class),
   12.37 -        @Property(name = "result", type = BuildResult.class),
   12.38 -        @Property(name = "stdout", type = String.class, array = true),
   12.39 -        @Property(name = "stderr", type = String.class, array = true),
   12.40 -        @Property(name = "openUrl", type = String.class, array = true)
   12.41 -    })
   12.42 -    static final class InvokeProjectActionResultModel {
   12.43 -    }    
   12.44 -
   12.45      @Model(className = "Context", properties = {
   12.46          @Property(name="user", type=String.class),
   12.47          @Property(name = "workspace", type = String.class),
   12.48 @@ -145,7 +123,6 @@
   12.49      static final class ContextModel {
   12.50      }
   12.51  
   12.52 -
   12.53      @Model(className = "JavacDiagnostic", properties = {
   12.54          @Property(name = "col", type = long.class),
   12.55          @Property(name = "line", type = long.class),
   12.56 @@ -181,6 +158,4 @@
   12.57      })
   12.58      static final class TypeDescriptorModel {
   12.59      }
   12.60 -
   12.61 -
   12.62  }
    13.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/TypeHandler.java	Tue Jan 28 13:57:53 2014 +0100
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,189 +0,0 @@
    13.4 -/*
    13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 - *
    13.7 - * Copyright 2013 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 2013 Sun Microsystems, Inc.
   13.44 - */
   13.45 -
   13.46 -package org.netbeans.modules.dew4nb.services.javac;
   13.47 -
   13.48 -import java.util.ArrayList;
   13.49 -import java.util.Arrays;
   13.50 -import java.util.Collection;
   13.51 -import java.util.Collections;
   13.52 -import java.util.HashSet;
   13.53 -import java.util.List;
   13.54 -import org.netbeans.api.annotations.common.NonNull;
   13.55 -import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
   13.56 -import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   13.57 -import org.netbeans.modules.dew4nb.endpoint.Status;
   13.58 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   13.59 -import org.netbeans.modules.jumpto.common.Utils;
   13.60 -import org.netbeans.modules.jumpto.type.TypeProviderAccessor;
   13.61 -import org.netbeans.spi.jumpto.type.SearchType;
   13.62 -import org.netbeans.spi.jumpto.type.TypeDescriptor;
   13.63 -import org.netbeans.spi.jumpto.type.TypeProvider;
   13.64 -import org.openide.util.Lookup;
   13.65 -import org.openide.util.Parameters;
   13.66 -import org.openide.util.lookup.ServiceProvider;
   13.67 -
   13.68 -/**
   13.69 - *
   13.70 - * @author Tomas Zezula
   13.71 - */
   13.72 -@ServiceProvider(service = RequestHandler.class)
   13.73 -public class TypeHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, JavacTypeResult> {
   13.74 -    public TypeHandler() {
   13.75 -        super(
   13.76 -            JavacModels.END_POINT,
   13.77 -            JavacMessageType.types,
   13.78 -            JavacQuery.class,
   13.79 -            JavacTypeResult.class);
   13.80 -    }
   13.81 -
   13.82 -    @Override
   13.83 -    protected Status handle(
   13.84 -        @NonNull final JavacQuery request,
   13.85 -        @NonNull final JavacTypeResult response) {
   13.86 -        Parameters.notNull("request", request); //NOI18N
   13.87 -        Parameters.notNull("response", response);  //NOI18N
   13.88 -        final JavacMessageType requestType = request.getType();
   13.89 -        if (requestType != JavacMessageType.types) {
   13.90 -            throw new IllegalStateException(String.valueOf(requestType));
   13.91 -        }
   13.92 -        final String text = request.getJava();
   13.93 -        final Collection<? extends TypeProvider> typeProviders = getTypeProviders();
   13.94 -        try {
   13.95 -            final Collection<? extends TypeDescriptor> types = callTypeProviders(text, typeProviders);
   13.96 -            final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
   13.97 -            if (resolver == null) {
   13.98 -                throw new IllegalStateException("No WorkspaceResolver in Lookup");  //NOI18N
   13.99 -            }
  13.100 -            for (TypeDescriptor td : types) {
  13.101 -                final WorkspaceResolver.Context ctx = resolver.resolveContext(td.getFileObject());
  13.102 -                if (ctx != null) {
  13.103 -                    response.getTypes().add(
  13.104 -                        new org.netbeans.modules.dew4nb.services.javac.TypeDescriptor(
  13.105 -                        td.getSimpleName(),
  13.106 -                        td.getContextName(),
  13.107 -                        "", //NOI18N
  13.108 -                        apiToWire(ctx)));
  13.109 -                }
  13.110 -            }
  13.111 -        } finally {
  13.112 -            cleanTypeProviders(typeProviders);
  13.113 -        }
  13.114 -        return Status.done;
  13.115 -    }
  13.116 -
  13.117 -    @NonNull
  13.118 -    private static Collection<? extends TypeProvider> getTypeProviders() {
  13.119 -        final List<TypeProvider> result = new ArrayList<>();
  13.120 -        for (TypeProvider tp : Lookup.getDefault().lookupAll(TypeProvider.class)) {
  13.121 -            result.add(tp);
  13.122 -        }
  13.123 -        return Collections.unmodifiableCollection(result);
  13.124 -    }
  13.125 -
  13.126 -    @NonNull
  13.127 -    private static Collection<? extends TypeDescriptor> callTypeProviders(
  13.128 -            @NonNull final String text,
  13.129 -            @NonNull final Collection<? extends TypeProvider> providers) {
  13.130 -        Parameters.notNull("text", text);   //NOI18N
  13.131 -        Parameters.notNull("providers", providers); //NOI18N
  13.132 -        final Collection<TypeDescriptor> collector = new HashSet<>();
  13.133 -        for (TypeProvider.Context ctx : createContext(text)) {
  13.134 -            final TypeProvider.Result res = createResult(collector, ctx);
  13.135 -            for (TypeProvider tp : providers) {
  13.136 -                tp.computeTypeNames(ctx, res);
  13.137 -            }
  13.138 -        }
  13.139 -        return Collections.unmodifiableCollection(collector);
  13.140 -    }
  13.141 -
  13.142 -    private static void cleanTypeProviders(@NonNull Collection<? extends TypeProvider> providers) {
  13.143 -        Parameters.notNull("providers", providers); //NOI18N
  13.144 -        for (TypeProvider tp : providers) {
  13.145 -            tp.cleanup();
  13.146 -        }
  13.147 -    }
  13.148 -
  13.149 -    @NonNull
  13.150 -    private static Collection< ? extends TypeProvider.Context> createContext(@NonNull String text) {
  13.151 -        Parameters.notNull("text", text);   //NOI18N
  13.152 -        boolean exact = text.endsWith(" "); // NOI18N
  13.153 -        text = text.trim();
  13.154 -        if ( text.length() == 0) {
  13.155 -            return Collections.<TypeProvider.Context>emptySet();
  13.156 -        }
  13.157 -        Collection<? extends TypeProvider.Context> contexts;
  13.158 -        int wildcard = Utils.containsWildCard(text);
  13.159 -        if (exact) {
  13.160 -            contexts = Collections.singleton(
  13.161 -                TypeProviderAccessor.DEFAULT.createContext(null, text, SearchType.CASE_INSENSITIVE_EXACT_NAME));
  13.162 -        } else if ((Utils.isAllUpper(text) && text.length() > 1) || Utils.isCamelCase(text)) {
  13.163 -            contexts = Arrays.asList(
  13.164 -                new TypeProvider.Context[] {
  13.165 -                    TypeProviderAccessor.DEFAULT.createContext(null, text, SearchType.CAMEL_CASE),
  13.166 -                    TypeProviderAccessor.DEFAULT.createContext(null, text, SearchType.CASE_INSENSITIVE_PREFIX)});
  13.167 -        } else if (wildcard != -1) {
  13.168 -            text = Utils.removeNonNeededWildCards(text);
  13.169 -            contexts = Collections.singleton(TypeProviderAccessor.DEFAULT.createContext(null, text, SearchType.CASE_INSENSITIVE_REGEXP));
  13.170 -        } else {
  13.171 -            contexts = Collections.singleton(TypeProviderAccessor.DEFAULT.createContext(null, text,SearchType.CASE_INSENSITIVE_PREFIX));
  13.172 -        }
  13.173 -        return contexts;
  13.174 -    }
  13.175 -
  13.176 -    @NonNull
  13.177 -    private static TypeProvider.Result createResult(
  13.178 -            @NonNull final Collection<? super TypeDescriptor> collector,
  13.179 -            @NonNull final TypeProvider.Context ctx) {
  13.180 -        Parameters.notNull("collector", collector); //NOI18N
  13.181 -        Parameters.notNull("ctx", ctx);   //NOI18N
  13.182 -        return TypeProviderAccessor.DEFAULT.createResult(
  13.183 -             collector,
  13.184 -             new String[1],
  13.185 -             ctx);
  13.186 -    }
  13.187 -
  13.188 -    private Context apiToWire(@NonNull WorkspaceResolver.Context ctx) {
  13.189 -        Parameters.notNull("ctx", ctx); //NOI18N
  13.190 -        return new Context(ctx.getUser(), ctx.getWorkspace(), ctx.getPath());
  13.191 -    }
  13.192 -}
    14.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/ActiveSessions.java	Tue Jan 28 13:57:53 2014 +0100
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,133 +0,0 @@
    14.4 -/*
    14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 - *
    14.7 - * Copyright 2014 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 2014 Sun Microsystems, Inc.
   14.44 - */
   14.45 -
   14.46 -package org.netbeans.modules.dew4nb.services.javac.debugger;
   14.47 -
   14.48 -import java.util.concurrent.ConcurrentHashMap;
   14.49 -import java.util.concurrent.ConcurrentMap;
   14.50 -import java.util.concurrent.atomic.AtomicInteger;
   14.51 -import org.netbeans.api.annotations.common.CheckForNull;
   14.52 -import org.netbeans.api.annotations.common.NonNull;
   14.53 -import org.netbeans.api.debugger.DebuggerManager;
   14.54 -import org.netbeans.api.debugger.Session;
   14.55 -import org.netbeans.modules.dew4nb.endpoint.EndPoint;
   14.56 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   14.57 -import org.openide.util.Parameters;
   14.58 -
   14.59 -/**
   14.60 - *
   14.61 - * @author Tomas Zezula
   14.62 - */
   14.63 -final class ActiveSessions {
   14.64 -
   14.65 -    //@GuardedBy("ActiveSessions.class")
   14.66 -    private static ActiveSessions instance;
   14.67 -
   14.68 -    private final ConcurrentMap<Integer,Data> active;
   14.69 -    private final AtomicInteger sequencer;
   14.70 -
   14.71 -    private ActiveSessions() {
   14.72 -        this.active = new ConcurrentHashMap<>();
   14.73 -        this.sequencer = new AtomicInteger();
   14.74 -    }
   14.75 -
   14.76 -
   14.77 -    int createSession(
   14.78 -            @NonNull final WorkspaceResolver.Context context,
   14.79 -            @NonNull final EndPoint.Env env) {
   14.80 -        Parameters.notNull("context", context); //NOI18N
   14.81 -        Parameters.notNull("env", env); //NOI18N
   14.82 -        final int id = sequencer.incrementAndGet();
   14.83 -        final Session session = DebuggerManager.getDebuggerManager().getCurrentSession();
   14.84 -        if (active.putIfAbsent(id, new Data(context, env, session)) != null) {
   14.85 -            throw new IllegalStateException("Trying to reuse active session");  //NOI18N
   14.86 -        }
   14.87 -        return id;
   14.88 -    }
   14.89 -
   14.90 -    @CheckForNull
   14.91 -    WorkspaceResolver.Context getContext(final int sessionId) {
   14.92 -        final Data data = active.get(sessionId);
   14.93 -        return data == null ? null : data.ctx;
   14.94 -    }
   14.95 -
   14.96 -    @CheckForNull
   14.97 -    EndPoint.Env getEnv(final int sessionId) {
   14.98 -        final Data data = active.get(sessionId);
   14.99 -        return data == null ? null : data.env;
  14.100 -    }
  14.101 -
  14.102 -    @CheckForNull
  14.103 -    Session getDebugSession(final int sessionId) {
  14.104 -        final Data data = active.get(sessionId);
  14.105 -        return data == null ? null : data.session;
  14.106 -    }
  14.107 -
  14.108 -
  14.109 -    @NonNull
  14.110 -    static synchronized ActiveSessions getInstance() {
  14.111 -        if (instance == null) {
  14.112 -            instance = new ActiveSessions();
  14.113 -        }
  14.114 -        return instance;
  14.115 -    }
  14.116 -
  14.117 -    private static final class Data {
  14.118 -        final WorkspaceResolver.Context ctx;
  14.119 -        final EndPoint.Env env;
  14.120 -        final Session session;
  14.121 -
  14.122 -
  14.123 -        private Data(
  14.124 -            @NonNull final WorkspaceResolver.Context ctx,
  14.125 -            @NonNull final EndPoint.Env env,
  14.126 -            @NonNull final Session session) {
  14.127 -            Parameters.notNull("ctx", ctx); //NOI18N
  14.128 -            Parameters.notNull("env", env); //NOI18N
  14.129 -            Parameters.notNull("session", session); //NOI18N
  14.130 -            this.ctx = ctx;
  14.131 -            this.env = env;
  14.132 -            this.session = session;
  14.133 -        }
  14.134 -    }
  14.135 -
  14.136 -}
    15.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/AttachHandler.java	Tue Jan 28 13:57:53 2014 +0100
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,118 +0,0 @@
    15.4 -/*
    15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 - *
    15.7 - * Copyright 2014 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 2014 Sun Microsystems, Inc.
   15.44 - */
   15.45 -
   15.46 -package org.netbeans.modules.dew4nb.services.javac.debugger;
   15.47 -
   15.48 -import java.util.concurrent.Executor;
   15.49 -import org.netbeans.api.annotations.common.NonNull;
   15.50 -import org.netbeans.modules.dew4nb.endpoint.AsyncRequestHandler;
   15.51 -import org.netbeans.modules.dew4nb.endpoint.EndPoint;
   15.52 -import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   15.53 -import org.netbeans.modules.dew4nb.endpoint.Status;
   15.54 -import org.netbeans.modules.dew4nb.services.javac.Context;
   15.55 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   15.56 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   15.57 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   15.58 -import org.openide.filesystems.FileObject;
   15.59 -import org.openide.util.Lookup;
   15.60 -import org.openide.util.RequestProcessor;
   15.61 -import org.openide.util.lookup.ServiceProvider;
   15.62 -
   15.63 -/**
   15.64 - *
   15.65 - * @author Tomas Zezula
   15.66 - */
   15.67 -@ServiceProvider(service = RequestHandler.class)
   15.68 -public class AttachHandler extends AsyncRequestHandler<JavacQuery, JavacMessageType> {
   15.69 -
   15.70 -    private static final Executor RP = new RequestProcessor(AttachHandler.class);    
   15.71 -
   15.72 -
   15.73 -    public AttachHandler() {
   15.74 -        super(DebugerModels.END_POINT, JavacMessageType.attach, JavacQuery.class);        
   15.75 -    }
   15.76 -
   15.77 -    @Override
   15.78 -    @NonNull
   15.79 -    protected Status handle(@NonNull final JavacQuery request, @NonNull final EndPoint.Env env) {
   15.80 -        final JavacMessageType type = request.getType();
   15.81 -        if (type != JavacMessageType.attach) {
   15.82 -            throw new IllegalStateException("Wrong message type:" + type);  //NOI18N
   15.83 -        }
   15.84 -        final Context ctx = request.getContext();
   15.85 -        if (ctx != null) {
   15.86 -            throw new IllegalArgumentException("Missing context");  //NOI18N
   15.87 -        }
   15.88 -        final String state = request.getState();
   15.89 -        if (state == null) {
   15.90 -            throw new IllegalArgumentException("Missing state");       //NOI18N
   15.91 -        }
   15.92 -        final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
   15.93 -        if (resolver == null) {
   15.94 -            throw new IllegalStateException("No WorkspaceResolver");    //NOI18N
   15.95 -        }
   15.96 -        RP.execute(new Runnable() {
   15.97 -            @Override
   15.98 -            public void run() {                
   15.99 -                final WorkspaceResolver.Context serverCtx = new WorkspaceResolver.Context(
  15.100 -                   ctx.getUser(),
  15.101 -                   ctx.getWorkspace(),
  15.102 -                   ""   //NOI18N
  15.103 -                );
  15.104 -                Status status = Status.not_found;
  15.105 -                int id = -1;
  15.106 -                final FileObject workspace = resolver.resolveFile(serverCtx);                
  15.107 -                if (workspace != null) {
  15.108 -                    id = ActiveSessions.getInstance().createSession(serverCtx, env);
  15.109 -                    status = Status.done;
  15.110 -                }
  15.111 -                final AttachResult attachResult = new AttachResult();
  15.112 -                attachResult.setId(id);
  15.113 -                attachResult.setType(type);
  15.114 -                attachResult.setState(state);
  15.115 -                attachResult.setStatus(status);
  15.116 -                env.sendObject(attachResult);
  15.117 -            }
  15.118 -        });
  15.119 -        return Status.accepted;
  15.120 -    }
  15.121 -}
    16.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/ContinueHandler.java	Tue Jan 28 13:57:53 2014 +0100
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,95 +0,0 @@
    16.4 -/*
    16.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    16.6 - *
    16.7 - * Copyright 2014 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 2014 Sun Microsystems, Inc.
   16.44 - */
   16.45 -
   16.46 -package org.netbeans.modules.dew4nb.services.javac.debugger;
   16.47 -
   16.48 -import org.netbeans.api.annotations.common.NonNull;
   16.49 -import org.netbeans.api.debugger.Session;
   16.50 -import org.netbeans.api.debugger.jpda.JPDADebugger;
   16.51 -import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl;
   16.52 -import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
   16.53 -import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   16.54 -import org.netbeans.modules.dew4nb.endpoint.Status;
   16.55 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   16.56 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   16.57 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   16.58 -import org.openide.util.Parameters;
   16.59 -import org.openide.util.lookup.ServiceProvider;
   16.60 -
   16.61 -/**
   16.62 - *
   16.63 - * @author Tomas Zezula
   16.64 - */
   16.65 -@ServiceProvider(service=RequestHandler.class)
   16.66 -public class ContinueHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, ContinueResult> {
   16.67 -
   16.68 -    public ContinueHandler() {
   16.69 -        super(DebugerModels.END_POINT, JavacMessageType.cont, JavacQuery.class, ContinueResult.class);
   16.70 -    }
   16.71 -
   16.72 -    @Override
   16.73 -    @NonNull
   16.74 -    protected Status handle(@NonNull final JavacQuery request, @NonNull final ContinueResult response) {
   16.75 -        Parameters.notNull("request", request); //NOI18N
   16.76 -        Parameters.notNull("response", response);   //NOI18N
   16.77 -        if (request.getType() != JavacMessageType.cont) {
   16.78 -            throw new IllegalStateException("Invalid message type: " + request.getType());  //NOI18N
   16.79 -        }
   16.80 -        Status status = Status.not_found;
   16.81 -        final int sessionId = request.getOffset();
   16.82 -        final WorkspaceResolver.Context ctx = ActiveSessions.getInstance().getContext(sessionId);
   16.83 -        if (ctx != null) {
   16.84 -            final Session debugSession = ActiveSessions.getInstance().getDebugSession(sessionId);
   16.85 -            if (debugSession == null) {
   16.86 -                throw new IllegalStateException("No debugger session.");    //NOI18N
   16.87 -            }
   16.88 -            final JPDADebugger jpda = debugSession.lookupFirst(null, JPDADebugger.class);
   16.89 -            if (!(jpda instanceof JPDADebuggerImpl)) {
   16.90 -                throw new IllegalStateException("Wrong debugger service.");    //NOI18N
   16.91 -            }
   16.92 -            ((JPDADebuggerImpl)jpda).resume();
   16.93 -            status = Status.done;
   16.94 -        }
   16.95 -        return status;
   16.96 -    }
   16.97 -
   16.98 -}
    17.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/DebugerModels.java	Tue Jan 28 13:57:53 2014 +0100
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,89 +0,0 @@
    17.4 -/*
    17.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    17.6 - *
    17.7 - * Copyright 2014 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 2014 Sun Microsystems, Inc.
   17.44 - */
   17.45 -
   17.46 -package org.netbeans.modules.dew4nb.services.javac.debugger;
   17.47 -
   17.48 -import net.java.html.json.Model;
   17.49 -import net.java.html.json.Property;
   17.50 -import org.netbeans.modules.dew4nb.endpoint.Status;
   17.51 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   17.52 -
   17.53 -/**
   17.54 - *
   17.55 - * @author Tomas Zezula
   17.56 - */
   17.57 -public final class DebugerModels {
   17.58 -
   17.59 -    static final String END_POINT = "javac"; //NOI18N
   17.60 -
   17.61 -    private DebugerModels() {
   17.62 -        throw new IllegalStateException("No instance allowed.");    //NOI18N
   17.63 -    }
   17.64 -
   17.65 -
   17.66 -    @Model(className = "AttachResult", properties = {
   17.67 -        @Property(name = "status", type = Status.class),
   17.68 -        @Property(name = "type", type = JavacMessageType.class),
   17.69 -        @Property(name = "state", type = String.class),
   17.70 -        @Property(name = "id", type = int.class)
   17.71 -    })
   17.72 -    static final class AttachResultModel {
   17.73 -    }
   17.74 -
   17.75 -
   17.76 -    @Model(className = "SetBreakpointsResult", properties = {
   17.77 -        @Property(name = "status", type = Status.class),
   17.78 -        @Property(name = "type", type = JavacMessageType.class),
   17.79 -        @Property(name = "state", type = String.class),
   17.80 -    })
   17.81 -    static final class SetBreakpointsResultModel {
   17.82 -    }
   17.83 -
   17.84 -    @Model(className = "ContinueResult", properties = {
   17.85 -        @Property(name = "status", type = Status.class),
   17.86 -        @Property(name = "type", type = JavacMessageType.class),
   17.87 -        @Property(name = "state", type = String.class),
   17.88 -    })
   17.89 -    static final class ContinueResultModel {
   17.90 -    }
   17.91 -
   17.92 -}
    18.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/javac/debugger/SetBreakpointsHandler.java	Tue Jan 28 13:57:53 2014 +0100
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,128 +0,0 @@
    18.4 -/*
    18.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    18.6 - *
    18.7 - * Copyright 2014 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 2014 Sun Microsystems, Inc.
   18.44 - */
   18.45 -
   18.46 -package org.netbeans.modules.dew4nb.services.javac.debugger;
   18.47 -
   18.48 -import java.util.logging.Level;
   18.49 -import java.util.logging.Logger;
   18.50 -import org.netbeans.api.annotations.common.NonNull;
   18.51 -import org.netbeans.api.debugger.DebuggerManager;
   18.52 -import org.netbeans.api.debugger.jpda.LineBreakpoint;
   18.53 -import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
   18.54 -import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   18.55 -import org.netbeans.modules.dew4nb.endpoint.Status;
   18.56 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   18.57 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   18.58 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   18.59 -import org.openide.filesystems.FileObject;
   18.60 -import org.openide.util.Lookup;
   18.61 -import org.openide.util.Parameters;
   18.62 -import org.openide.util.lookup.ServiceProvider;
   18.63 -
   18.64 -/**
   18.65 - *
   18.66 - * @author Tomas Zezula
   18.67 - */
   18.68 -@ServiceProvider(service = RequestHandler.class)
   18.69 -public class SetBreakpointsHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, SetBreakpointsResult> {
   18.70 -    
   18.71 -    private static final Logger LOG = Logger.getLogger(SetBreakpointsHandler.class.getName());
   18.72 -
   18.73 -    public SetBreakpointsHandler() {
   18.74 -        super(DebugerModels.END_POINT, JavacMessageType.breakpoints, JavacQuery.class, SetBreakpointsResult.class);
   18.75 -    }
   18.76 -
   18.77 -    @Override
   18.78 -    protected Status handle(@NonNull final JavacQuery request, @NonNull final SetBreakpointsResult response) {
   18.79 -        Parameters.notNull("request", request); //NOI18N
   18.80 -        Parameters.notNull("response", response);   //NOI18N;
   18.81 -        if (request.getType() != JavacMessageType.breakpoints) {
   18.82 -            throw new IllegalStateException("Wrong message type: " + request.getType());    //NOI18N
   18.83 -        }
   18.84 -        Status status = Status.not_found;
   18.85 -        final int sessionId = request.getOffset();
   18.86 -        final WorkspaceResolver.Context ctx = ActiveSessions.getInstance().getContext(sessionId);
   18.87 -        if (ctx != null) {
   18.88 -            final String lines = request.getJava();
   18.89 -            if (lines != null) {
   18.90 -                final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
   18.91 -                if (resolver == null) {
   18.92 -                    throw new IllegalStateException("No WorkspaceResolver."); //NOI18N
   18.93 -                }
   18.94 -                final DebuggerManager dbm = DebuggerManager.getDebuggerManager();
   18.95 -                for (String line : lines.split(",")) {  //NOI18N
   18.96 -                    final int separator = line.lastIndexOf(':');    //NOI18N
   18.97 -                    if (separator > 0 && separator < line.length() - 1) {
   18.98 -                        try {
   18.99 -                            final String path = line.substring(0, separator);
  18.100 -                            final String lineStr = line.substring(separator+1);
  18.101 -                            final int lineNo = Integer.parseInt(lineStr);
  18.102 -                            final FileObject file = resolver.resolveFile(new WorkspaceResolver.Context(ctx.getUser(), ctx.getWorkspace(), path));
  18.103 -                            if (file != null) {
  18.104 -                                final LineBreakpoint lb = LineBreakpoint.create(file.toURL().toExternalForm(), lineNo);
  18.105 -                                dbm.addBreakpoint(lb);
  18.106 -                            } else {
  18.107 -                                LOG.log(
  18.108 -                                    Level.WARNING,
  18.109 -                                    "Ignoring breakpoint in unresolvable file: {0}",   //NOI18N
  18.110 -                                    line);
  18.111 -                            }
  18.112 -                        } catch (NumberFormatException nfe) {
  18.113 -                            LOG.log(
  18.114 -                                Level.WARNING,
  18.115 -                                "Ignoring breakpoint with wrong line number: {0}",   //NOI18N
  18.116 -                                line);
  18.117 -                        }
  18.118 -                    } else {
  18.119 -                        LOG.log(
  18.120 -                            Level.WARNING,
  18.121 -                            "Ignoring wrong breakpoint: {0}",   //NOI18N
  18.122 -                            line);
  18.123 -                    }
  18.124 -                }
  18.125 -            }
  18.126 -            status = Status.done;
  18.127 -        }
  18.128 -        return status;
  18.129 -    }
  18.130 -
  18.131 -}
    19.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/project/GetFileContentHandler.java	Tue Jan 28 13:57:53 2014 +0100
    19.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.3 @@ -1,97 +0,0 @@
    19.4 -/*
    19.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    19.6 - *
    19.7 - * Copyright 2013 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 2013 Sun Microsystems, Inc.
   19.44 - */
   19.45 -
   19.46 -package org.netbeans.modules.dew4nb.services.project;
   19.47 -
   19.48 -import java.io.IOException;
   19.49 -import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
   19.50 -import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   19.51 -import org.netbeans.modules.dew4nb.endpoint.Status;
   19.52 -import org.netbeans.modules.dew4nb.services.javac.Context;
   19.53 -import org.netbeans.modules.dew4nb.services.javac.FileContentResult;
   19.54 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   19.55 -import org.netbeans.modules.dew4nb.services.javac.JavacModels;
   19.56 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   19.57 -import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   19.58 -import org.openide.filesystems.FileObject;
   19.59 -import org.openide.util.Lookup;
   19.60 -import org.openide.util.Parameters;
   19.61 -import org.openide.util.lookup.ServiceProvider;
   19.62 -
   19.63 -/**
   19.64 - *
   19.65 - * @author Tomas Zezula
   19.66 - */
   19.67 -@ServiceProvider(service = RequestHandler.class)
   19.68 -public class GetFileContentHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, FileContentResult>{
   19.69 -    public GetFileContentHandler() {
   19.70 -        super(JavacModels.END_POINT, JavacMessageType.getfile, JavacQuery.class, FileContentResult.class);
   19.71 -    }
   19.72 -
   19.73 -    @Override
   19.74 -    protected Status handle(JavacQuery request, FileContentResult response) {
   19.75 -        Parameters.notNull("request", request); //NOI18N
   19.76 -        Parameters.notNull("response", response);   //NOI18N
   19.77 -        final Context ctx = request.getContext();
   19.78 -        Status status = Status.done;
   19.79 -        if (ctx != null) {
   19.80 -            final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
   19.81 -            if(resolver == null) {
   19.82 -                throw new IllegalStateException("No WorkspaceResolver in Lookup");  //NOI18N
   19.83 -            }
   19.84 -            final FileObject fo = resolver.resolveFile(new WorkspaceResolver.Context(
   19.85 -                 ctx.getUser(),
   19.86 -                 ctx.getWorkspace(),
   19.87 -                 ctx.getPath()));
   19.88 -            if (fo != null) {
   19.89 -                try {
   19.90 -                    response.setContent(fo.asText("UTF-8"));
   19.91 -                } catch (IOException ex) {
   19.92 -                    status = Status.runtime_error;
   19.93 -                }
   19.94 -            } else {
   19.95 -                status = Status.not_found;
   19.96 -            }
   19.97 -        }
   19.98 -        return status;
   19.99 -    }
  19.100 -}
    20.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/project/IORedirectProvider.java	Tue Jan 28 13:57:53 2014 +0100
    20.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/IORedirectProvider.java	Tue Jan 28 21:59:12 2014 +0100
    20.3 @@ -43,7 +43,6 @@
    20.4  package org.netbeans.modules.dew4nb.services.project;
    20.5  
    20.6  import java.io.IOException;
    20.7 -import java.io.OutputStream;
    20.8  import java.io.PrintWriter;
    20.9  import java.io.Reader;
   20.10  import java.io.Writer;
   20.11 @@ -53,9 +52,6 @@
   20.12  import org.netbeans.api.annotations.common.NullAllowed;
   20.13  import org.netbeans.modules.dew4nb.endpoint.EndPoint;
   20.14  import org.netbeans.modules.dew4nb.endpoint.Status;
   20.15 -import org.netbeans.modules.dew4nb.services.javac.InvokeProjectActionResult;
   20.16 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
   20.17 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   20.18  import org.openide.util.Parameters;
   20.19  import org.openide.util.lookup.ServiceProvider;
   20.20  import org.openide.windows.IOProvider;
   20.21 @@ -308,7 +304,7 @@
   20.22              @NullAllowed final String stdOut,
   20.23              @NullAllowed final String stdErr) {
   20.24          Parameters.notNull("env", env); //NOI18N
   20.25 -        final JavacMessageType type = env.getProperty(PROP_TYPE, JavacMessageType.class);
   20.26 +        final ProjectMessageType type = env.getProperty(PROP_TYPE, ProjectMessageType.class);
   20.27          Parameters.notNull("type", type); //NOI18N
   20.28          final String state = env.getProperty(PROP_STATE, String.class);
   20.29          Parameters.notNull("state", state); //NOI18N
    21.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/project/InvokeProjectActionHandler.java	Tue Jan 28 13:57:53 2014 +0100
    21.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/InvokeProjectActionHandler.java	Tue Jan 28 21:59:12 2014 +0100
    21.3 @@ -46,13 +46,9 @@
    21.4  import org.netbeans.api.project.FileOwnerQuery;
    21.5  import org.netbeans.api.project.Project;
    21.6  import org.netbeans.modules.dew4nb.endpoint.AsyncRequestHandler;
    21.7 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    21.8  import org.netbeans.modules.dew4nb.endpoint.EndPoint;
    21.9  import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   21.10  import org.netbeans.modules.dew4nb.endpoint.Status;
   21.11 -import org.netbeans.modules.dew4nb.services.javac.Context;
   21.12 -import org.netbeans.modules.dew4nb.services.javac.JavacModels;
   21.13 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   21.14  import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   21.15  import org.netbeans.spi.project.ActionProvider;
   21.16  import org.openide.filesystems.FileObject;
   21.17 @@ -65,15 +61,15 @@
   21.18   * @author Tomas Zezula
   21.19   */
   21.20  @ServiceProvider(service = RequestHandler.class)
   21.21 -public class InvokeProjectActionHandler extends AsyncRequestHandler<JavacQuery, JavacMessageType> {
   21.22 +public class InvokeProjectActionHandler extends AsyncRequestHandler<ProjectAction, ProjectMessageType> {
   21.23  
   21.24      public InvokeProjectActionHandler() {
   21.25 -        super(JavacModels.END_POINT, JavacMessageType.invokeAction, JavacQuery.class);
   21.26 +        super(ProjectModels.END_POINT, ProjectMessageType.invokeAction, ProjectAction.class);
   21.27      }
   21.28  
   21.29      @Override
   21.30 -    protected Status handle(final JavacQuery request, final EndPoint.Env env) {
   21.31 -        if (request.getType() != JavacMessageType.invokeAction) {
   21.32 +    protected Status handle(final ProjectAction request, final EndPoint.Env env) {
   21.33 +        if (request.getType() != ProjectMessageType.invokeAction) {
   21.34              throw new IllegalStateException(String.format(
   21.35                  "Illegal message type: %s", //NOI18N
   21.36                  request.getType()));
   21.37 @@ -106,7 +102,7 @@
   21.38                              IORedirectProvider.bindEnv(env);
   21.39                              try {
   21.40                                  ap.invokeAction(
   21.41 -                                    request.getJava(),
   21.42 +                                    request.getAction(),
   21.43                                      Lookups.fixed(file, prj));
   21.44                              } finally {
   21.45                                  IORedirectProvider.unbindEnv();
    22.1 --- a/dew4nb/src/org/netbeans/modules/dew4nb/services/project/IsProjectActionEnabledHandler.java	Tue Jan 28 13:57:53 2014 +0100
    22.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/IsProjectActionEnabledHandler.java	Tue Jan 28 21:59:12 2014 +0100
    22.3 @@ -48,14 +48,9 @@
    22.4  import org.netbeans.api.annotations.common.NonNull;
    22.5  import org.netbeans.api.project.FileOwnerQuery;
    22.6  import org.netbeans.api.project.Project;
    22.7 -import org.netbeans.modules.dew4nb.services.javac.JavacMessageType;
    22.8  import org.netbeans.modules.dew4nb.endpoint.BasicRequestHandler;
    22.9  import org.netbeans.modules.dew4nb.endpoint.RequestHandler;
   22.10  import org.netbeans.modules.dew4nb.endpoint.Status;
   22.11 -import org.netbeans.modules.dew4nb.services.javac.Context;
   22.12 -import org.netbeans.modules.dew4nb.services.javac.IsProjectActionEnabledResult;
   22.13 -import org.netbeans.modules.dew4nb.services.javac.JavacModels;
   22.14 -import org.netbeans.modules.dew4nb.services.javac.JavacQuery;
   22.15  import org.netbeans.modules.dew4nb.spi.WorkspaceResolver;
   22.16  import org.netbeans.spi.project.ActionProvider;
   22.17  import org.openide.filesystems.FileObject;
   22.18 @@ -68,16 +63,16 @@
   22.19   * @author Tomas Zezula
   22.20   */
   22.21  @ServiceProvider(service = RequestHandler.class)
   22.22 -public class IsProjectActionEnabledHandler extends BasicRequestHandler<JavacQuery, JavacMessageType, IsProjectActionEnabledResult> {
   22.23 +public class IsProjectActionEnabledHandler extends BasicRequestHandler<ProjectAction, ProjectMessageType, IsProjectActionEnabledResult> {
   22.24  
   22.25      public IsProjectActionEnabledHandler() {
   22.26 -        super(JavacModels.END_POINT, JavacMessageType.isActionEnabled, JavacQuery.class, IsProjectActionEnabledResult.class);
   22.27 +        super(ProjectModels.END_POINT, ProjectMessageType.isActionEnabled, ProjectAction.class, IsProjectActionEnabledResult.class);
   22.28      }
   22.29  
   22.30      @Override
   22.31 -    protected Status handle(@NonNull final JavacQuery request, @NonNull final IsProjectActionEnabledResult response) {
   22.32 -        final JavacMessageType requestType = request.getType();
   22.33 -        if (requestType != JavacMessageType.isActionEnabled) {
   22.34 +    protected Status handle(@NonNull final ProjectAction request, @NonNull final IsProjectActionEnabledResult response) {
   22.35 +        final ProjectMessageType requestType = request.getType();
   22.36 +        if (requestType != ProjectMessageType.isActionEnabled) {
   22.37              throw new IllegalStateException(String.valueOf(requestType));
   22.38          }
   22.39          final WorkspaceResolver resolver = Lookup.getDefault().lookup(WorkspaceResolver.class);
   22.40 @@ -98,7 +93,7 @@
   22.41              if (p != null) {
   22.42                  final ActionProvider ap = p.getLookup().lookup(ActionProvider.class);
   22.43                  if (ap != null) {
   22.44 -                    final String commandName = request.getJava();
   22.45 +                    final String commandName = request.getAction();
   22.46                      if (commandName != null) {
   22.47                          final Collection<String> actions = new HashSet<>(Arrays.asList(ap.getSupportedActions()));
   22.48                          if (actions.contains(commandName)) {
   22.49 @@ -113,5 +108,4 @@
   22.50          response.setEnabled(enabled);
   22.51          return Status.done;
   22.52      }
   22.53 -
   22.54  }
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectEndPoint.java	Tue Jan 28 21:59:12 2014 +0100
    23.3 @@ -0,0 +1,66 @@
    23.4 +/*
    23.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    23.6 + *
    23.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
    23.8 + *
    23.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   23.10 + * Other names may be trademarks of their respective owners.
   23.11 + *
   23.12 + * The contents of this file are subject to the terms of either the GNU
   23.13 + * General Public License Version 2 only ("GPL") or the Common
   23.14 + * Development and Distribution License("CDDL") (collectively, the
   23.15 + * "License"). You may not use this file except in compliance with the
   23.16 + * License. You can obtain a copy of the License at
   23.17 + * http://www.netbeans.org/cddl-gplv2.html
   23.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   23.19 + * specific language governing permissions and limitations under the
   23.20 + * License.  When distributing the software, include this License Header
   23.21 + * Notice in each file and include the License file at
   23.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   23.23 + * particular file as subject to the "Classpath" exception as provided
   23.24 + * by Oracle in the GPL Version 2 section of the License file that
   23.25 + * accompanied this code. If applicable, add the following below the
   23.26 + * License Header, with the fields enclosed by brackets [] replaced by
   23.27 + * your own identifying information:
   23.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   23.29 + *
   23.30 + * If you wish your version of this file to be governed by only the CDDL
   23.31 + * or only the GPL Version 2, indicate your decision by adding
   23.32 + * "[Contributor] elects to include this software in this distribution
   23.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   23.34 + * single choice of license, a recipient has the option to distribute
   23.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   23.36 + * to extend the choice of license to its licensees as provided above.
   23.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   23.38 + * Version 2 license, then the option applies only if the new code is
   23.39 + * made subject to such option by the copyright holder.
   23.40 + *
   23.41 + * Contributor(s):
   23.42 + *
   23.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
   23.44 + */
   23.45 +
   23.46 +package org.netbeans.modules.dew4nb.services.project;
   23.47 +
   23.48 +import org.netbeans.api.annotations.common.NonNull;
   23.49 +import org.netbeans.modules.dew4nb.endpoint.EndPoint;
   23.50 +import org.openide.util.Parameters;
   23.51 +import org.openide.util.lookup.ServiceProvider;
   23.52 +
   23.53 +/**
   23.54 + *
   23.55 + * @author Tomas Zezula
   23.56 + */
   23.57 +@ServiceProvider(service = EndPoint.class)
   23.58 +public final class ProjectEndPoint extends EndPoint<ProjectAction, ProjectMessageType> {
   23.59 +
   23.60 +    public ProjectEndPoint() {
   23.61 +        super(ProjectModels.END_POINT, ProjectAction.class, ProjectMessageType.class);
   23.62 +    }    
   23.63 +
   23.64 +    @Override
   23.65 +    protected ProjectMessageType getRequestKind(@NonNull final ProjectAction query) {
   23.66 +        Parameters.notNull("query", query); //NOI18N
   23.67 +        return query.getType();
   23.68 +    }
   23.69 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectMessageType.java	Tue Jan 28 21:59:12 2014 +0100
    24.3 @@ -0,0 +1,52 @@
    24.4 +/*
    24.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    24.6 + *
    24.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
    24.8 + *
    24.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   24.10 + * Other names may be trademarks of their respective owners.
   24.11 + *
   24.12 + * The contents of this file are subject to the terms of either the GNU
   24.13 + * General Public License Version 2 only ("GPL") or the Common
   24.14 + * Development and Distribution License("CDDL") (collectively, the
   24.15 + * "License"). You may not use this file except in compliance with the
   24.16 + * License. You can obtain a copy of the License at
   24.17 + * http://www.netbeans.org/cddl-gplv2.html
   24.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   24.19 + * specific language governing permissions and limitations under the
   24.20 + * License.  When distributing the software, include this License Header
   24.21 + * Notice in each file and include the License file at
   24.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   24.23 + * particular file as subject to the "Classpath" exception as provided
   24.24 + * by Oracle in the GPL Version 2 section of the License file that
   24.25 + * accompanied this code. If applicable, add the following below the
   24.26 + * License Header, with the fields enclosed by brackets [] replaced by
   24.27 + * your own identifying information:
   24.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   24.29 + *
   24.30 + * If you wish your version of this file to be governed by only the CDDL
   24.31 + * or only the GPL Version 2, indicate your decision by adding
   24.32 + * "[Contributor] elects to include this software in this distribution
   24.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   24.34 + * single choice of license, a recipient has the option to distribute
   24.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   24.36 + * to extend the choice of license to its licensees as provided above.
   24.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   24.38 + * Version 2 license, then the option applies only if the new code is
   24.39 + * made subject to such option by the copyright holder.
   24.40 + *
   24.41 + * Contributor(s):
   24.42 + *
   24.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
   24.44 + */
   24.45 +
   24.46 +package org.netbeans.modules.dew4nb.services.project;
   24.47 +
   24.48 +/**
   24.49 + *
   24.50 + * @author Tomas Zezula
   24.51 + */
   24.52 +public enum ProjectMessageType {
   24.53 +    isActionEnabled,
   24.54 +    invokeAction
   24.55 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/dew4nb/src/org/netbeans/modules/dew4nb/services/project/ProjectModels.java	Tue Jan 28 21:59:12 2014 +0100
    25.3 @@ -0,0 +1,95 @@
    25.4 +/*
    25.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    25.6 + *
    25.7 + * Copyright 2014 Oracle and/or its affiliates. All rights reserved.
    25.8 + *
    25.9 + * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
   25.10 + * Other names may be trademarks of their respective owners.
   25.11 + *
   25.12 + * The contents of this file are subject to the terms of either the GNU
   25.13 + * General Public License Version 2 only ("GPL") or the Common
   25.14 + * Development and Distribution License("CDDL") (collectively, the
   25.15 + * "License"). You may not use this file except in compliance with the
   25.16 + * License. You can obtain a copy of the License at
   25.17 + * http://www.netbeans.org/cddl-gplv2.html
   25.18 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
   25.19 + * specific language governing permissions and limitations under the
   25.20 + * License.  When distributing the software, include this License Header
   25.21 + * Notice in each file and include the License file at
   25.22 + * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
   25.23 + * particular file as subject to the "Classpath" exception as provided
   25.24 + * by Oracle in the GPL Version 2 section of the License file that
   25.25 + * accompanied this code. If applicable, add the following below the
   25.26 + * License Header, with the fields enclosed by brackets [] replaced by
   25.27 + * your own identifying information:
   25.28 + * "Portions Copyrighted [year] [name of copyright owner]"
   25.29 + *
   25.30 + * If you wish your version of this file to be governed by only the CDDL
   25.31 + * or only the GPL Version 2, indicate your decision by adding
   25.32 + * "[Contributor] elects to include this software in this distribution
   25.33 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
   25.34 + * single choice of license, a recipient has the option to distribute
   25.35 + * your version of this file under either the CDDL, the GPL Version 2 or
   25.36 + * to extend the choice of license to its licensees as provided above.
   25.37 + * However, if you add GPL Version 2 code and therefore, elected the GPL
   25.38 + * Version 2 license, then the option applies only if the new code is
   25.39 + * made subject to such option by the copyright holder.
   25.40 + *
   25.41 + * Contributor(s):
   25.42 + *
   25.43 + * Portions Copyrighted 2014 Sun Microsystems, Inc.
   25.44 + */
   25.45 +
   25.46 +package org.netbeans.modules.dew4nb.services.project;
   25.47 +
   25.48 +import net.java.html.json.Model;
   25.49 +import net.java.html.json.Property;
   25.50 +import org.netbeans.modules.dew4nb.endpoint.Status;
   25.51 +
   25.52 +/**
   25.53 + *
   25.54 + * @author Tomas Zezula
   25.55 + */
   25.56 +class ProjectModels {
   25.57 +
   25.58 +    static final String END_POINT = "project";  //NO_I18N
   25.59 +
   25.60 +    @Model(className = "ProjectAction", properties = {
   25.61 +        @Property(name = "type", type = ProjectMessageType.class),
   25.62 +        @Property(name = "state", type = String.class),
   25.63 +        @Property(name = "context", type = Context.class),
   25.64 +        @Property(name = "action", type = String.class),
   25.65 +    })
   25.66 +    static final class ProjectActionModel {
   25.67 +    }
   25.68 +
   25.69 +
   25.70 +    @Model(className="IsProjectActionEnabledResult", properties = {
   25.71 +        @Property(name = "status", type = Status.class),
   25.72 +        @Property(name = "type", type = ProjectMessageType.class),
   25.73 +        @Property(name = "state", type = String.class),
   25.74 +        @Property(name = "enabled", type = Boolean.class)
   25.75 +    })
   25.76 +    static final class IsProjectActionEnabledResultModel {
   25.77 +    }
   25.78 +
   25.79 +    @Model(className = "InvokeProjectActionResult", properties = {
   25.80 +        @Property(name = "status", type = Status.class),
   25.81 +        @Property(name = "type", type = ProjectMessageType.class),
   25.82 +        @Property(name = "state", type = String.class),
   25.83 +        @Property(name = "result", type = BuildResult.class),
   25.84 +        @Property(name = "stdout", type = String.class, array = true),
   25.85 +        @Property(name = "stderr", type = String.class, array = true),
   25.86 +        @Property(name = "openUrl", type = String.class, array = true)
   25.87 +    })
   25.88 +    static final class InvokeProjectActionResultModel {
   25.89 +    }
   25.90 +
   25.91 +    @Model(className = "Context", properties = {
   25.92 +        @Property(name="user", type=String.class),
   25.93 +        @Property(name = "workspace", type = String.class),
   25.94 +        @Property(name = "path", type = String.class)
   25.95 +    })
   25.96 +    static final class ContextModel {
   25.97 +    }
   25.98 +}