diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/parallel/ParallelDecompiler.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/parallel/ParallelDecompiler.java index a569fa2293..ac8a5dcbe4 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/parallel/ParallelDecompiler.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/parallel/ParallelDecompiler.java @@ -110,7 +110,7 @@ public class ParallelDecompiler { * @param monitor the monitor used to report progress and to cancel * @return the parallel decompiler used for decompiling. */ - public static ChunkingParallelDecompiler createChunkingParallelDecopmiler( + public static ChunkingParallelDecompiler createChunkingParallelDecompiler( QCallback callback, TaskMonitor monitor) { return new ChunkingParallelDecompiler<>(callback, monitor); } diff --git a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/util/exporter/CppExporter.java b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/util/exporter/CppExporter.java index 4bb7ee0b4c..0aae0ec90c 100644 --- a/Ghidra/Features/Decompiler/src/main/java/ghidra/app/util/exporter/CppExporter.java +++ b/Ghidra/Features/Decompiler/src/main/java/ghidra/app/util/exporter/CppExporter.java @@ -96,7 +96,7 @@ public class CppExporter extends Exporter { ParallelDecompilerCallback callback = new ParallelDecompilerCallback(decompilerPool); ChunkingTaskMonitor chunkingMonitor = new ChunkingTaskMonitor(monitor); ChunkingParallelDecompiler parallelDecompiler = - ParallelDecompiler.createChunkingParallelDecopmiler(callback, chunkingMonitor); + ParallelDecompiler.createChunkingParallelDecompiler(callback, chunkingMonitor); try { writeProgramDataTypes(program, header, headerWriter, cFileWriter, chunkingMonitor); diff --git a/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java b/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java index 897020de83..5fca16ae69 100644 --- a/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java +++ b/Ghidra/Framework/Docking/src/main/java/docking/action/builder/AbstractActionBuilder.java @@ -14,6 +14,7 @@ * limitations under the License. */ package docking.action.builder; + import java.util.function.Consumer; import java.util.function.Predicate; @@ -25,85 +26,112 @@ import ghidra.util.HelpLocation; import resources.ResourceManager; /** - * Base class for DockingAction builders + * Base class for DockingAction builders. + * + *

Building an action requires a few steps. One of the few required calls when using a builder + * is {@link #onAction(Consumer)}. This is the callback used when the action is invoked. A + * typical action will also complete the {@link #enabledWhen(Predicate)} method, which tells the + * tool when an action is valid. + * + *

To see more detailed documentation for a given method of this builder, or to understand + * how actions are used in the tool, see the {@link DockingActionIf} + * interface. * * @param The type of DockingAction to build - * @param the Type of DockingActionBuilder + * @param the Type of action builder */ public abstract class AbstractActionBuilder> { + /** - * a name for the {@code DockingAction} + * Name for the {@code DockingAction} */ protected String name; + /** - * an owner for the {@code DockingAction} + * Owner for the {@code DockingAction} */ protected String owner; + /** - * the {@code KeyBindingType} for this {@code DockingAction} + * The {@code KeyBindingType} for this {@code DockingAction} */ protected KeyBindingType keyBindingType = KeyBindingType.INDIVIDUAL; + /** * The callback to perform when the action is invoked */ protected Consumer actionCallback; + /** - * a description for the {@code DockingAction} + * Description for the {@code DockingAction}. (optional) */ private String description = ""; + /** - * whether this {@code DockingAction} is enabled + * Whether this {@code DockingAction} is enabled */ private boolean isEnabled = true; + /** - * the {@code HelpLocation} for this {@code DockingAction} + * The {@code HelpLocation} for this {@code DockingAction} */ private HelpLocation helpLocation; /** - * The menu bar path. This is the key attribute for including the action on the menu bar + * The menu bar path. This is the key attribute for including the action on the menu bar. */ private String[] menuPath; + /** * The menu bar menu item icon. (optional) */ private Icon menuIcon; + /** * The menu bar menu item sub group. (optional) */ private String menuSubGroup; + /** * The menu bar menu item group. (optional) */ private String menuGroup; + /** * The mnemonic for the menu action (optional) */ private int menuMnemonic; + /** * The icon for the menu item (optional) */ private Icon popupIcon; + /** * The menu path in a pop-up menu. This is the key attribute for pop-up menu actions */ private String[] popupPath; + /** * The menu group for the item in the pop-up menu (optional) */ private String popupGroup; + /** * The menu sub group for the item in the pop-up menu (optional) */ private String popupSubGroup; + /** * The icon for the tool bar action. This is the key attribute for actions in the toolbar. */ private Icon toolbarIcon; + /** * The group for the items on the tool bar (optional) */ private String toolBarGroup; + /** * The menu group for the item in the tool bar menu (optional) */ @@ -113,24 +141,26 @@ public abstract class AbstractActionBuilder enabledPredicate; + /** * Predicate for determining if an action should be included on the pop-up menu */ private Predicate popupPredicate; + /** * Predicate for determining if an action is applicable for a given context */ private Predicate validContextPredicate; + /** * Predicate for determining if an action is applicable for a given global context */ private Predicate validGlobalContextPredicate; - /** * Builder constructor * @param name the name of the action to be built - * @param owner the owner of the action to be build + * @param owner the owner of the action to be built */ public AbstractActionBuilder(String name, String owner) { this.name = name; @@ -138,13 +168,15 @@ public abstract class AbstractActionBuilderNote: most clients do not need to use this method. Enablement is controlled by + * {@link #validContextWhen(Predicate)} or {@link #validGlobalContextWhen(Predicate)}. + * * * @param b {@code true} if enabled * @return this builder (for chaining) + * @see #validContextWhen(Predicate) */ public B enabled(boolean b) { this.isEnabled = b; @@ -196,17 +238,28 @@ public abstract class AbstractActionBuilderActions are not shared by default; they are {@link KeyBindingType#INDIVIDUAL}. This + * means that each action must have its key binding assigned individually. + * * @return this builder (for chaining) */ - public B keyBindingType(KeyBindingType type) { - this.keyBindingType = type; + public B sharedKeyBinding() { + this.keyBindingType = KeyBindingType.SHARED; return self(); } - + /** * Configure {@link HelpLocation} for this {@code DockingAction} + * + *

Clients are free to specify their help location directly, but many do not. A default + * help location is created that uses the action name as the anchor name and the action + * owner as the topic. If your anchor or topic do not follow this convention, then you + * need to set help topic yourself. + * * @param help the {@link HelpLocation} to configure * @return this builder (for chaining) */ @@ -217,7 +270,8 @@ public abstract class AbstractActionBuilderNote: you must call {@link #toolBarIcon(Icon)} or {@link #toolBarIcon(String)} for + * this action to appear in the toolbar. Calling this method without the other will not + * cause this action to be placed in the tool bar. + * * * @param group for this action * @return this builder (for chaining) + * @see #toolBarGroup(String) */ public B toolBarGroup(String group) { toolBarGroup = group; @@ -365,11 +430,17 @@ public abstract class AbstractActionBuilderNote: you must call {@link #toolBarIcon(Icon)} or {@link #toolBarIcon(String)} for + * this action to appear in the toolbar. Calling this method without the other will not + * cause this action to be placed in the tool bar. + * * * @param group the group used to clump actions together. * @param subGroup the sub-group used to order actions within a group. * @return this builder (for chaining) + * @see #toolBarGroup(String) */ public B toolBarGroup(String group, String subGroup) { toolBarSubGroup = group; @@ -379,7 +450,7 @@ public abstract class AbstractActionBuilderIf this predicate is not set, the action's enable state must be controlled + * directly using the {@link DockingAction#setEnabled(boolean)} method. We do not recommend + * controlling enablement directly. * * @param predicate the predicate that will be used to dynamically determine an action's - * enabled state. + * enabled state * @return this builder (for chaining) */ public B enabledWhen(Predicate predicate) { @@ -406,13 +479,21 @@ public abstract class AbstractActionBuilderNote: use this method when you wish for an action to be added to a popup menu regardless + * of whether it is enabled. As mentioned above, standard popup actions will only be added + * to the popup when they are enabled. * - * @param predicate the predicate that will be used to dynamically determine an action's - * enabled state. + *

Note: using this method is not sufficient to cause the action to appear in a popup + * menu. You must also use {@link #popupMenuPath(String...)}. + * + * @param predicate the predicate that will be used to dynamically determine whether an + * action is added to a popup menu * @return this builder (for chaining) + * @see #popupMenuPath(String...) */ public B popupWhen(Predicate predicate) { popupPredicate = predicate; @@ -421,7 +502,10 @@ public abstract class AbstractActionBuilderNote: most actions will not use this method, but rely instead on + * {@link #enabledWhen(Predicate)}. * * @param predicate the predicate that will be used to dynamically determine an action's * validity for a given {@link ActionContext} @@ -434,7 +518,10 @@ public abstract class AbstractActionBuilderNote: most actions will not use this method, but rely instead on + * {@link #enabledWhen(Predicate)}. * * @param predicate the predicate that will be used to dynamically determine an action's * validity for a given global {@link ActionContext}