eclipse-glsp / glsp-server Goto Github PK
View Code? Open in Web Editor NEWJava-based server framework of the graphical language server platform
Home Page: https://www.eclipse.dev/glsp
License: Other
Java-based server framework of the graphical language server platform
Home Page: https://www.eclipse.dev/glsp
License: Other
Add a reusable Adapter implementation that attaches an generated (GModelId) to an EObject.
We already use a similar approach in a couple of projects so extracting a common reusable component should be easy
Should build every PR and report back to Github.
Deploy step should only be initiated on master (can be mocked for now, actual deploy will be handled in a follow up issue)
In the fix for #36 we mark a model as dirty as soon as an executeOperation_* is sent to the server. However, this is not a very reliable mechanism. Without having thought this through entirely, imho, the server needs to decide whether a model is dirty or not; eventually, the server decides which action is actually performed or not, isn't it?
[migrated from https://github.com/eclipsesource/graphical-lsp/issues/62]
Currently, the OperationActionHandler
handles operation actions in the following way:
@Override
public Optional<Action> execute(Action action, GraphicalModelState modelState) {
switch (action.getKind()) {
case Action.Kind.CREATE_NODE_OPERATION:
case Action.Kind.CREATE_CONNECTION_OPERATION:
case Action.Kind.RECONNECT_CONNECTION_OPERATION:
case Action.Kind.REROUTE_CONNECTION_OPERATION:
case Action.Kind.DELETE_ELEMENT_OPERATION:
case Action.Kind.CHANGE_BOUNDS_OPERATION:
case Action.Kind.APPLY_LABEL_EDIT_OPERATION:
return doHandle((AbstractOperationAction) action, modelState);
default:
return Optional.empty();
}
}
That means, if users would like to add custom operation actions, they'll have to overwrite the OperationActionHandler
and add their new action kind in the check above. This is unexpected and also unnecessary. We could do the following instead:
@Override
public Optional<Action> execute(final Action action, final GraphicalModelState modelState) {
if (action instanceof AbstractOperationAction && operationHandlerProvider.isHandled((AbstractOperationAction)action)) {
return doHandle((AbstractOperationAction)action, modelState);
}
return Optional.empty();
}
Since we are using hash sets, the order of items in the command palette sent from the server to the client is random, which not only prevents the server from defining a certain order, but also lets the order be different everytime the client requests a new set of elements.
I'd find it more convenient to register actions as a collection of classes instead of injecting a provider class, similar to how we register action handlers. If an implementer wants to customize the available actions, it needs to copy the entire list of actions instead of being able to get the default ones and remove the ones it needs and adding the additional ones.
For handlers, we can do it as follows:
final Collection<Class<? extends ActionHandler>> defaultHandlers = super.bindActionHandlers();
// remove bindings that we are about to overwrite or don't need
defaultHandlers.remove(OperationActionHandler.class);
defaultHandlers.remove(SaveModelActionHandler.class);
defaultHandlers.remove(UndoRedoActionHandler.class);
// custom handlers
defaultHandlers.add(MyOperationActionHandler.class);
For actions, we need to create a class that returns a list instead.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.