Skip to content

Commit

Permalink
GLSP-211 Fix typos in new Edge Checker API
Browse files Browse the repository at this point in the history
  • Loading branch information
tortmayr committed Sep 26, 2023
1 parent de374b8 commit da96ba6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
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

0 comments on commit da96ba6

Please sign in to comment.