-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
211: Revise TypeHints and server side feedback for creation actions #210
Conversation
7b1a160
to
bdff55f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @CamilleLetavernier.
I only had time to do a preliminary code review for now, but I will also test the changes later today
...org.eclipse.glsp.server/src/org/eclipse/glsp/server/actions/CheckEdgeTargetResultAction.java
Outdated
Show resolved
Hide resolved
...p.server/src/org/eclipse/glsp/server/diagram/DefaultRequestTargetTypeHintsActionHandler.java
Outdated
Show resolved
Hide resolved
Thanks, |
No, that's fine. The Line 193 in a48db75
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the issues @CamilleLetavernier. In general the change looks good to me.
However, currently it's not really possible to test this change without further modifications.
Maybe we could provide a simple custom RequestTargetTypeHintsActionHandler
for the workflow example? For instance we could make the type hints for weighted edges
dynamic and check on the server side whether the target is valid (I.e. source is a decision node, target is a task or fork/join node)
Also I'm not the biggest fan of having default no-op RequestTargetTypeHintsActionHandler
that needs to be rebind by adopters. Maybe we could use a generic action handler that delegates to an optional injected service? Similar to how we handle e.g. RequestModelActions
, ReuestMarkersAction
, LayoutOperation
etc.
We could introduce a EdgeTargetValidator
service that can be bound by adopters, and the handler for the RequestCheckEdgeTargetAction
simply delegates to the validator (if bound)
@planger WDYT?
...pse.glsp.server/src/org/eclipse/glsp/server/diagram/RequestTargetTypeHintsActionHandler.java
Outdated
Show resolved
Hide resolved
plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/types/EdgeTypeHint.java
Show resolved
Hide resolved
...rg.eclipse.glsp.server/src/org/eclipse/glsp/server/actions/RequestCheckEdgeTargetAction.java
Outdated
Show resolved
Hide resolved
...org.eclipse.glsp.server/src/org/eclipse/glsp/server/actions/CheckEdgeTargetResultAction.java
Outdated
Show resolved
Hide resolved
Yes that would be better. Having to rebind a no-op is very implicit, being able to overwrite an empty method in the abstract class is more explicit. Our credo was always to have abstract methods for the mandatory implementations an adopter need to deliver, and the they can press Ctrl+space in their module and see what other optional implementations they can provide. In any case, I would try to avoid the term "validator" and rather use "check" or so, to avoid confusing this concept with the model validation. |
- Add a new parameter to EdgeTypeHint, 'dynamic', indicating that new edges need to check with the server before allowing creation - Make source/target element type ids in `EdgeTypeHint` optional If not defined, all potential element types are considered to be valid sources/targets - Add `RequestEdgeCheckAction` and `EdgeCheckResultAction` response to implement the dynamic check - Add a optional `EdegeCreationchecker` component that can be implemented by adopters to provide dynamic typehints - Adapt workflow example to use dynamic edge hints for weighted edges - Move typehints related components into feature subpackage - Move progress actions into progress feature subpackage Co-authored-by: Camille Letavernier <[email protected] >
d96c242
to
b2cb25f
Compare
@martin-fleck-at I have taken over this draft from Camille and have finalized the PR. Could you please have a look at it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me on a high level. I just have some minor concerns regarding documentation and default values. Thank you!
Btw, is there a plan to also adapt this in the Node server?
...eclipse.glsp.server/src/org/eclipse/glsp/server/features/typehints/EdegeCreationChecker.java
Outdated
Show resolved
Hide resolved
...rver/src/org/eclipse/glsp/server/features/typehints/RequestCheckEdgeTargetActionHandler.java
Outdated
Show resolved
Hide resolved
...rver/src/org/eclipse/glsp/server/features/typehints/RequestCheckEdgeTargetActionHandler.java
Outdated
Show resolved
Hide resolved
...lsp.server/src/org/eclipse/glsp/server/features/typehints/RequestTypeHintsActionHandler.java
Outdated
Show resolved
Hide resolved
....glsp.server/src/org/eclipse/glsp/server/features/typehints/CheckEdgeTargetResultAction.java
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
edges need to check with the server before allowing creation
EdgeTypeHint
optionalIf not defined, all potential element types are considered to be valid sources/targets
RequestEdgeCheckAction
andEdgeCheckResultAction
response to implementthe dynamic check
EdegeCreationchecker
component that can be implemented by adopters to provide dynamic typehintsCo-authored-by: Camille Letavernier <[email protected] >