Skip to content
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

GLSP-211 Fix typos in new Edge Checker API #215

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
import org.eclipse.glsp.server.features.sourcemodelwatcher.SourceModelWatcher;
import org.eclipse.glsp.server.features.toolpalette.ToolPaletteItemProvider;
import org.eclipse.glsp.server.features.typehints.EdgeCreationChecker;
import org.eclipse.glsp.server.features.typehints.RequestCheckEdgeTargetActionHandler;
import org.eclipse.glsp.server.features.typehints.RequestCheckEdgeActionHandler;
import org.eclipse.glsp.server.features.typehints.RequestTypeHintsActionHandler;
import org.eclipse.glsp.server.features.undoredo.UndoRedoActionHandler;
import org.eclipse.glsp.server.features.validation.ModelValidator;
Expand Down Expand Up @@ -275,7 +275,7 @@ protected void configureActionHandlers(final MultiBinding<ActionHandler> binding
binding.add(ComputedBoundsActionHandler.class);
binding.add(SaveModelActionHandler.class);
binding.add(UndoRedoActionHandler.class);
binding.add(RequestCheckEdgeTargetActionHandler.class);
binding.add(RequestCheckEdgeActionHandler.class);
}

protected Class<? extends ActionHandlerRegistry> bindActionHandlerRegistry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
* {@link EdgeTypeHint}s.
* A dynamic edge type hint is used for cases where a plain list of allowed source and target element ids is not enough
* to determine
* wether an edge beeing created is valid. In this cases the client will query the server to determine wether the edge
* wether an edge being created is valid. In this cases the client will query the server to determine wether the edge
* is valid.
* The `EdegeCreationChecker` then checks the given edge information and returns wether the edge beeing created is
* The `EdgeCreationChecker` then checks the given edge information and returns wether the edge being created is
* valid.
*/
public interface EdgeCreationChecker {
/**
* Checks wether the given source element for an edge beeing created is valid i.e. if the
* given source is and allowed source element for the given edge type.
* given source is an allowed source element for the given edge type.
*
* @return `true` if the edge source is valid, `false` otherwise
*/
boolean isValidSource(String edgeType, GModelElement sourceElement);

/**
* Checks wether the given information for an edge beeing created is valid i.e. if the
* given target is an allowed target for the given source and edge type.
* given target is an allowed target element for the given source and edge type.
*
* @return `true` if the edge target is valid, `false` otherwise
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
* Returns a valid {@link CheckEdgeResultAction} if no edge creation checker is bound or the type hint associated with
* the given edge information is not dynamic.
*/
public class RequestCheckEdgeTargetActionHandler extends AbstractActionHandler<RequestCheckEdgeAction> {
public class RequestCheckEdgeActionHandler extends AbstractActionHandler<RequestCheckEdgeAction> {

@Inject
protected Optional<EdgeCreationChecker> edgeTargetChecker;
protected Optional<EdgeCreationChecker> edgeCreationChecker;

@Inject
protected DiagramConfiguration diagramConfiguration;
Expand All @@ -54,7 +54,7 @@ protected List<Action> executeAction(final RequestCheckEdgeAction action) {
.filter(hint -> hint.getElementTypeId().equals(action.getEdgeType()) && hint.isDynamic()).findAny()
.isPresent();

if (!edgeTargetChecker.isPresent() || !hasDynamicHint) {
if (!edgeCreationChecker.isPresent() || !hasDynamicHint) {
return listOf(new CheckEdgeResultAction(true, action));
}
return listOf(new CheckEdgeResultAction(validate(action), action));
Expand All @@ -73,8 +73,8 @@ protected boolean validate(final RequestCheckEdgeAction action) {
+ action.getTargetElementId().get());
}
return targetElement.isPresent()
? edgeTargetChecker.get().isValidTarget(action.getEdgeType(), sourceElement, targetElement.get())
: edgeTargetChecker.get().isValidSource(action.getEdgeType(), sourceElement);
? edgeCreationChecker.get().isValidTarget(action.getEdgeType(), sourceElement, targetElement.get())
: edgeCreationChecker.get().isValidSource(action.getEdgeType(), sourceElement);

}

Expand Down