Class FunctionComparisonPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ghidra.features.base.codecompare.panel.FunctionComparisonPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ChangeListener

public class FunctionComparisonPanel extends JPanel implements ChangeListener
A panel for displaying functions, data, or address sets side-by-side for comparison purposes
See Also:
  • Constructor Details

    • FunctionComparisonPanel

      public FunctionComparisonPanel(PluginTool tool, String owner)
  • Method Details

    • loadFunctions

      public void loadFunctions(Function leftFunction, Function rightFunction)
      Load the given functions into the views of this panel
      Parameters:
      leftFunction - The function for the left side of the panel
      rightFunction - The function for the right side of the panel
    • loadData

      public void loadData(Data leftData, Data rightData)
      Load the given data into the views of this panel
      Parameters:
      leftData - The data for the left side of the panel
      rightData - The data for the right side of the panel
    • loadComparisons

      public void loadComparisons(ComparisonData left, ComparisonData right)
    • loadAddresses

      public void loadAddresses(Program leftProgram, Program rightProgram, AddressSetView leftAddresses, AddressSetView rightAddresses)
      Load the given addresses of the indicated programs into the views of this panel
      Parameters:
      leftProgram - the program for the left side of the panel
      rightProgram - the program for the right side of the panel
      leftAddresses - addresses for the info to display in the left side of the panel
      rightAddresses - addresses for the info to display in the right side of the panel
    • getActions

      public DockingAction[] getActions()
      Get the actions for this FunctionComparisonPanel
      Returns:
      an array containing the actions
    • getDescription

      public String getDescription()
      Gets a description to help distinguish this comparison panel from others
      Returns:
      the description
    • clear

      public void clear()
      Clear both sides of this panel
    • isEmpty

      public boolean isEmpty()
      Returns true if the comparison window has no information to display in either the left or right panel
      Returns:
      true if the comparison window has no information to display
    • getDualListingPanel

      public ListingCodeComparisonPanel getDualListingPanel()
      Gets the ListingCodeComparisonPanel being displayed by this panel if one exists
      Returns:
      the comparison panel or null
    • stateChanged

      public void stateChanged(ChangeEvent e)
      Specified by:
      stateChanged in interface ChangeListener
    • setCurrentTabbedComponent

      public boolean setCurrentTabbedComponent(String name)
      Set the current tabbed panel to be the component with the given name
      Parameters:
      name - name of view to set as the current tab
      Returns:
      true if the named view was found in the provider map
    • getCurrentComponentName

      public String getCurrentComponentName()
      Get the name of the current comparison panel being viewed
      Returns:
      the tab name, or null if there is nothing selected
    • dispose

      public void dispose()
      Remove all views in the tabbed pane
    • programClosed

      public void programClosed(Program program)
    • getCodeComparisonPanelByName

      public CodeComparisonPanel getCodeComparisonPanelByName(String name)
    • readConfigState

      public void readConfigState(String prefix, SaveState saveState)
      Sets up the FunctionComparisonPanel and which CodeComparisonPanel is currently displayed based on the specified saveState
      Parameters:
      prefix - identifier to prepend to any save state names to make them unique
      saveState - the save state for retrieving information
    • writeConfigState

      public void writeConfigState(String prefix, SaveState saveState)
      Saves the information to the save state about the FunctionComparisonPanel and which CodeComparisonPanel is currently displayed
      Parameters:
      prefix - identifier to prepend to any save state names to make them unique
      saveState - the save state where the information gets written
    • getCodeComparisonActions

      public DockingAction[] getCodeComparisonActions()
      Gets all actions for the FunctionComparisonPanel and all CodeComparisonPanels in this FunctionComparisonPanel
      Returns:
      the code comparison actions
    • setTitlePrefixes

      public void setTitlePrefixes(String leftTitlePrefix, String rightTitlePrefix)
      Sets the prefixes that are to be prepended to the title displayed for each side of each CodeComparisonPanel
      Parameters:
      leftTitlePrefix - the prefix to prepend to the left titles
      rightTitlePrefix - the prefix to prepend to the right titles
    • getActionContext

      public ActionContext getActionContext(MouseEvent event, ComponentProvider componentProvider)
      Returns the action context for a given mouse event and provider
      Parameters:
      event - the mouse event
      componentProvider - the component provider
      Returns:
      the action context
    • isScrollingSynced

      public final boolean isScrollingSynced()
      Determines if the layouts of the views are synchronized with respect to scrolling and location
      Returns:
      true if scrolling is synchronized between the two views
    • setScrollingSyncState

      public void setScrollingSyncState(boolean syncScrolling)
      Sets whether or not scrolling is synchronized
      Parameters:
      syncScrolling - true means synchronize scrolling and location between the two views
    • getDisplayedPanel

      public CodeComparisonPanel getDisplayedPanel()
      Gets the currently displayed CodeComparisonPanel
      Returns:
      the current panel or null.
    • updateActionEnablement

      public void updateActionEnablement()
      Updates the enablement for all actions provided by each panel
    • getCurrentComponent

      public CodeComparisonPanel getCurrentComponent()
      Get the current code comparison panel being viewed
      Returns:
      null if there is no code comparison panel
    • getComparisonPanels

      public List<CodeComparisonPanel> getComparisonPanels()