-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#96 Introduce InitializeClientSessionAction
Also: - Use new clientProxy provider instead of deriving the proxy from the client id. - Fix/Surpress a couple of warnings - Sort members of MultiBindingDefaults Follow up for eclipse-glsp/glsp/issues/96
- Loading branch information
Showing
10 changed files
with
152 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
....eclipse.glsp.api/src/org/eclipse/glsp/api/action/kind/InitializeClientSessionAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2020 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
package org.eclipse.glsp.api.action.kind; | ||
|
||
import org.eclipse.glsp.api.action.Action; | ||
|
||
public class InitializeClientSessionAction extends Action { | ||
|
||
private String clientId; | ||
|
||
public InitializeClientSessionAction() { | ||
super(Action.Kind.INITIALIZE_CLIENT_SESSION); | ||
} | ||
|
||
public InitializeClientSessionAction(final String clientId) { | ||
this(); | ||
this.clientId = clientId; | ||
} | ||
|
||
public String getClientId() { return clientId; } | ||
|
||
public void setClientId(final String clientId) { this.clientId = clientId; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...erver/src/org/eclipse/glsp/server/actionhandler/InitializeClientSessionActionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2020 EclipseSource and others. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License v. 2.0 which is available at | ||
* https://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* This Source Code may also be made available under the following Secondary | ||
* Licenses when the conditions for such availability set forth in the Eclipse | ||
* Public License v. 2.0 are satisfied: GNU General Public License, version 2 | ||
* with the GNU Classpath Exception which is available at | ||
* https://www.gnu.org/software/classpath/license.html. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 | ||
********************************************************************************/ | ||
package org.eclipse.glsp.server.actionhandler; | ||
|
||
import java.util.List; | ||
|
||
import org.eclipse.glsp.api.action.Action; | ||
import org.eclipse.glsp.api.action.kind.InitializeClientSessionAction; | ||
import org.eclipse.glsp.api.model.GraphicalModelState; | ||
import org.eclipse.glsp.api.protocol.ClientSessionManager; | ||
import org.eclipse.glsp.api.protocol.GLSPClient; | ||
import org.eclipse.glsp.api.protocol.GLSPServerException; | ||
|
||
import com.google.inject.Inject; | ||
import com.google.inject.Provider; | ||
|
||
public class InitializeClientSessionActionHandler extends BasicActionHandler<InitializeClientSessionAction> { | ||
|
||
@Inject | ||
protected ClientSessionManager clientSessionManager; | ||
|
||
@Inject | ||
protected Provider<GLSPClient> client; | ||
|
||
@Override | ||
protected List<Action> executeAction(final InitializeClientSessionAction action, | ||
final GraphicalModelState modelState) { | ||
if (clientSessionManager.createClientSession(client.get(), action.getClientId())) { | ||
modelState.setClientId(action.getClientId()); | ||
} else { | ||
throw new GLSPServerException(String.format( | ||
"Could not create session for client id '%s'. Another session with the same id already exists", | ||
action.getClientId())); | ||
} | ||
return none(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters