GP-5296 added help links for function graph layout actions

This commit is contained in:
ghidragon 2025-01-24 11:31:19 -05:00
parent 0844ff6cca
commit a9f8fc7c26
9 changed files with 73 additions and 13 deletions

View file

@ -58,7 +58,19 @@
</BLOCKQUOTE>
</BLOCKQUOTE>
<H2><A name="Flow_Chart_Layout"></A>Flow Chart Layout</H2>
<blockquote>
<P>This layout organizes the code blocks into a tree structure with each parent vertex in the
tree being centered over its children. Edges are routed orthongally with minimal edge
crossings.</P>
</blockquote>
<H2><A name="Flow_Chart_Layout_Left"></A>Flow Chart Layout (Left)</H2>
<blockquote>
<P>This layout is the same as the Flow Chart Layout, except parent nodes are place directly
above their left most child.</P>
</blockquote>
</BLOCKQUOTE>
<P class="providedbyplugin">Provided by: <I>Function Graph Plugin</I></P>
<BR>

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -911,13 +911,11 @@ class FGActionManager {
private List<ActionState<FGLayoutProvider>> createActionStates(
List<FGLayoutProvider> layoutProviders) {
List<ActionState<FGLayoutProvider>> list = new ArrayList<>();
HelpLocation layoutHelpLocation =
new HelpLocation("FunctionGraphPlugin", "Function_Graph_Action_Layout");
for (FGLayoutProvider layout : layoutProviders) {
ActionState<FGLayoutProvider> layoutState =
new ActionState<>(layout.getLayoutName(), layout.getActionIcon(), layout);
layoutState.setHelpLocation(layoutHelpLocation);
layoutState.setHelpLocation(layout.getHelpLocation());
list.add(layoutState);
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -20,6 +20,7 @@ import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.vertex.FGVertex;
import ghidra.framework.options.Options;
import ghidra.graph.viewer.layout.LayoutProvider;
import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@ -44,4 +45,13 @@ public abstract class FGLayoutProvider implements LayoutProvider<FGVertex, FGEdg
public FGLayoutOptions createLayoutOptions(Options options) {
return null;
}
/**
* Returns the help location for this layout. Subclasses should override this method to give
* specific help for the graph layout performed by this provider.
* @return the help location for this layout
*/
public HelpLocation getHelpLocation() {
return new HelpLocation("FunctionGraphPlugin", "Function_Graph_Action_Layout");
}
}

View file

@ -21,6 +21,7 @@ import generic.theme.GIcon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProviderExtensionPoint;
import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@ -51,4 +52,9 @@ public class FlowChartLayoutProvider extends FGLayoutProviderExtensionPoint {
return new FGFlowChartLayout(graph, false);
}
@Override
public HelpLocation getHelpLocation() {
return new HelpLocation("FunctionGraphPlugin", "Flow_Chart_Layout");
}
}

View file

@ -21,6 +21,7 @@ import generic.theme.GIcon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProviderExtensionPoint;
import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@ -51,4 +52,8 @@ public class LeftAlignedFlowChartLayoutProvider extends FGLayoutProviderExtensio
return new FGFlowChartLayout(graph, true);
}
@Override
public HelpLocation getHelpLocation() {
return new HelpLocation("FunctionGraphPlugin", "Flow_Chart_Layout_Left");
}
}

View file

@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -20,6 +20,7 @@ import javax.swing.Icon;
import ghidra.app.plugin.core.functiongraph.graph.FunctionGraph;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayout;
import ghidra.app.plugin.core.functiongraph.graph.layout.FGLayoutProvider;
import ghidra.util.HelpLocation;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@ -27,6 +28,9 @@ import ghidra.util.task.TaskMonitor;
* A layout provider that allows us to specify a Jung layout by name.
*/
public class JgtNamedLayoutProvider extends FGLayoutProvider {
// layout algorithm categories
static final String MIN_CROSS = "Hierarchical MinCross";
static final String VERT_MIN_CROSS = "Vertical Hierarchical MinCross";
private String layoutName;
@ -62,4 +66,17 @@ public class JgtNamedLayoutProvider extends FGLayoutProvider {
public String toString() {
return layoutName;
}
@Override
public HelpLocation getHelpLocation() {
// condense hierarchical action help to the top-level help description
String anchor = layoutName;
if (layoutName.contains(VERT_MIN_CROSS)) {
anchor = VERT_MIN_CROSS;
}
else if (layoutName.contains(MIN_CROSS)) {
anchor = MIN_CROSS;
}
return new HelpLocation("GraphServices", anchor);
}
}

View file

@ -30,6 +30,7 @@ import ghidra.graph.VisualGraph;
import ghidra.graph.viewer.layout.*;
import ghidra.graph.viewer.vertex.VisualGraphVertexShapeTransformer;
import ghidra.program.model.address.Address;
import ghidra.util.HelpLocation;
import ghidra.util.Msg;
import ghidra.util.exception.CancelledException;
import ghidra.util.task.TaskMonitor;
@ -374,4 +375,9 @@ public class TestFGLayoutProvider extends FGLayoutProvider {
//@formatter:on
}
}
@Override
public HelpLocation getHelpLocation() {
return null;
}
}