Package ghidra.features.base.codecompare.listing

# Class ListingCodeComparisonView

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ghidra.features.base.codecompare.panel.CodeComparisonView
ghidra.features.base.codecompare.listing.ListingCodeComparisonView

All Implemented Interfaces:
  `FormatModelListener`, `OptionsChangeListener`, `ExtensionPoint`, `ImageObserver`, `MenuContainer`, `Serializable`, `Accessible`

public class ListingCodeComparisonView extends CodeComparisonView implements FormatModelListener, OptionsChangeListener
UI that displays two listings for comparison.

See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class javax.swing.JPanel

  `JPanel.AccessibleJPanel`

  ## Nested classes/interfaces inherited from class javax.swing.JComponent

  `JComponent.AccessibleJComponent`

  ## Nested classes/interfaces inherited from class java.awt.Container

  `Container.AccessibleAWTContainer`

  ## Nested classes/interfaces inherited from class java.awt.Component

  `Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NAME`

  ### Fields inherited from class ghidra.features.base.codecompare.panel.CodeComparisonView

  `activeSide, comparisonData, HELP_TOPIC, owner, tool`

  ### Fields inherited from class javax.swing.JComponent

  `listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

  ### Fields inherited from class java.awt.Component

  `accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

  ### Fields inherited from interface java.awt.image.ImageObserver

  `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ListingCodeComparisonView(String owner, PluginTool tool)`
  Creates a comparison panel with two listings.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addHighlightProviders(ListingHighlightProvider leftHighlightProvider, ListingHighlightProvider rightHighlightProvider)`
  Adds the indicated highlight providers for the left and right listing panels.
  `protected void`
  `comparisonDataChanged()`
  Notification to subclasses that the comparison data has changed
  `void`
  `dispose()`
  Cleans up resources when this panel is no longer needed
  `void`
  `formatModelChanged(FieldFormatModel model)`
  Notifies that the given format model was changed.
  `ActionContext`
  `getActionContext(ComponentProvider provider, MouseEvent event)`
  Returns the context object which corresponds to the area of focus within this view's component.
  `List<DockingAction>`
  `getActions()`
  Returns the actions for this panel
  `ListingPanel`
  `getActiveListingPanel()`
  `JComponent`
  `getComparisonComponent(Duo.Side side)`
  Returns the Component for the given `Duo.Side`
  `Object`
  `getContextObjectForMarginPanels(ListingPanel panel, MouseEvent event)`
  Gets a marker margin or overview margin context object if the mouse event occurred on one of the GUI components for the indicated listing panel's marker margin (left edge of listing) or overview margin (right edge of listing).
  `ListingPanel`
  `getListingPanel(FieldPanel fieldPanel)`
  Gets the left or right listing panel that contains the indicated field panel.
  `ListingPanel`
  `getListingPanel(Duo.Side side)`
  `String`
  `getName()`
  Force subclasses to supply a descriptive name.
  `void`
  `optionsChanged(ToolOptions options, String optionName, Object oldValue, Object newValue)`
  Notification that an option changed.
  `void`
  `removeHighlightProviders(ListingHighlightProvider leftHighlightProvider, ListingHighlightProvider rightHighlightProvider)`
  Removes the indicated highlight providers from the left and right listing panels.
  `void`
  `setLocation(Duo.Side side, Program program, ProgramLocation location)`
  Sets the cursor for the side to the given location
  `void`
  `setStatusInfo(String text)`
  Displays the indicated text int the tool's status area.
  `void`
  `setSynchronizedScrolling(boolean synchronize)`
  Sets whether or not scrolling is synchronized.
  `void`
  `setVisible(boolean b)`
  `void`
  `updateActionEnablement()`
  Updates the enablement for all actions provided by this panel.
  `void`
  `updateListings()`
  Repaints both the left and right listing panels if they are visible.

  ### Methods inherited from class ghidra.features.base.codecompare.panel.CodeComparisonView

  `addMouseAndFocusListeners, buildPanel, clearComparisons, getActiveSide, getAddresses, getFunction, getProgram, getTool, isSideBySide, loadComparisons, programClosed, programRestored, setActiveSide, setOrientationChangedCallback, setSaveState, setShowDataTitles, setSideBySide, setTitlePrefixes, setTopComponent`

  ### Methods inherited from class javax.swing.JPanel

  `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

  ### Methods inherited from class javax.swing.JComponent

  `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update`

  ### Methods inherited from class java.awt.Container

  `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

  ### Methods inherited from class java.awt.Component

  `action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface ghidra.app.util.viewer.format.FormatModelListener

  `formatModelAdded, formatModelRemoved`

- ## Field Details

  - ### NAME

    public static final String NAME
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### ListingCodeComparisonView

    public ListingCodeComparisonView(String owner, PluginTool tool)
    Creates a comparison panel with two listings.
    Parameters:
      `owner` - the owner of this panel
      `tool` - the tool displaying this panel

