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 side-by-side for comparison purposes
See Also:
  • Constructor Details

    • FunctionComparisonPanel

      public FunctionComparisonPanel(PluginTool tool, String owner, FunctionComparisonState state)
      Constructor
      Parameters:
      tool - the tool
      owner - the owner's name
      state - the comparison save state
  • Method Details

    • getMinimumSize

      public Dimension getMinimumSize()
      Overrides:
      getMinimumSize in class JComponent
    • 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
    • getDualListingView

      public ListingCodeComparisonView getDualListingView()
      Gets the ListingCodeComparisonView 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 view 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)
    • getCodeComparisonView

      public CodeComparisonView getCodeComparisonView(String name)
    • selectComparisonView

      public void selectComparisonView(String name)
    • getCodeComparisonActions

      public DockingAction[] getCodeComparisonActions()
    • 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 CodeComparisonView
      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
    • getDisplayedView

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

      public void updateActionEnablement()
      Updates the enablement for all actions provided by each view
    • getCurrentView

      public CodeComparisonView getCurrentView()
      Get the current code comparison view being viewed
      Returns:
      null if there is no code comparison view
    • getComparisonView

      public List<CodeComparisonView> getComparisonView()