Package ghidra.app.decompiler.component
Class DecompilerCodeComparisonPanel<T extends DualDecompilerFieldPanelCoordinator>
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
ghidra.app.util.viewer.util.CodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
ghidra.app.decompiler.component.DecompilerCodeComparisonPanel<T>
- All Implemented Interfaces:
ExtensionPoint,FocusListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible
public abstract class DecompilerCodeComparisonPanel<T extends DualDecompilerFieldPanelCoordinator>
extends CodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
Panel that displays two decompilers for comparison
- 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
Fields inherited from class ghidra.app.util.viewer.util.CodeComparisonPanel
bottomComp, currProgramIndex, data, EMPTY_ADDRESS_SET, FOCUS_BORDER, functions, LEFT, leftTitlePrefix, MINIMUM_PANEL_WIDTH, NON_FOCUS_BORDER, owner, programs, RIGHT, rightTitlePrefix, titlePanels, tool, topCompFields 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
ConstructorsConstructorDescriptionDecompilerCodeComparisonPanel(String owner, PluginTool tool) Creates a comparison panel with two decompilers -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds the indicated listener to be notified when the decompile results have completed.protected voidCreates the actions provided by this panel.protected abstract DualDecompilerFieldPanelCoordinatorCreates a new FieldPanelCoordinator used to synchronize scrolling between the left and right view for this CodeComparisonPanel.voiddispose()Cleans up resources when this panel is no longer neededvoidgetActionContext(ComponentProvider provider, MouseEvent event) Returns the context object which corresponds to the area of focus within this provider's component.Returns the actions for this panelThe GUI component for this CodeComparisonPanelGets the display panel from the left or right side that has or last had focus.Gets the addresses loaded in the left side of this panel.Gets the left side's decompiler panel.Gets the left field panel for this CodeComparisonPanel.Gets the left side's C display panel.Gets the addresses loaded in the right side of this panel.Gets the right side's decompiler panel.Gets the right field panel for this CodeComparisonPanel.Gets the right side's C display panel.getTitle()The title for this code comparison panelbooleanprotected voidleftDecompileDataSet(DecompileData decompileData) booleanDetermines if the left code panel currently has focus.voidloadAddresses(Program leftProgram, Program rightProgram, AddressSetView leftAddresses, AddressSetView rightAddresses) Displays program information for a particular set of addresses in the two programs being comparedvoidDisplays a comparison of two program's data itemsvoidloadFunctions(Function leftFunction, Function rightFunction) Displays a comparison of two program's functionsvoidprogramRestored(Program program) Called when the indicated program has been restored because of an Undo/Redo.voidRefreshes the left side of this panel.voidRefreshes the right side of this panel.booleanRemoves the indicated listener from being notified about decompile results.protected voidrightDecompileDataSet(DecompileData decompileData) voidsetBottomComponent(JComponent comp) Sets the component displayed in the bottom of this panel.voidsetFieldPanelCoordinator(DualDecompilerFieldPanelCoordinator fieldPanelCoordinator) Sets the coordinator for the two decompiler panels within this code comparison panel.voidsetHighlightControllers(ClangHighlightController leftHighlightController, ClangHighlightController rightHighlightController) Sets the highlight controllers for both decompiler panels.voidsetLeftTitle(String leftTitle) Sets the title for the left side's decompiler.voidsetMouseNavigationEnabled(boolean enabled) Disable mouse navigation from within this dual decompiler panel.protected voidsetPrograms(Program leftProgram, Program rightProgram) Specifies the two programs to be compared by this panelvoidsetRightTitle(String rightTitle) Sets the title for the right side's decompiler.voidsetTitlePrefixes(String leftTitlePrefix, String rightTitlePrefix) A CodeComparisonPanel should provide a title based on what the code comparison panel is displaying.voidsetTopComponent(JComponent comp) Sets the component displayed in the top of this panel.voidsetVisible(boolean aFlag) voidUpdates the enablement for any actions created by this code comparison panel.Methods inherited from class ghidra.app.util.viewer.util.CodeComparisonPanel
focusLost, getFieldPanelCoordinator, getLeftData, getLeftFunction, getLeftProgram, getRightData, getRightFunction, getRightProgram, getShowTitles, isScrollingSynced, setScrollingSyncState, setShowTitlesMethods 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, 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, getName, 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
-
Constructor Details
-
DecompilerCodeComparisonPanel
Creates a comparison panel with two decompilers- Parameters:
owner- the owner of this paneltool- the tool displaying this panel
-
-
Method Details
-
getComponent
Description copied from class:CodeComparisonPanelThe GUI component for this CodeComparisonPanel- Specified by:
getComponentin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the component
-
getTitle
Description copied from class:CodeComparisonPanelThe title for this code comparison panel- Specified by:
getTitlein classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the title
-
setVisible
public void setVisible(boolean aFlag) - Overrides:
setVisiblein classJComponent
-
setLeftTitle
Sets the title for the left side's decompiler.- Parameters:
leftTitle- the title
-
setRightTitle
Sets the title for the right side's decompiler.- Parameters:
rightTitle- the title
-
isMatchingConstantsExactly
public boolean isMatchingConstantsExactly() -
loadFunctions
Description copied from class:CodeComparisonPanelDisplays a comparison of two program's functions- Specified by:
loadFunctionsin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
leftFunction- the function to show in the left side of the code comparison viewrightFunction- the function to show in the right side of the code comparison view
-
addDualDecompileResultsListener
Adds the indicated listener to be notified when the decompile results have completed.- Parameters:
listener- the listener- Returns:
- true if the listener was added.
-
removeDualDecompileResultsListener
Removes the indicated listener from being notified about decompile results.- Parameters:
listener- the listener- Returns:
- true if the listener was removed.
-
setHighlightControllers
public void setHighlightControllers(ClangHighlightController leftHighlightController, ClangHighlightController rightHighlightController) Sets the highlight controllers for both decompiler panels.- Parameters:
leftHighlightController- the left side's highlight controllerrightHighlightController- the right side's highlight controller
-
setFieldPanelCoordinator
Sets the coordinator for the two decompiler panels within this code comparison panel. It coordinates their scrolling and location synchronization.- Overrides:
setFieldPanelCoordinatorin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
fieldPanelCoordinator- the coordinator for the two decompiler panels
-
rightDecompileDataSet
-
leftDecompileDataSet
-
setTopComponent
Sets the component displayed in the top of this panel.- Parameters:
comp- the component.
-
setBottomComponent
Sets the component displayed in the bottom of this panel.- Parameters:
comp- the component.
-
getFocusedDecompilerPanel
Gets the display panel from the left or right side that has or last had focus.- Returns:
- the last C display panel with focus
-
getLeftPanel
Gets the left side's C display panel.- Returns:
- the left C display panel
-
getRightPanel
Gets the right side's C display panel.- Returns:
- the right C display panel
-
dispose
public void dispose()Description copied from class:CodeComparisonPanelCleans up resources when this panel is no longer needed- Specified by:
disposein classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
-
focusGained
-
setPrograms
Description copied from class:CodeComparisonPanelSpecifies the two programs to be compared by this panel- Specified by:
setProgramsin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
leftProgram- the program for the left siderightProgram- the program for the right side
-
loadData
Description copied from class:CodeComparisonPanelDisplays a comparison of two program's data items- Specified by:
loadDatain classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
leftData- the data item to show in the left side of the code comparison viewrightData- the data item to show in the right side of the code comparison view
-
loadAddresses
public void loadAddresses(Program leftProgram, Program rightProgram, AddressSetView leftAddresses, AddressSetView rightAddresses) Description copied from class:CodeComparisonPanelDisplays program information for a particular set of addresses in the two programs being compared- Specified by:
loadAddressesin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
leftProgram- the program in the left side of the code comparison viewrightProgram- the program in the right side of the code comparison viewleftAddresses- the addresses of the program info to show in the left siderightAddresses- the addresses of the program info to show in the right side
-
getLeftDecompilerPanel
Gets the left side's decompiler panel.- Returns:
- the left decompiler panel
-
getRightDecompilerPanel
Gets the right side's decompiler panel.- Returns:
- the right decompiler panel
-
updateActionEnablement
public void updateActionEnablement()Description copied from class:CodeComparisonPanelUpdates the enablement for any actions created by this code comparison panel.- Specified by:
updateActionEnablementin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
-
createActions
protected void createActions()Creates the actions provided by this panel. -
getActions
Description copied from class:CodeComparisonPanelReturns the actions for this panel- Overrides:
getActionsin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- an array of docking actions
-
getActionContext
Description copied from class:CodeComparisonPanelReturns the context object which corresponds to the area of focus within this provider's component. Null is returned when there is no context.- Specified by:
getActionContextin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- 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.
-
programRestored
Description copied from class:CodeComparisonPanelCalled 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.- Specified by:
programRestoredin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Parameters:
program- the program that was restored.
-
refreshLeftPanel
public void refreshLeftPanel()Refreshes the left side of this panel.- Specified by:
refreshLeftPanelin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
-
refreshRightPanel
public void refreshRightPanel()Refreshes the right side of this panel.- Specified by:
refreshRightPanelin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>
-
leftPanelHasFocus
public boolean leftPanelHasFocus()Description copied from class:CodeComparisonPanelDetermines if the left code panel currently has focus.- Specified by:
leftPanelHasFocusin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- true if the left side of the code comparison has focus.
-
setTitlePrefixes
Description copied from class:CodeComparisonPanelA 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.- Specified by:
setTitlePrefixesin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- 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.
-
getLeftAddresses
Description copied from class:CodeComparisonPanelGets the addresses loaded in the left side of this panel.- Specified by:
getLeftAddressesin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the addresses or an empty set
-
getRightAddresses
Description copied from class:CodeComparisonPanelGets the addresses loaded in the right side of this panel.- Specified by:
getRightAddressesin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the addresses or an empty set
-
getLeftFieldPanel
Description copied from class:CodeComparisonPanelGets the left field panel for this CodeComparisonPanel.- Specified by:
getLeftFieldPanelin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the left FieldPanel.
-
getRightFieldPanel
Description copied from class:CodeComparisonPanelGets the right field panel for this CodeComparisonPanel.- Specified by:
getRightFieldPanelin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- the right FieldPanel.
-
createFieldPanelCoordinator
Description copied from class:CodeComparisonPanelCreates a new FieldPanelCoordinator used to synchronize scrolling between the left and right view for this CodeComparisonPanel.- Specified by:
createFieldPanelCoordinatorin classCodeComparisonPanel<DualDecompilerFieldPanelCoordinator>- Returns:
- a new FieldPanelCoordinator
-