- ## Method Details

  - ### getComparisonComponent

    public JComponent getComparisonComponent(Duo.Side side)
    Description copied from class: `CodeComparisonView`
    Returns the Component for the given `Duo.Side`
    Specified by:
      `getComparisonComponent` in class `CodeComparisonView`
    Parameters:
      `side` - the Side to its component
    Returns:
      the Component for the given `Duo.Side`

  - ### getListingPanel

    public ListingPanel getListingPanel(Duo.Side side)

  - ### optionsChanged

    public void optionsChanged(ToolOptions options, String optionName, Object oldValue, Object newValue)
    Description copied from interface: `OptionsChangeListener`
    Notification that an option changed.

    Note: to reject an options change, you can throw a `OptionsVetoException`.

    Specified by:
      `optionsChanged` in interface `OptionsChangeListener`
    Parameters:
      `options` - options object containing the property that changed
      `optionName` - name of option that changed
      `oldValue` - old value of the option
      `newValue` - new value of the option

  - ### getName

    public String getName()
    Description copied from class: `CodeComparisonView`
    Force subclasses to supply a descriptive name.
    Specified by:
      `getName` in class `CodeComparisonView`
    Returns:
      a descriptive name for this panel type

  - ### setVisible

    public void setVisible(boolean b)
    Overrides:
      `setVisible` in class `JComponent`

  - ### addHighlightProviders

    public void addHighlightProviders(ListingHighlightProvider leftHighlightProvider, ListingHighlightProvider rightHighlightProvider)
    Adds the indicated highlight providers for the left and right listing panels.
    Parameters:
      `leftHighlightProvider` - the highlight provider for the left side's listing.
      `rightHighlightProvider` - the highlight provider for the right side's listing.

  - ### removeHighlightProviders

    public void removeHighlightProviders(ListingHighlightProvider leftHighlightProvider, ListingHighlightProvider rightHighlightProvider)
    Removes the indicated highlight providers from the left and right listing panels.
    Parameters:
      `leftHighlightProvider` - the highlight provider for the left side's listing.
      `rightHighlightProvider` - the highlight provider for the right side's listing.

  - ### getActions

    public List<DockingAction> getActions()
    Description copied from class: `CodeComparisonView`
    Returns the actions for this panel
    Overrides:
      `getActions` in class `CodeComparisonView`
    Returns:
      an array of docking actions

  - ### updateActionEnablement

    public void updateActionEnablement()
    Updates the enablement for all actions provided by this panel.
    Specified by:
      `updateActionEnablement` in class `CodeComparisonView`

  - ### setLocation

    public void setLocation(Duo.Side side, Program program, ProgramLocation location)
    Sets the cursor for the side to the given location
    Parameters:
      `side` - The side to goto
      `program` - the side's program
      `location` - the location

  - ### getActiveListingPanel

    public ListingPanel getActiveListingPanel()

  - ### dispose

    public void dispose()
    Description copied from class: `CodeComparisonView`
    Cleans up resources when this panel is no longer needed
    Specified by:
      `dispose` in class `CodeComparisonView`

  - ### getActionContext

    public ActionContext getActionContext(ComponentProvider provider, MouseEvent event)
    Description copied from class: `CodeComparisonView`
    Returns the context object which corresponds to the area of focus within this view's component. Null is returned when there is no context.
    Specified by:
      `getActionContext` in class `CodeComparisonView`
    Parameters:
      `provider` - 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.

  - ### updateListings

    public void updateListings()
    Repaints both the left and right listing panels if they are visible.

  - ### formatModelChanged

    public void formatModelChanged(FieldFormatModel model)
    Description copied from interface: `FormatModelListener`
    Notifies that the given format model was changed.
    Specified by:
      `formatModelChanged` in interface `FormatModelListener`
    Parameters:
      `model` - the model that was changed.

  - ### getListingPanel

    public ListingPanel getListingPanel(FieldPanel fieldPanel)
    Gets the left or right listing panel that contains the indicated field panel.
    Parameters:
      `fieldPanel` - the field panel
    Returns:
      the listing panel or null.

  - ### setStatusInfo

    public void setStatusInfo(String text)
    Displays the indicated text int the tool's status area.
    Parameters:
      `text` - the message to display

  - ### getContextObjectForMarginPanels

    public Object getContextObjectForMarginPanels(ListingPanel panel, MouseEvent event)
    Gets a marker margin or overview margin context object if the mouse event occurred on one of the GUI components for the indicated listing panel's marker margin (left edge of listing) or overview margin (right edge of listing).
    Parameters:
      `panel` - The listing panel to check
      `event` - the mouse event
    Returns:
      a marker margin context object if the event was on a margin.

  - ### setSynchronizedScrolling

    public void setSynchronizedScrolling(boolean synchronize)
    Description copied from class: `CodeComparisonView`
    Sets whether or not scrolling is synchronized.
    Specified by:
      `setSynchronizedScrolling` in class `CodeComparisonView`
    Parameters:
      `synchronize` - true means synchronize scrolling between the two views.

  - ### comparisonDataChanged

    protected void comparisonDataChanged()
    Description copied from class: `CodeComparisonView`
    Notification to subclasses that the comparison data has changed
    Specified by:
      `comparisonDataChanged` in class `CodeComparisonView`