Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GTable to select modules from drcov log #14

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
23 changes: 11 additions & 12 deletions src/main/java/cartographer/CartographerPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import docking.action.DockingAction;
import docking.action.MenuData;
import docking.tool.ToolConstants;
import docking.widgets.DataToStringConverter;
import docking.widgets.ListSelectionDialog;
import ghidra.app.decompiler.ClangToken;
import ghidra.app.decompiler.DecompileResults;
import ghidra.app.decompiler.DecompilerHighlightService;
Expand Down Expand Up @@ -60,7 +62,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.swing.JOptionPane;
import cartographer.CoverageFile.*;

//@formatter:off
Expand Down Expand Up @@ -513,18 +514,16 @@ public boolean loadCoverageFile(CoverageFile file) {
}

// Ask the user which module to use
String response = (String)JOptionPane.showInputDialog(
null,
"Please select the code coverage module to use.",
"Select a Coverage Module",
JOptionPane.QUESTION_MESSAGE,
null,
modNames.toArray(),
modNames.get(0)
);
ListSelectionDialog<String> responseDialog = new ListSelectionDialog<String>(
"Select a Coverage Module",
"Module",
modNames,
DataToStringConverter.stringDataToStringConverter);

responseDialog.show(tool.getActiveWindow());
String response = responseDialog.getSelectedItem();

// Bail if no option was chosen
if (response == null) {
if (responseDialog.wasCancelled()) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cartographer/CoverageFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private void parseDrCovFile(RandomAccessFile reader) throws IOException {
// Populate the module list
populateModules(drcovModules);
}

/**
* Parses a DRCOV module.
*
Expand Down