Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
tortmayr committed Sep 16, 2021
1 parent a0d82f2 commit 1cf2bee
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.eclipse.glsp.server.actions.SetViewportAction;
import org.eclipse.glsp.server.actions.TriggerEdgeCreationAction;
import org.eclipse.glsp.server.actions.TriggerNodeCreationAction;
import org.eclipse.glsp.server.di.scope.DiagramGlobal;
import org.eclipse.glsp.server.di.scope.DiagramGlobalScope;
import org.eclipse.glsp.server.di.scope.DiagramGlobalSingleton;
import org.eclipse.glsp.server.diagram.DiagramConfiguration;
import org.eclipse.glsp.server.diagram.RequestTypeHintsActionHandler;
import org.eclipse.glsp.server.diagram.ServerConfigurationContribution;
Expand Down Expand Up @@ -117,7 +117,7 @@
* <ul>
* <li>{@link String} annotated with @{@link DiagramType}
* <li>{@link String} annotated with @{@link ClientId}
* <li>{@link DiagramGlobal} bound as Scope
* <li>{@link DiagramGlobalSingleton} bound as Scope
* <li>{@link DiagramConfiguration}
* <li>{@link ServerConfigurationContribution}
* <li>{@link GModelState}
Expand Down Expand Up @@ -163,7 +163,7 @@ protected void configureBase() {
bindClientId();
bindDiagramGobalScope();
// Configurations
bind(DiagramConfiguration.class).to(bindDiagramConfiguration()).in(DiagramGlobal.class);
bind(DiagramConfiguration.class).to(bindDiagramConfiguration()).in(DiagramGlobalSingleton.class);
bind(ServerConfigurationContribution.class).to(bindServerConfigurationContribution()).in(Singleton.class);
// Model-related bindings
bind(GModelState.class).to(bindGModelState()).in(Singleton.class);
Expand Down Expand Up @@ -205,7 +205,6 @@ protected void configureBase() {
bindOptionally(PopupModelFactory.class, bindPopupModelFactory());
bindOptionally(LayoutEngine.class, bindLayoutEngine());
bindOptionally(GraphExtension.class, bindGraphExtension());

}

protected void bindDiagramType() {
Expand All @@ -217,7 +216,7 @@ protected void bindClientId() {
}

protected void bindDiagramGobalScope() {
bindScope(DiagramGlobal.class, new DiagramGlobalScope.NullImpl());
bindScope(DiagramGlobalSingleton.class, new DiagramGlobalScope.NullImpl());
}

protected abstract Class<? extends DiagramConfiguration> bindDiagramConfiguration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
* The server module is the central configuration artifact for configuring the server injector (i.e. main injector). For
* each application connecting to the server process a new server injector is created. The server module provides the
* base bindings necessary for setting up the base {@link GLSPServer} infrastructure. In addition, it is used to
* configure the set of {@link DiagramModule}s. Diagram modules are used to create the diagram session specific child
* configure the set of {@link DiagramModule}s. Diagram modules are used to create the diagram-session-specific child
* injector when the
* {@link GLSPServer#initializeClientSession(org.eclipse.glsp.server.protocol.InitializeClientSessionParameters)}
* method is called.
*
* All bindings inside of the {@link ServerModule#configure()} method are encapsulated into submethods which makes it
* All bindings inside of the {@link ServerModule#configure()} method are delegated to separate methods which makes it
* easy to override a specific binding in subclasses.
*
* p>The following bindings are provided:
Expand All @@ -71,7 +71,7 @@ public class ServerModule extends GLSPModule {

/**
* Configure a new {@link DiagramModule} for this server. A diagram module represents the base configuration artifact
* for configuring a diagram-language specific client session injector. The diagram type provided
* for configuring a diagram-language-specific client session injector. The diagram type provided
* {@link DiagramModule#getDiagramType()} is used to retrieve the correct diagram module when the {@link GLSPServer}
* initialises a new client session.
* The given diagram module and all (optional) additional modules will be combined to one merged module. If bindings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* A {@link Scope} implementation that is used in GLSP for sharing instances across multiple diagram injectors of the
* same diagram type. A diagram injector is an injector with an installed {@link DiagramModule}. The
* {@link DiagramGlobal} annotation is used to annotated bindings that should be made available to all injectors with
* {@link DiagramGlobalSingleton} annotation is used to annotated bindings that should be made available to all injectors with
* the same diagram type as Singleton.
*
* Use this scope with care. If its used on classes that inject session specific values (e.g. the clientId) it can cause
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ public DiagramGlobalScopeModule(final DiagramGlobalScope scope) {

@Override
protected void configure() {
bindScope(DiagramGlobal.class, scope);
bindScope(DiagramGlobalSingleton.class, scope);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

/**
*
* Custom scope annotation that is used to declare bindings as diagram global. Diagram global means that one instance of
* Scope annotation to declare bindings as diagram global singleton. Diagram global singleton means that one instance of
* this class is shared across all related injectors of the same diagram type. This is used to declare diagram type
* specific singletons across all diagram session injectors (i.e. child injectors) of one GLSP server (injector).
*
*/
@Target({ TYPE, METHOD })
@Retention(RUNTIME)
@ScopeAnnotation
public @interface DiagramGlobal {}
public @interface DiagramGlobalSingleton {}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,8 @@
import org.eclipse.glsp.server.di.ClientId;
import org.eclipse.glsp.server.internal.gmodel.commandstack.GModelCommandStack;

import com.google.inject.Inject;

public class DefaultGModelState implements GModelState {

@Inject()
@ClientId
protected String clientId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ public final class ModuleUtil {
private ModuleUtil() {}

/**
* Mixin additional modules into a base modules. Bindings that are already present in the base module will be
* Mix in additional modules into a base modules. Bindings that are already present in the base module will be
* overwritten with the binding of the additional module.
*
* @param baseModule the base module.
* @param additionalModules the additional modules
* @return A merged (mixedin) module
*/
public static Module mixin(Module baseModule, final Module... additionalModules) {

for (Module additionalModule : additionalModules) {
baseModule = Modules.override(baseModule).with(additionalModule);
}
Expand Down

0 comments on commit 1cf2bee

Please sign in to comment.