Skip to content

Commit

Permalink
Fix workflow documentation navigation example
Browse files Browse the repository at this point in the history
Update the NodeDocumentationNavigationTargetProvider to not rely on the tasks name which is currently unreliable (see eclipse-glsp/glsp#1351) and instead relies on the `text` property of the tasks label.
  • Loading branch information
tortmayr committed Jun 24, 2024
1 parent e1fdc7a commit 7cb49fc
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.util.Set;

import org.eclipse.glsp.example.workflow.wfgraph.TaskNode;
import org.eclipse.glsp.graph.GLabel;
import org.eclipse.glsp.server.features.navigation.NavigationTarget;
import org.eclipse.glsp.server.features.navigation.NavigationTargetResolution;
import org.eclipse.glsp.server.features.navigation.NavigationTargetResolver;
Expand All @@ -36,7 +37,8 @@ public NavigationTargetResolution resolve(final NavigationTarget navigationTarge
if (navigationTarget.getArgs().containsKey("name")) {
String name = navigationTarget.getArgs().get("name");
Set<TaskNode> taskNodes = modelState.getIndex().findAll(modelState.getRoot(), TaskNode.class);
Optional<TaskNode> element = taskNodes.stream().filter(node -> name.equals(node.getName())).findFirst();
Optional<TaskNode> element = taskNodes.stream().filter(node -> node.getChildren().stream()
.anyMatch(child -> child instanceof GLabel && ((GLabel) child).getText().equals("Push"))).findFirst();
if (element.isPresent()) {
return new NavigationTargetResolution(Arrays.asList(element.get().getId()));
}
Expand Down

0 comments on commit 7cb49fc

Please sign in to comment.