Class CodeComparisonPanel<T extends FieldPanelCoordinator>

Type Parameters:
T - the type
All Implemented Interfaces:
ExtensionPoint, FocusListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
DecompilerCodeComparisonPanel, ListingCodeComparisonPanel

public abstract class CodeComparisonPanel<T extends FieldPanelCoordinator> extends JPanel implements ExtensionPoint, FocusListener
The CodeComparisonPanel class should be extended by any class that is to be discovered by the FunctionComparisonPanel class and included as a form of comparing two sections of code within the same or different programs

NOTE: ALL CodeComparisonPanel CLASSES MUST END IN CodeComparisonPanel so they are discoverable by the ClassSearcher

See Also:
  • Field Details

    • MINIMUM_PANEL_WIDTH

      protected static final int MINIMUM_PANEL_WIDTH
      See Also:
    • LEFT

      protected static final int LEFT
      See Also:
    • FOCUS_BORDER

      protected static final Border FOCUS_BORDER
    • NON_FOCUS_BORDER

      protected static final Border NON_FOCUS_BORDER
    • EMPTY_ADDRESS_SET

      protected static final AddressSetView EMPTY_ADDRESS_SET
    • owner

      protected String owner
    • tool

      protected PluginTool tool
    • topComp

      protected JComponent topComp
    • bottomComp

      protected JComponent bottomComp
    • titlePanels

      protected TitledPanel[] titlePanels
    • leftTitlePrefix

      protected String leftTitlePrefix
    • rightTitlePrefix

      protected String rightTitlePrefix
    • currProgramIndex

      protected int currProgramIndex
    • programs

      protected Program[] programs
    • functions

      protected Function[] functions
    • data

      protected Data[] data
  • Constructor Details

    • CodeComparisonPanel

      protected CodeComparisonPanel(String owner, PluginTool tool)
      Constructor
      Parameters:
      owner - the name of the owner of this component
      tool - the tool that contains the component
  • Method Details

    • getComponent

      public abstract JComponent getComponent()
      The GUI component for this CodeComparisonPanel
      Returns:
      the component
    • getTitle

      public abstract String getTitle()
      The title for this code comparison panel
      Returns:
      the title
    • setPrograms

      protected abstract void setPrograms(Program leftProgram, Program rightProgram)
      Specifies the two programs to be compared by this panel
      Parameters:
      leftProgram - the program for the left side
      rightProgram - the program for the right side
    • loadFunctions

      public abstract void loadFunctions(Function leftFunction, Function rightFunction)
      Displays a comparison of two program's functions
      Parameters:
      leftFunction - the function to show in the left side of the code comparison view
      rightFunction - the function to show in the right side of the code comparison view
    • loadData

      public abstract void loadData(Data leftData, Data rightData)
      Displays a comparison of two program's data items
      Parameters:
      leftData - the data item to show in the left side of the code comparison view
      rightData - the data item to show in the right side of the code comparison view
    • loadAddresses

      public abstract void loadAddresses(Program leftProgram, Program rightProgram, AddressSetView leftAddresses, AddressSetView rightAddresses)
      Displays program information for a particular set of addresses in the two programs being compared
      Parameters:
      leftProgram - the program in the left side of the code comparison view
      rightProgram - the program in the right side of the code comparison view
      leftAddresses - the addresses of the program info to show in the left side
      rightAddresses - the addresses of the program info to show in the right side
    • dispose

      public abstract void dispose()
      Cleans up resources when this panel is no longer needed
    • setMouseNavigationEnabled

      public abstract void setMouseNavigationEnabled(boolean enabled)
      Enable/disable navigation in this panel using the mouse
      Parameters:
      enabled - false disables mouse navigation
    • getActions

      public DockingAction[] getActions()
      Returns the actions for this panel
      Returns:
      an array of docking actions
    • getShowTitles

      public boolean getShowTitles()
    • setShowTitles

      public void setShowTitles(boolean showTitles)
    • getPanelThisSupersedes

      public abstract Class<? extends CodeComparisonPanel<T>> getPanelThisSupersedes()
      Determines if this panel is intended to take the place of another and if so it returns the class of the panel to be superseded.
      Returns:
      the class for the CodeComparisonPanel that this one supersedes or null if it doesn't supersede another panel.
    • getActionContext

      public abstract ActionContext getActionContext(ComponentProvider componentProvider, MouseEvent event)
      Returns the context object which corresponds to the area of focus within this provider's component. Null is returned when there is no context.
      Parameters:
      componentProvider - the provider that includes this code comparison component.
      event - mouse event which corresponds to this request. May be null for key-stroke or other non-mouse event.
      Returns:
      the action context for the area of focus in this component.
    • programRestored

      public abstract void programRestored(Program program)
      Called when the indicated program has been restored because of an Undo/Redo. This method allows this CodeComparisonPanel to take an appropriate action (such as refreshing itself) to respond to the program changing.
      Parameters:
      program - the program that was restored.
    • leftPanelHasFocus

      public abstract boolean leftPanelHasFocus()
      Determines if the left code panel currently has focus.
      Returns:
      true if the left side of the code comparison has focus.
    • setTitlePrefixes

      public abstract void setTitlePrefixes(String leftTitlePrefix, String rightTitlePrefix)
      A CodeComparisonPanel should provide a title based on what the code comparison panel is displaying. This method sets a prefix string that should be prepended to each of the code comparison panel's titles.
      Parameters:
      leftTitlePrefix - the prefix string to prepend to the left panel's title.
      rightTitlePrefix - the prefix string to prepend to the right panel's title.
    • getLeftProgram

      public Program getLeftProgram()
      Gets the program being viewed in the left side of this panel.
      Returns:
      the program or null
    • getRightProgram

      public Program getRightProgram()
      Gets the program being viewed in the right side of this panel.
      Returns:
      the program or null
    • getLeftFunction

      public Function getLeftFunction()
      Gets the function loaded in the left side of this panel.
      Returns:
      the function or null
    • getRightFunction

      public Function getRightFunction()
      Gets the function loaded in the right side of this panel.
      Returns:
      the function or null
    • getLeftData

      public Data getLeftData()
      Gets the data loaded in the left side of this panel.
      Returns:
      the data or null
    • getRightData

      public Data getRightData()
      Gets the data loaded in the right side of this panel.
      Returns:
      the data or null
    • getLeftAddresses

      public abstract AddressSetView getLeftAddresses()
      Gets the addresses loaded in the left side of this panel.
      Returns:
      the addresses or an empty set
    • getRightAddresses

      public abstract AddressSetView getRightAddresses()
      Gets the addresses loaded in the right side of this panel.
      Returns:
      the addresses or an empty set
    • refreshLeftPanel

      public abstract void refreshLeftPanel()
      Refreshes the left side of this panel.
    • refreshRightPanel

      public abstract void refreshRightPanel()
      Refreshes the right side of this panel.
    • focusLost

      public void focusLost(FocusEvent e)
      Specified by:
      focusLost in interface FocusListener
    • updateActionEnablement

      public abstract void updateActionEnablement()
      Updates the enablement for any actions created by this code comparison panel.
    • setFieldPanelCoordinator

      public void setFieldPanelCoordinator(T fieldPanelCoordinator)
      Sets the coordinator for the two views within this code comparison panel. It coordinates their scrolling and location synchronization.
      Parameters:
      fieldPanelCoordinator - the coordinator for the two views
    • getFieldPanelCoordinator

      protected T getFieldPanelCoordinator()
      Gets the current field panel coordinator used to synchronize scrolling between the left and right view for this CodeComparisonPanel.
      Returns:
      the current FieldPanelCoordinator. Otherwise, null if scrolling is not currently synchronized.
    • createFieldPanelCoordinator

      protected abstract T createFieldPanelCoordinator()
      Creates a new FieldPanelCoordinator used to synchronize scrolling between the left and right view for this CodeComparisonPanel.
      Returns:
      a new FieldPanelCoordinator
    • getLeftFieldPanel

      public abstract FieldPanel getLeftFieldPanel()
      Gets the left field panel for this CodeComparisonPanel.
      Returns:
      the left FieldPanel.
    • getRightFieldPanel

      public abstract FieldPanel getRightFieldPanel()
      Gets the right field panel for this CodeComparisonPanel.
      Returns:
      the right FieldPanel.
    • 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.