Java Code Examples for ghidra.util.Msg#showInfo()
The following examples show how to use
ghidra.util.Msg#showInfo() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AddressAnnotatedStringHandler.java From ghidra with Apache License 2.0 | 6 votes |
@Override public boolean handleMouseClick(String[] annotationParts, Navigatable sourceNavigatable, ServiceProvider serviceProvider) { GoToService goToService = serviceProvider.getService(GoToService.class); Program program = sourceNavigatable.getProgram(); String addressText = annotationParts[1]; Address address = program.getAddressFactory().getAddress(addressText); if (address != null) { return goToService.goTo(sourceNavigatable, address); } Msg.showInfo(getClass(), null, "No address: " + addressText, "Unable to locate address \"" + addressText + "\""); return false; }
Example 2
Source File: ImporterPlugin.java From ghidra with Apache License 2.0 | 6 votes |
private void doSingleImportAction(DomainFolder defaultFolder) { initializeChooser("Select File to Import", "Select File To Import", false); File file = chooser.getSelectedFile(); if (chooser.wasCancelled()) { return; } if (file == null) { Msg.showInfo(this, tool.getActiveWindow(), "No file selected", "No file will be imported."); } else if (!file.exists()) { Msg.showInfo(this, tool.getActiveWindow(), "File Error", "File does not exist: " + file.getPath()); } else { importFile(defaultFolder, file); } }
Example 3
Source File: KeyBindingAction.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionContext context) { DockingWindowManager windowManager = DockingWindowManager.getActiveInstance(); if (windowManager == null) { return; } DockingActionIf action = DockingWindowManager.getMouseOverAction(); if (action == null) { return; } action = maybeGetToolLevelAction(action); if (!action.getKeyBindingType().supportsKeyBindings()) { Component parent = windowManager.getActiveComponent(); Msg.showInfo(getClass(), parent, "Unable to Set Keybinding", "Action \"" + getActionName(action) + "\" does not support key bindings"); return; } KeyEntryDialog d = new KeyEntryDialog(action, toolActions); DockingWindowManager.showDialog(d); }
Example 4
Source File: LocationReferencesPlugin.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void findAndDisplayAppliedDataTypeAddresses(Composite dataType, String fieldName) { ProgramManager programManagerService = tool.getService(ProgramManager.class); GoToService goToService = tool.getService(GoToService.class); Program program = programManagerService.getCurrentProgram(); if (program == null) { Msg.showInfo(this, null, "Find References To...", "You must have a program open in order to use the 'Find References To...' action"); return; // cannot find references to a data type if there is no open program } ProgramLocation genericLocation = new GenericCompositeDataTypeProgramLocation(program, dataType, fieldName); LocationDescriptor locationDescriptor = getLocationDescriptor(genericLocation); Navigatable navigatable = goToService.getDefaultNavigatable(); LocationReferencesProvider provider = findProvider(locationDescriptor, navigatable); showProvider(program, provider, locationDescriptor, navigatable); }
Example 5
Source File: ColumnFilterDialog.java From ghidra with Apache License 2.0 | 6 votes |
private void loadFilter() { ColumnFilterSaveManager<R> filterSaveManager = new ColumnFilterSaveManager<>( gTableFilterPanel, table, tableModel, filterModel.getDataSource()); List<ColumnBasedTableFilter<R>> savedFilters = filterSaveManager.getSavedFilters(); if (savedFilters.isEmpty()) { Msg.showInfo(this, getComponent(), "No Saved Filters", "No saved filters exist for this table."); return; } ColumnFilterArchiveDialog<R> archiveDialog = new ColumnFilterArchiveDialog<>(this, filterSaveManager, getTableName()); DockingWindowManager.showDialog(getComponent(), archiveDialog); ColumnBasedTableFilter<R> selectedFilter = archiveDialog.getSelectedColumnFilter(); if (selectedFilter != null) { filterModel.setFilter(selectedFilter); } }
Example 6
Source File: CreateEmptyProgramScript.java From ghidra with Apache License 2.0 | 6 votes |
@Override public void run() throws Exception { SwingUtilities.invokeAndWait(() -> state.getTool().showDialog(dialog)); LanguageCompilerSpecPair pair = dialog.getSelectedLanguageCompilerSpecPair(); if (pair == null) { println("User cancelled operation."); } else { try { Language language = pair.getLanguage(); CompilerSpec compilerSpec = pair.getCompilerSpec(); Program program = new ProgramDB("Untitled", language, compilerSpec, this); ProgramManager programManager = state.getTool().getService(ProgramManager.class); programManager.openProgram(program); program.release(this); } catch (Exception e) { Msg.showInfo(getClass(), null, "Error Creating New Program", e.getMessage()); } } }
Example 7
Source File: LabelHistoryAction.java From ghidra with Apache License 2.0 | 6 votes |
@Override protected void actionPerformed(ListingActionContext context) { Address addr = context.getAddress(); ProgramLocation location = context.getLocation(); if (location instanceof OperandFieldLocation) { Address a = ((OperandFieldLocation) location).getRefAddress(); if (a != null) { addr = a; } } List<LabelHistory> list = getHistoryList(context.getProgram(), addr); if (list.size() > 0) { LabelHistoryDialog dialog = new LabelHistoryDialog(tool, context.getProgram(), addr, getHistoryList( context.getProgram(), addr)); tool.showDialog(dialog); } else { Msg.showInfo(getClass(), tool.getToolFrame(), "History Not Found", "No Label History was found at address: " + addr); } }
Example 8
Source File: MemoryMapProvider.java From ghidra with Apache License 2.0 | 5 votes |
/** * Pop up a dialog to split the selected block. */ private void splitBlock() { MemoryBlock block = getSelectedBlock(); if (block == null) { return; } if (block.isOverlay()) { Msg.showInfo(getClass(), getComponent(), "Split Overlay Block Not Allowed", "Overlay blocks cannot be split."); } else { SplitBlockDialog d = new SplitBlockDialog(plugin, block, program.getAddressFactory()); tool.showDialog(d, this); } }
Example 9
Source File: SyncAction.java From ghidra with Apache License 2.0 | 5 votes |
private void showNoDataTypesForThisOperationMessage(String archiveName, Set<DataTypeSyncInfo> outOfSyncInfos) { String status = getStatusMessage(outOfSyncInfos); Msg.showInfo(getClass(), plugin.getTool().getToolFrame(), "No Data Type Changes", "No datatypes found to " + getOperationName() + " for archive \"" + archiveName + "\".\n\n" + status); }
Example 10
Source File: CreateStructureVariableAction.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionContext context) { ProgramLocation location = null; Program program = null; if (context instanceof DecompilerActionContext) { DecompilerActionContext decompilerActionContext = (DecompilerActionContext) context; if (decompilerActionContext.isDecompiling()) { Msg.showInfo(getClass(), context.getComponentProvider().getComponent(), "Decompiler Action Blocked", "You cannot perform Decompiler actions while the Decompiler is busy"); return; } location = decompilerActionContext.getLocation(); program = decompilerActionContext.getProgram(); } else if (context instanceof ListingActionContext) { ListingActionContext listingContext = (ListingActionContext) context; // get the data type at the location and see if it is OK // make sure what we are over can be mapped to decompiler // param, local, etc... location = listingContext.getLocation(); program = listingContext.getProgram(); } else { return; } FillOutStructureCmd task = new FillOutStructureCmd(program, location, tool); task.applyTo(program); }
Example 11
Source File: AbstractHoverProvider.java From ghidra with Apache License 2.0 | 5 votes |
public void setHoverEnabled(boolean enabled) { if (enabled == this.enabled) { return; } this.enabled = enabled; if (enabled && !hasEnabledHoverServices()) { Msg.showInfo(getClass(), null, "No Popups Enabled", "You have chosen to " + "enable tooltip style popups, but none are currently enabled.\nTo enable these " + "popups you must use the options menu: \"Options->Listing Popups\""); } }
Example 12
Source File: OptionsManager.java From ghidra with Apache License 2.0 | 5 votes |
/** * Show the dialog to edit options. */ public void editOptions() { if (optionsMap.isEmpty()) { Msg.showInfo(getClass(), tool.getToolFrame(), "No Options", "No Options set in this tool"); return; } if (optionsDialog != null && optionsDialog.isVisible()) { optionsDialog.toFront(); return; } optionsDialog = createOptionsDialog(); tool.showDialog(optionsDialog); }
Example 13
Source File: GhidraScriptComponentProvider.java From ghidra with Apache License 2.0 | 5 votes |
void deleteScript() { ResourceFile script = getSelectedScript(); if (script == null) { return; } ResourceFile directory = script.getParentFile(); Path path = GhidraScriptUtil.getScriptPath(directory); if (path == null || path.isReadOnly()) { Msg.showWarn(getClass(), getComponent(), getName(), "Unable to delete scripts in '" + directory + "'."); return; } int result = OptionDialog.showYesNoDialog(getComponent(), getName(), "Are you sure you want to delete script '" + script.getName() + "'?"); if (result == OptionDialog.OPTION_ONE) { if (removeScript(script)) { GhidraScriptProvider provider = GhidraScriptUtil.getProvider(script); if (provider.deleteScript(script)) { restoreSelection(script); } else { Msg.showInfo(getClass(), getComponent(), getName(), "Unable to delete script '" + script.getName() + "'" + "\n" + "Please verify the file permissions."); } } } }
Example 14
Source File: SyncAction.java From ghidra with Apache License 2.0 | 5 votes |
@Override public void actionPerformed(ActionContext context) { DataTypeSynchronizer synchronizer = new DataTypeSynchronizer(handler, dtm, sourceArchive); if (!dtm.isUpdatable()) { showRequiresArchiveOpenMessage(dtm.getName()); return; } DataTypeManager sourceDTM = handler.getDataTypeManager(sourceArchive); if (sourceDTM == null) { Msg.showInfo(getClass(), plugin.getTool().getToolFrame(), "Cannot Access Source Archive", "Can't access the data types for the " + sourceArchive.getName() + " archive."); return; } if (requiresArchiveOpenForEditing() && !sourceDTM.isUpdatable()) { showRequiresArchiveOpenMessage(sourceArchive.getName()); return; } //@formatter:off TaskBuilder.withTask(new SyncTask(synchronizer)) .setStatusTextAlignment(SwingConstants.LEADING) .launchModal() ; //@formatter:on }
Example 15
Source File: MemoryMapProvider.java From ghidra with Apache License 2.0 | 5 votes |
/** * Pop up a dialog to expand the block either up or down; "up" means make a * block have a lesser starting address; "down" means to make the block have * a greater ending address. * * @param dialogType either ExpandBlockDialog.EXPAND_UP or * ExpandBlockDialog.EXPAND_DOWN. */ private void expandBlock(int dialogType) { MemoryBlock block = getSelectedBlock(); if (block == null) { return; } if (block.isOverlay()) { Msg.showInfo(getClass(), getComponent(), "Expand Overlay Block Not Allowed", "Overlay blocks cannot be expanded."); } else { showExpandBlockDialog(dialogType, block); } }
Example 16
Source File: DragonHelper.java From dragondance with GNU General Public License v3.0 | 4 votes |
public static void showMessage(String message, Object...args) { if (isUiDispatchThread()) Msg.showInfo(DragonHelper.class, null, "Dragon Dance", String.format(message, args)); else showMessageOnSwingThread(message,args); }
Example 17
Source File: DefaultHelpService.java From ghidra with Apache License 2.0 | 4 votes |
private void displayHelpInfo(Object helpObj) { String msg = getHelpInfo(helpObj); Msg.showInfo(this, null, "Help Info", msg); }
Example 18
Source File: ProgramAnnotatedStringHandler.java From ghidra with Apache License 2.0 | 4 votes |
private void navigate(DomainFile programFile, SymbolPath symbolPath, Navigatable navigatable, ServiceProvider serviceProvider) { GoToService goToService = serviceProvider.getService(GoToService.class); if (goToService == null) { // shouldn't happen Msg.showWarn(this, null, "Service Missing", "This annotation requires the GoToService to be enabled"); return; } ProgramManager programManager = serviceProvider.getService(ProgramManager.class); Program program = programManager.openProgram(programFile, DomainFile.DEFAULT_VERSION, ProgramManager.OPEN_HIDDEN); if (program == null) { return; // cancelled } if (symbolPath == null) { // no symbol; just open and go to the program Address start = program.getMemory().getMinAddress(); goToService.goTo(navigatable, new ProgramLocation(program, start), program); return; } // try any symbols(s) first List<Symbol> symbols = NamespaceUtils.getSymbols(symbolPath.getPath(), program); if (goToSymbol(symbols, navigatable, program, goToService)) { return; } String symbolName = symbolPath.getName(); Address address = getAddress(symbolName, program); if (goToAddress(address, program, navigatable, goToService)) { return; } Msg.showInfo(getClass(), null, "No Symbol: " + symbolName, "Unable to navigate to '" + symbolName + "' in the program '" + programFile.getName() + "'.\nMake sure that the given symbol/address exists."); if (!programManager.isVisible(program)) { // we opened a hidden program, but could not navigate--close the program programManager.closeProgram(program, true); } }
Example 19
Source File: ProgramAnnotatedStringHandler.java From ghidra with Apache License 2.0 | 4 votes |
@Override public boolean handleMouseClick(String[] annotationParts, Navigatable navigatable, ServiceProvider serviceProvider) { ProjectDataService projectDataService = serviceProvider.getService(ProjectDataService.class); ProjectData projectData = projectDataService.getProjectData(); // default folder is the root folder DomainFolder folder = projectData.getRootFolder(); // Get program name and folder from program comment annotation // handles forward and back slashes and with and without first slash String programText = getProgramText(annotationParts); String programName = FilenameUtils.getName(programText); String path = FilenameUtils.getFullPathNoEndSeparator(programText); if (path.length() > 0) { path = StringUtils.prependIfMissing(FilenameUtils.separatorsToUnix(path), "/"); folder = projectData.getFolder(path); } if (folder == null) { Msg.showInfo(getClass(), null, "No Folder: " + path, "Unable to locate folder by the name \"" + path); return true; } DomainFile programFile = findProgramByName(programName, folder); if (programFile == null) { Msg.showInfo(getClass(), null, "No Program: " + programName, "Unable to locate a program by the name \"" + programName + "\".\nNOTE: Program name is case-sensitive. "); return true; } SymbolPath symbolPath = getSymbolPath(annotationParts); navigate(programFile, symbolPath, navigatable, serviceProvider); return true; }
Example 20
Source File: HelloWorldComponentProvider.java From ghidra with Apache License 2.0 | 4 votes |
/** * popup the Hello Dialog */ protected void announce(String message) { Msg.showInfo(getClass(), mainPanel, "Hello World", message); }