mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 01:32:54 +08:00
more changes
This commit is contained in:
+9
-6
@@ -463,17 +463,20 @@ public class ListingPanel extends JPanel implements FieldMouseListener, FieldLoc
|
|||||||
for (MarginProvider element : marginProviders) {
|
for (MarginProvider element : marginProviders) {
|
||||||
element.setPixelMap(pixmap);
|
element.setPixelMap(pixmap);
|
||||||
}
|
}
|
||||||
if (!displayListeners.isEmpty()) {
|
|
||||||
AddressSetView displayAddresses = pixmap.getAddressSet();
|
|
||||||
for (ListingDisplayListener listener : displayListeners) {
|
for (ListingDisplayListener listener : displayListeners) {
|
||||||
|
notifyDisplayListener(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyDisplayListener(ListingDisplayListener listener) {
|
||||||
|
AddressSetView displayAddresses = pixmap.getAddressSet();
|
||||||
try {
|
try {
|
||||||
listener.visibleAddressesChanged(displayAddresses);
|
listener.visibleAddressesChanged(displayAddresses);
|
||||||
}
|
}
|
||||||
catch (Throwable t) {
|
catch (Throwable t) {
|
||||||
Msg.showError(this, fieldPanel, "ListingDisplayListener Error",
|
Msg.showError(this, fieldPanel, "Error in Display Listener",
|
||||||
"Error occurred in calling client's ListingDisplayListener", t);
|
"Execption encountered in client callback", t);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+11
-13
@@ -18,6 +18,7 @@ package ghidra.app.util.viewer.listingpanel;
|
|||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
import org.junit.*;
|
import org.junit.*;
|
||||||
|
|
||||||
@@ -50,11 +51,6 @@ public class ListingPanelTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
private Program program;
|
private Program program;
|
||||||
private AddressFactory addrFactory;
|
private AddressFactory addrFactory;
|
||||||
private AddressSpace space;
|
private AddressSpace space;
|
||||||
private AddressSetView addresses = null;
|
|
||||||
|
|
||||||
public ListingPanelTest() {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
@@ -309,24 +305,26 @@ public class ListingPanelTest extends AbstractGhidraHeadedIntegrationTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testListingDisplayListener() {
|
public void testListingDisplayListener() {
|
||||||
showTool(tool);
|
showTool(tool);
|
||||||
|
|
||||||
|
AtomicReference<AddressSetView> addresses = new AtomicReference<>();
|
||||||
CodeViewerService cvs = tool.getService(CodeViewerService.class);
|
CodeViewerService cvs = tool.getService(CodeViewerService.class);
|
||||||
cvs.addListingDisplayListener(new ListingDisplayListener() {
|
cvs.addListingDisplayListener(new ListingDisplayListener() {
|
||||||
@Override
|
@Override
|
||||||
public void visibleAddressesChanged(AddressSetView visibleAddresses) {
|
public void visibleAddressesChanged(AddressSetView visibleAddresses) {
|
||||||
addresses = visibleAddresses;
|
addresses.set(visibleAddresses);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
assertNull(addresses);
|
assertNull(addresses.get());
|
||||||
cvs.goTo(new ProgramLocation(program, addr(0x1008000)), false);
|
cvs.goTo(new ProgramLocation(program, addr(0x1008000)), false);
|
||||||
assertNotNull(addresses);
|
assertNotNull(addresses.get());
|
||||||
assertTrue(addresses.contains(addr(0x1008000)));
|
assertTrue(addresses.get().contains(addr(0x1008000)));
|
||||||
assertFalse(addresses.contains(addr(0x1001000)));
|
assertFalse(addresses.get().contains(addr(0x1001000)));
|
||||||
|
|
||||||
cvs.goTo(new ProgramLocation(program, addr(0x1001000)), false);
|
cvs.goTo(new ProgramLocation(program, addr(0x1001000)), false);
|
||||||
assertNotNull(addresses);
|
assertNotNull(addresses.get());
|
||||||
assertFalse(addresses.contains(addr(0x1008000)));
|
assertFalse(addresses.get().contains(addr(0x1008000)));
|
||||||
assertTrue(addresses.contains(addr(0x1001000)));
|
assertTrue(addresses.get().contains(addr(0x1001000)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user