Skip to content

Commit 3c683ae

Browse files
committed
Merge remote-tracking branch 'origin/Ghidra_9.2'
2 parents 7357b75 + 55e5626 commit 3c683ae

File tree

5 files changed

+18
-46
lines changed

5 files changed

+18
-46
lines changed

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/function/AnalyzeStackRefsAction.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import ghidra.app.util.HelpTopics;
2626
import ghidra.framework.cmd.BackgroundCommand;
2727
import ghidra.framework.options.Options;
28+
import ghidra.program.model.address.Address;
2829
import ghidra.program.model.address.AddressSet;
2930
import ghidra.program.model.lang.GhidraLanguagePropertyKeys;
3031
import ghidra.program.model.listing.Function;
@@ -118,10 +119,11 @@ public boolean isEnabledForContext(ListingActionContext context) {
118119
if (context.hasSelection()) {
119120
return true;
120121
}
121-
Function func = funcPlugin.getFunction(context);
122-
if (func != null) {
123-
return !func.isExternal();
122+
Program program = context.getProgram();
123+
Address addr = context.getAddress();
124+
if (program == null || addr == null) {
125+
return false;
124126
}
125-
return false;
127+
return program.getListing().getFunctionContaining(addr) != null;
126128
}
127129
}

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/help/AboutProgramPlugin.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
//@formatter:on
5353
public class AboutProgramPlugin extends Plugin implements FrontEndable {
5454
public final static String PLUGIN_NAME = "AboutProgramPlugin";
55-
public final static String ACTION_NAME = "About program";
55+
public final static String ACTION_NAME = "About Program";
5656

5757
private DockingAction aboutAction;
5858

@@ -87,7 +87,8 @@ protected boolean isAddToPopup(ProjectDataContext context) {
8787
return context.getFileCount() == 1 && context.getFolderCount() == 0;
8888
}
8989
};
90-
aboutAction.setPopupMenuData(new MenuData(new String[] { "About..." }, null, "AAA"));
90+
aboutAction.setPopupMenuData(
91+
new MenuData(new String[] { ACTION_NAME }, null, "AAA"));
9192

9293
aboutAction.setEnabled(true);
9394
}
@@ -101,20 +102,17 @@ public void actionPerformed(ProgramActionContext context) {
101102

102103
@Override
103104
public boolean isValidContext(ActionContext context) {
104-
updateMenuName(context);
105-
return super.isValidContext(context);
106-
}
107-
108-
private void updateMenuName(ActionContext context) {
109-
if (context instanceof ProgramActionContext) {
105+
if (super.isValidContext(context)) {
110106
ProgramActionContext pac = (ProgramActionContext) context;
111107
Program program = pac.getProgram();
112-
String menuName = "About " + program.getDomainFile().getName();
113-
getMenuBarData().setMenuItemName(menuName);
114-
}
115-
else {
116-
getMenuBarData().setMenuItemName(ACTION_NAME);
108+
if (program != null) {
109+
String menuName = "About " + program.getDomainFile().getName() + "...";
110+
getMenuBarData().setMenuItemName(menuName);
111+
return true;
112+
}
117113
}
114+
getMenuBarData().setMenuItemName(ACTION_NAME);
115+
return false;
118116
}
119117
};
120118
aboutAction.setSupportsDefaultToolContext(true);

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/ProgramManagerPlugin.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -659,19 +659,11 @@ private void updateActions() {
659659
Program p = programMgr.getCurrentProgram();
660660
updateCloseAction(p);
661661
updateProgramOptionsAction(p);
662-
updateSaveAction(p);
663-
updateSaveAsAction(p);
662+
updateProgramActions();
664663
closeAllAction.setEnabled(p != null);
665664
optionsAction.setEnabled(p != null);
666665
Program[] programList = programMgr.getAllPrograms();
667666
closeOthersAction.setEnabled(programList.length > 1);
668-
saveAllAction.setEnabled(false);
669-
for (Program element : programList) {
670-
if (element.isChanged()) {
671-
saveAllAction.setEnabled(true);
672-
break;
673-
}
674-
}
675667
tool.contextChanged(null);
676668
}
677669

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/RedoAction.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import javax.swing.Icon;
2121

22-
import docking.ActionContext;
2322
import docking.action.*;
2423
import docking.tool.ToolConstants;
2524
import ghidra.app.context.ProgramActionContext;
@@ -93,15 +92,6 @@ else if (program.canRedo()) {
9392

9493
}
9594

96-
@Override
97-
public boolean isValidContext(ActionContext context) {
98-
if (!(context instanceof ProgramActionContext)) {
99-
getMenuBarData().setMenuItemName("Redo ");
100-
setDescription("");
101-
}
102-
return super.isValidContext(context);
103-
}
104-
10595
@Override
10696
protected boolean isEnabledForContext(ProgramActionContext context) {
10797
Program program = context.getProgram();

Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/progmgr/UndoAction.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import javax.swing.Icon;
2121

22-
import docking.ActionContext;
2322
import docking.action.*;
2423
import docking.tool.ToolConstants;
2524
import ghidra.app.context.ProgramActionContext;
@@ -99,15 +98,6 @@ public void update(Program program) {
9998
}
10099
}
101100

102-
@Override
103-
public boolean isValidContext(ActionContext context) {
104-
if (!(context instanceof ProgramActionContext)) {
105-
getMenuBarData().setMenuItemName("Undo ");
106-
setDescription("");
107-
}
108-
return super.isValidContext(context);
109-
}
110-
111101
@Override
112102
protected boolean isEnabledForContext(ProgramActionContext context) {
113103
Program program = context.getProgram();

0 commit comments

Comments
 (0)