Class CodeComparisonPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ghidra.features.base.codecompare.panel.CodeComparisonPanel
- All Implemented Interfaces:
ExtensionPoint,ImageObserver,MenuContainer,Serializable,Accessible
- Direct Known Subclasses:
ListingCodeComparisonPanel
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Duo.Sideprotected Duo<ComparisonData> static final Stringprotected Stringprotected PluginToolFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCodeComparisonPanel(String owner, PluginTool tool) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidvoidClears out the current comparisonDatasprotected abstract voidNotification to subclasses that the comparison data has changedabstract voiddispose()Cleans up resources when this panel is no longer neededabstract ActionContextgetActionContext(ComponentProvider componentProvider, MouseEvent event) Returns the context object which corresponds to the area of focus within this provider's component.Returns the actions for this panelReturns theDuo.Sidethat is currently activegetAddresses(Duo.Side side) Returns the addresses being shown in the given side.abstract JComponentReturns the Component for the givenDuo.SidegetFunction(Duo.Side side) Returns the function being shown in the given side.abstract StringgetName()Force subclasses to supply a descriptive name.getProgram(Duo.Side side) Returns the program being shown in the given side.getTool()booleanReturns true if dual panels are displayed horizontally, false if displayed vertically.voidloadComparisons(ComparisonData left, ComparisonData right) Displays a comparison of two ComparisonData objectsvoidprogramClosed(Program program) Called when a program is closed.voidprogramRestored(Program program) Called when the indicated program has been restored because of an Undo/Redo.protected voidsetActiveSide(Duo.Side side) voidsetShowDataTitles(boolean showTitles) Toggles whether or not to display data titles for each side.voidsetSideBySide(boolean b) Sets the orientation for the dual panels.abstract voidsetSynchronizedScrolling(boolean b) Sets whether or not scrolling is synchronized.voidsetTitlePrefixes(String leftTitlePrefix, String rightTitlePrefix) A CodeComparisonPanel should provide a title based on what the code comparison panel is displaying.voidsetTopComponent(JComponent component) Sets the component displayed in the top of this panel.abstract voidUpdates the enablement for any actions created by this code comparison panel.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, setVisible, unregisterKeyboardAction, updateMethods 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, validateTreeMethods 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
-
Field Details
-
HELP_TOPIC
- See Also:
-
owner
-
tool
-
comparisonData
-
activeSide
-
-
Constructor Details
-
CodeComparisonPanel
Constructor- Parameters:
owner- the name of the owner of this componenttool- the tool that contains the component
-
-
Method Details
-
getTool
-
loadComparisons
Displays a comparison of two ComparisonData objects- Parameters:
left- the comparisonData for the left sideright- the comparisonData for the right side
-
clearComparisons
public void clearComparisons()Clears out the current comparisonDatas -
getActions
Returns the actions for this panel- Returns:
- an array of docking actions
-
setShowDataTitles
public void setShowDataTitles(boolean showTitles) Toggles whether or not to display data titles for each side.- Parameters:
showTitles- true to show data titles
-
isSideBySide
public boolean isSideBySide()Returns true if dual panels are displayed horizontally, false if displayed vertically.- Returns:
- true if dual panels are displayed horizontally, false if displayed vertically
-
setSideBySide
public void setSideBySide(boolean b) Sets the orientation for the dual panels.- Parameters:
b- if true, panels will be display horizontally, otherwise vertically
-
getName
Force subclasses to supply a descriptive name. -
dispose
public abstract void dispose()Cleans up resources when this panel is no longer needed -
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
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.
-
programClosed
Called when a program is closed.- Parameters:
program- the closed program
-
getActiveSide
Returns theDuo.Sidethat is currently active- Returns:
- the
Duo.Sidethat is currently active
-
setTopComponent
Sets the component displayed in the top of this panel.- Parameters:
component- the component.
-
setTitlePrefixes
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.
-
getProgram
Returns the program being shown in the given side.- Parameters:
side- theDuo.Sideto get the program for- Returns:
- the program for the given side.
-
getFunction
Returns the function being shown in the given side.- Parameters:
side- theDuo.Sideto get the function for- Returns:
- the function for the given side.
-
getAddresses
Returns the addresses being shown in the given side.- Parameters:
side- theDuo.Sideto get the program for- Returns:
- the address set for the given side
-
updateActionEnablement
public abstract void updateActionEnablement()Updates the enablement for any actions created by this code comparison panel. -
setSynchronizedScrolling
public abstract void setSynchronizedScrolling(boolean b) Sets whether or not scrolling is synchronized.- Parameters:
b- true means synchronize scrolling between the two views.
-
getComparisonComponent
Returns the Component for the givenDuo.Side- Parameters:
side- the Side to its component- Returns:
- the Component for the given
Duo.Side
-
comparisonDataChanged
protected abstract void comparisonDataChanged()Notification to subclasses that the comparison data has changed -
buildPanel
protected final void buildPanel() -
setActiveSide
-