Skip to content

Commit

Permalink
Clear workflow error highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
glopesdev committed Sep 3, 2024
1 parent 96f9119 commit 24dbff3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
19 changes: 14 additions & 5 deletions Bonsai.Editor/EditorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1355,10 +1355,7 @@ void ClearWorkflowError()
{
if (workflowError != null)
{
statusStrip.ContextMenuStrip = null;
statusTextLabel.Text = Resources.ReadyStatus;
statusImageLabel.Image = Resources.StatusReadyImage;
explorerTreeView.SetNodeStatus(ExplorerNodeStatus.Ready);
ClearExceptionBuilderNode(workflowError);
}

exceptionCache.Clear();
Expand All @@ -1373,6 +1370,18 @@ void HighlightWorkflowError()
}
}

void ClearExceptionBuilderNode(WorkflowException ex)
{
var workflowPath = WorkflowEditorPath.GetExceptionPath(workflowBuilder, ex);
var selectedView = selectionModel.SelectedView;
selectedView.ClearGraphNode(workflowPath);

statusStrip.ContextMenuStrip = null;
statusTextLabel.Text = Resources.ReadyStatus;
statusImageLabel.Image = Resources.StatusReadyImage;
explorerTreeView.SetNodeStatus(ExplorerNodeStatus.Ready);
}

void HighlightExceptionBuilderNode(WorkflowException ex, bool showMessageBox)
{
var workflowPath = WorkflowEditorPath.GetExceptionPath(workflowBuilder, ex);
Expand All @@ -1381,13 +1390,13 @@ void HighlightExceptionBuilderNode(WorkflowException ex, bool showMessageBox)
selectedView.HighlightGraphNode(workflowPath, showMessageBox);

var buildException = ex is WorkflowBuildException;
var errorCaption = buildException ? Resources.BuildError_Caption : Resources.RuntimeError_Caption;
statusTextLabel.Text = ex.Message;
statusStrip.ContextMenuStrip = statusContextMenuStrip;
statusImageLabel.Image = buildException ? Resources.StatusBlockedImage : Resources.StatusCriticalImage;
explorerTreeView.SetNodeStatus(pathElements, ExplorerNodeStatus.Blocked);
if (showMessageBox)
{
var errorCaption = buildException ? Resources.BuildError_Caption : Resources.RuntimeError_Caption;
editorSite.ShowError(ex.Message, errorCaption);
}
}
Expand Down
12 changes: 11 additions & 1 deletion Bonsai.Editor/GraphView/WorkflowGraphView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,17 @@ internal void SelectGraphNode(GraphNode node)
UpdateSelection();
}

internal void ClearGraphNode(WorkflowEditorPath path)
{
SetGraphNodeHighlight(path, false, false);
}

internal void HighlightGraphNode(WorkflowEditorPath path, bool selectNode)
{
SetGraphNodeHighlight(path, selectNode, true);
}

private void SetGraphNodeHighlight(WorkflowEditorPath path, bool selectNode, bool highlight)
{
if (selectNode)
WorkflowPath = path?.Parent;
Expand All @@ -291,7 +301,7 @@ internal void HighlightGraphNode(WorkflowEditorPath path, bool selectNode)

GraphView.Invalidate(graphNode);
if (selectNode) GraphView.SelectedNode = graphNode;
graphNode.Highlight = true;
graphNode.Highlight = highlight;
break;
}

Expand Down

0 comments on commit 24dbff3

Please sign in to comment.