mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-16 15:40:14 +00:00
Corrected residual action enablement/tooltip issues
This commit is contained in:
parent
165a767365
commit
55e562650f
@ -25,6 +25,7 @@ import ghidra.app.context.ListingContextAction;
|
||||
import ghidra.app.util.HelpTopics;
|
||||
import ghidra.framework.cmd.BackgroundCommand;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSet;
|
||||
import ghidra.program.model.lang.GhidraLanguagePropertyKeys;
|
||||
import ghidra.program.model.listing.Function;
|
||||
@ -118,10 +119,11 @@ class AnalyzeStackRefsAction extends ListingContextAction {
|
||||
if (context.hasSelection()) {
|
||||
return true;
|
||||
}
|
||||
Function func = funcPlugin.getFunction(context);
|
||||
if (func != null) {
|
||||
return !func.isExternal();
|
||||
Program program = context.getProgram();
|
||||
Address addr = context.getAddress();
|
||||
if (program == null || addr == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
return program.getListing().getFunctionContaining(addr) != null;
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ import ghidra.util.HelpLocation;
|
||||
//@formatter:on
|
||||
public class AboutProgramPlugin extends Plugin implements FrontEndable {
|
||||
public final static String PLUGIN_NAME = "AboutProgramPlugin";
|
||||
public final static String ACTION_NAME = "About program";
|
||||
public final static String ACTION_NAME = "About Program";
|
||||
|
||||
private DockingAction aboutAction;
|
||||
|
||||
@ -87,7 +87,8 @@ public class AboutProgramPlugin extends Plugin implements FrontEndable {
|
||||
return context.getFileCount() == 1 && context.getFolderCount() == 0;
|
||||
}
|
||||
};
|
||||
aboutAction.setPopupMenuData(new MenuData(new String[] { "About..." }, null, "AAA"));
|
||||
aboutAction.setPopupMenuData(
|
||||
new MenuData(new String[] { ACTION_NAME }, null, "AAA"));
|
||||
|
||||
aboutAction.setEnabled(true);
|
||||
}
|
||||
@ -101,20 +102,17 @@ public class AboutProgramPlugin extends Plugin implements FrontEndable {
|
||||
|
||||
@Override
|
||||
public boolean isValidContext(ActionContext context) {
|
||||
updateMenuName(context);
|
||||
return super.isValidContext(context);
|
||||
}
|
||||
|
||||
private void updateMenuName(ActionContext context) {
|
||||
if (context instanceof ProgramActionContext) {
|
||||
if (super.isValidContext(context)) {
|
||||
ProgramActionContext pac = (ProgramActionContext) context;
|
||||
Program program = pac.getProgram();
|
||||
String menuName = "About " + program.getDomainFile().getName();
|
||||
getMenuBarData().setMenuItemName(menuName);
|
||||
}
|
||||
else {
|
||||
getMenuBarData().setMenuItemName(ACTION_NAME);
|
||||
if (program != null) {
|
||||
String menuName = "About " + program.getDomainFile().getName() + "...";
|
||||
getMenuBarData().setMenuItemName(menuName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
getMenuBarData().setMenuItemName(ACTION_NAME);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
aboutAction.setSupportsDefaultToolContext(true);
|
||||
|
@ -659,19 +659,11 @@ public class ProgramManagerPlugin extends Plugin implements ProgramManager {
|
||||
Program p = programMgr.getCurrentProgram();
|
||||
updateCloseAction(p);
|
||||
updateProgramOptionsAction(p);
|
||||
updateSaveAction(p);
|
||||
updateSaveAsAction(p);
|
||||
updateProgramActions();
|
||||
closeAllAction.setEnabled(p != null);
|
||||
optionsAction.setEnabled(p != null);
|
||||
Program[] programList = programMgr.getAllPrograms();
|
||||
closeOthersAction.setEnabled(programList.length > 1);
|
||||
saveAllAction.setEnabled(false);
|
||||
for (Program element : programList) {
|
||||
if (element.isChanged()) {
|
||||
saveAllAction.setEnabled(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
tool.contextChanged(null);
|
||||
}
|
||||
|
||||
|
@ -19,7 +19,6 @@ import java.io.IOException;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.tool.ToolConstants;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
@ -93,15 +92,6 @@ public class RedoAction extends ProgramContextAction {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidContext(ActionContext context) {
|
||||
if (!(context instanceof ProgramActionContext)) {
|
||||
getMenuBarData().setMenuItemName("Redo ");
|
||||
setDescription("");
|
||||
}
|
||||
return super.isValidContext(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabledForContext(ProgramActionContext context) {
|
||||
Program program = context.getProgram();
|
||||
|
@ -19,7 +19,6 @@ import java.io.IOException;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import docking.ActionContext;
|
||||
import docking.action.*;
|
||||
import docking.tool.ToolConstants;
|
||||
import ghidra.app.context.ProgramActionContext;
|
||||
@ -99,15 +98,6 @@ public class UndoAction extends ProgramContextAction {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidContext(ActionContext context) {
|
||||
if (!(context instanceof ProgramActionContext)) {
|
||||
getMenuBarData().setMenuItemName("Undo ");
|
||||
setDescription("");
|
||||
}
|
||||
return super.isValidContext(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEnabledForContext(ProgramActionContext context) {
|
||||
Program program = context.getProgram();
|
||||
|
Loading…
Reference in New Issue
Block a user