Class AbstractScreenShotGenerator

    • Field Detail

      • SAVE_CREATED_IMAGE_FILE_KEY

        protected static final java.lang.String SAVE_CREATED_IMAGE_FILE_KEY
        See Also:
        Constant Field Values
      • SAVE_CREATED_IMAGE_FILE

        protected static final boolean SAVE_CREATED_IMAGE_FILE
      • NEW_FILENAME_SUFFIX_KEY

        protected static final java.lang.String NEW_FILENAME_SUFFIX_KEY
        See Also:
        Constant Field Values
      • DEFAULT_FILENAME_SUFFIX

        protected static final java.lang.String DEFAULT_FILENAME_SUFFIX
        See Also:
        Constant Field Values
      • NEW_FILENAME_SUFFIX

        protected static final java.lang.String NEW_FILENAME_SUFFIX
      • image

        public java.awt.Image image
    • Constructor Detail

      • AbstractScreenShotGenerator

        public AbstractScreenShotGenerator()
    • Method Detail

      • setUp

        public void setUp()
                   throws java.lang.Exception
        Throws:
        java.lang.Exception
      • tearDown

        public void tearDown()
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • prepareTool

        public void prepareTool()
      • loadProgram

        public void loadProgram()
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • closeNonProgramArchives

        public void closeNonProgramArchives()
      • loadProgram

        public Program loadProgram​(java.lang.String programName)
      • exit

        public void exit()
      • setUser

        public void setUser​(java.lang.String userName)
      • setDockIcon

        protected void setDockIcon()
      • addr

        public Address addr​(long value)
      • setToolSize

        public void setToolSize​(int width,
                                int height)
      • setWindowSize

        public void setWindowSize​(java.awt.Window window,
                                  int width,
                                  int height)
      • performAction

        public void performAction​(java.lang.String actionName,
                                  java.lang.String owner,
                                  boolean wait)
      • performDialogAction

        public void performDialogAction​(java.lang.String actionName,
                                        boolean wait)
      • performAction

        public void performAction​(java.lang.String actionName,
                                  java.lang.String owner,
                                  ComponentProvider contextProvider,
                                  boolean wait)
      • showOptions

        public void showOptions​(java.lang.String optionsCategoryName)
      • showProgramOptions

        public void showProgramOptions​(java.lang.String optionsCategoryName)
      • getCursorBounds

        public java.awt.Rectangle getCursorBounds()
      • pressOkOnDialog

        public void pressOkOnDialog()
      • pressButtonOnDialog

        public void pressButtonOnDialog​(java.lang.String buttonText)
      • captureIsolatedComponent

        public void captureIsolatedComponent​(javax.swing.JComponent component,
                                             int width,
                                             int height)
      • captureComponent

        public java.awt.Image captureComponent​(java.awt.Component component)
      • captureIsolatedProviderWindow

        public void captureIsolatedProviderWindow​(java.lang.Class<? extends ComponentProvider> clazz,
                                                  int width,
                                                  int height)
        The same as captureIsolatedProvider(Class, int, int) except this method will also capture the containing window.
        Parameters:
        clazz - the provider class
        width - the width of the capture
        height - the height of the capture
      • captureIsolatedProvider

        public void captureIsolatedProvider​(java.lang.Class<? extends ComponentProvider> clazz,
                                            int width,
                                            int height)
      • captureIsolatedProvider

        public void captureIsolatedProvider​(ComponentProvider provider,
                                            int width,
                                            int height)
      • moveProviderToFront

        public void moveProviderToFront​(ComponentProvider provider,
                                        int width,
                                        int height)
      • moveProviderToFront

        public void moveProviderToFront​(ComponentProvider provider)
      • moveWindowUp

        public void moveWindowUp​(java.awt.Window window,
                                 int yOffset)
      • moveProviderToItsOwnWindow

        public java.awt.Window moveProviderToItsOwnWindow​(ComponentProvider provider)
      • moveProviderToItsOwnWindow

        public java.awt.Window moveProviderToItsOwnWindow​(ComponentProvider provider,
                                                          int width,
                                                          int height)
      • captureMenu

        public void captureMenu()
      • getPopupMenu

        public javax.swing.JPopupMenu getPopupMenu()
      • captureProvider

        public void captureProvider​(java.lang.Class<? extends ComponentProvider> clazz)
      • captureProvider

        public void captureProvider​(java.lang.String name)
      • captureProviderWithScreenShot

        public void captureProviderWithScreenShot​(ComponentProvider provider)
        Captures the provider by using a screen shot and not by painting the provider directly (as does captureProvider(ComponentProvider)). Use this method if you need to capture the provider along with any popup windows.
        Parameters:
        provider - the provider
      • captureProviderWindow

        public void captureProviderWindow​(java.lang.String name)
        Captures the window, including decorations. This will use a Robot to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.

        Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see captureProvider(Class).

        Parameters:
        name - the provider's name
      • captureProviderWindow

        public void captureProviderWindow​(java.lang.Class<? extends ComponentProvider> clazz)
        Captures the window, including decorations. This will use a Robot to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.

        Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see captureProvider(Class).

        Parameters:
        clazz - the provider's class
      • captureProviderWindow

        public void captureProviderWindow​(ComponentProvider provider)
        Captures the window, including decorations. This will use a Robot to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.

        Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see captureProvider(Class).

        Parameters:
        provider - the provider
      • captureProviderWindow

        public void captureProviderWindow​(java.lang.String name,
                                          int width,
                                          int height)
        Captures the window, including decorations. This will use a Robot to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.

        Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see captureProvider(Class).

        Parameters:
        name - the provider's name
        width - the desired width
        height - the desired height
      • captureProviderWindow

        public void captureProviderWindow​(ComponentProvider provider,
                                          int width,
                                          int height)
        Captures the window, including decorations. This will use a Robot to create a screen capture, which has the effect of getting all items within the window bounds. This method is needed if you wish to capture child windows, like popups/hovers.

        Other capture methods will not use the screen capture mechanism, but rather will directly render the given component. In this case, subordinate windows will not be captured. For example, see captureProvider(Class).

        Parameters:
        provider - the provider's name
        width - the desired width
        height - the desired height
      • showProvider

        public <T extends ComponentProvider> T showProvider​(java.lang.Class<T> clazz)
      • closeProvider

        public void closeProvider​(java.lang.Class<? extends ComponentProvider> clazz)
      • captureDialog

        public void captureDialog()
      • captureDialog

        public void captureDialog​(int width,
                                  int height)
      • paintFix

        protected void paintFix​(java.awt.Window window)
      • captureDialog

        public void captureDialog​(java.lang.String title)
      • captureDialog

        public void captureDialog​(java.lang.Class<? extends DialogComponentProvider> clazz,
                                  int width,
                                  int height)
      • captureWindow

        public void captureWindow()
      • captureWindow

        public void captureWindow​(java.awt.Window window)
      • captureWindow

        public void captureWindow​(java.awt.Window window,
                                  int width,
                                  int height)
      • captureToolWindow

        public void captureToolWindow​(int width,
                                      int height)
      • captureDialog

        public void captureDialog​(java.awt.Dialog dialog)
      • captureDialog

        public void captureDialog​(java.awt.Dialog dialog,
                                  int width,
                                  int height)
      • captureListingField

        public void captureListingField​(long address,
                                        java.lang.String fieldName,
                                        int padding)
      • generateImage

        public void generateImage​(java.awt.Component c)
      • captureComponents

        public void captureComponents​(java.util.List<java.awt.Component> comps)
      • captureMenuBarMenu

        public void captureMenuBarMenu​(java.lang.String menuName,
                                       java.lang.String... subMenuNames)
      • captureMenuBarMenuHierachy

        public void captureMenuBarMenuHierachy​(java.lang.String menuName,
                                               java.lang.String... subMenuNames)
      • captureListingRange

        public void captureListingRange​(long start,
                                        long end,
                                        int width)
      • error

        public void error​(java.lang.Exception e)
      • setListingFieldWidth

        public void setListingFieldWidth​(java.lang.String fieldName,
                                         int width)
      • getField

        public Field getField​(java.awt.Point point)
      • leftClickCursor

        public void leftClickCursor()
      • rightClickCursor

        public void rightClickCursor()
      • middleClickCursor

        public void middleClickCursor()
      • doubleClickCursor

        public void doubleClickCursor()
      • selectRow

        public void selectRow​(javax.swing.JTable table,
                              int rowIndex)
      • setSelected

        public void setSelected​(javax.swing.JToggleButton button,
                                boolean select)
      • hideTableColumn

        public void hideTableColumn​(GTable table,
                                    java.lang.String columnName)
      • showMenuBarMenu

        public java.util.List<java.awt.Component> showMenuBarMenu​(java.lang.String menuName,
                                                                  java.lang.String... submenuNames)
      • showColumnSettings

        public void showColumnSettings​(GTable table,
                                       java.lang.String colName)
      • showTableColumn

        public void showTableColumn​(GTable table,
                                    java.lang.String columnName)
      • setSelectedAnayzer

        public void setSelectedAnayzer​(java.lang.Object analysisPanel,
                                       java.lang.String analyzerName)
      • showCommentDialog

        public void showCommentDialog​(java.lang.String text)
      • prepareCommentsDialog

        public void prepareCommentsDialog​(ghidra.app.plugin.core.comments.CommentsDialog dialog,
                                          java.lang.String annotationText)
      • createBookmark

        public void createBookmark​(long address)
      • selectRow

        public void selectRow​(javax.swing.JTable table,
                              java.lang.String searchString)
      • scrollToRow

        public void scrollToRow​(javax.swing.JTable table,
                                int row)
      • findRowByPartialText

        public int findRowByPartialText​(javax.swing.JTable table,
                                        java.lang.String searchString)
      • performMemorySearch

        public void performMemorySearch​(java.lang.String searchString)
      • removeField

        public void removeField​(java.lang.String fieldName)
      • showAnalysisOptions

        public void showAnalysisOptions​(java.lang.String selectedAnalyzerName)
      • removeFlowArrows

        public void removeFlowArrows()
      • makeSelection

        public void makeSelection​(AddressSet addrSet)
      • addSelection

        public void addSelection​(long start,
                                 long end)
      • makeSelection

        public void makeSelection​(long start,
                                  long end)
      • go

        public void go​(long address)
      • goToListing

        public void goToListing​(long address)
      • goToListing

        public void goToListing​(long address,
                                boolean scrollToMiddle)
      • goToListing

        public void goToListing​(long address,
                                java.lang.String fieldName,
                                boolean scrollToMiddle)
      • positionCursor

        public void positionCursor​(long address)
      • positionCursor

        public void positionCursor​(long address,
                                   java.lang.String fieldName)
      • positionListingTop

        public void positionListingTop​(long address)
      • positionListingCenter

        public void positionListingCenter​(long address)
      • topOfListing

        @Deprecated
        public void topOfListing​(long address)
        Deprecated.
      • loadPlugin

        public Plugin loadPlugin​(java.lang.Class<? extends Plugin> clazz)
      • loadPlugin

        public Plugin loadPlugin​(java.lang.String className)
      • getProvider

        public <T extends ComponentProvider> T getProvider​(java.lang.Class<T> clazz)
      • findProviderToolBarButton

        public javax.swing.JButton findProviderToolBarButton​(ComponentProvider provider,
                                                             java.lang.String actionName)
      • address

        @Deprecated
        public Address address​(long value)
        Deprecated.
        use addr(long) instead
        Parameters:
        value - the address's long value
        Returns:
        the new address
      • getBounds

        public java.awt.Rectangle getBounds​(javax.swing.JComponent component)
      • drawRectangleWithDropShadowAround

        public void drawRectangleWithDropShadowAround​(javax.swing.JComponent component,
                                                      java.awt.Color color,
                                                      int padding)
      • drawRectangleAround

        public java.awt.Rectangle drawRectangleAround​(javax.swing.JComponent component,
                                                      java.awt.Color color,
                                                      int padding)
      • drawRectangleAround

        public java.awt.Rectangle drawRectangleAround​(javax.swing.JComponent component,
                                                      javax.swing.JComponent root,
                                                      java.awt.Color color,
                                                      int padding)
        Draws a rectangle around the given component. The root parameter is used to calculate screen coordinates. This allows you to capture a sub-component of a UI, drawing rectangles around children of said sub-component.

        If you are unsure of what to pass for root, the call drawRectangleAround(JComponent, Color, int) instead.

        Parameters:
        component - the component to be en-rectangled
        root - the outermost container widget being displayed; null implies a top-level parent
        color - the rectangle color
        padding - the space between the rectangle and the component; more space makes the component more visible
        Returns:
        the bounds of the drawn rectangle
      • drawRectangle

        public java.awt.Rectangle drawRectangle​(java.awt.Color c,
                                                java.awt.Rectangle r,
                                                int padding,
                                                int thickness)
      • drawBorder

        public void drawBorder​(java.awt.Color c)
      • drawRectangle

        public void drawRectangle​(java.awt.Color c,
                                  java.awt.Rectangle rect,
                                  int thickness)
      • fillRectangle

        public void fillRectangle​(java.awt.Color c,
                                  java.awt.Rectangle rect)
      • drawOval

        public void drawOval​(java.awt.Color c,
                             java.awt.Rectangle rect,
                             int thickness)
      • drawText

        public void drawText​(java.lang.String text,
                             java.awt.Color color,
                             java.awt.Point start,
                             float size)
      • drawText

        public void drawText​(java.lang.String text,
                             java.awt.Color color,
                             java.awt.Point start,
                             java.awt.Font font)
      • drawLine

        public void drawLine​(java.awt.Color c,
                             int thickness,
                             java.awt.Point start,
                             java.awt.Point end)
      • drawArrow

        public void drawArrow​(java.awt.Color c,
                              java.awt.Point start,
                              java.awt.Point end)
      • drawArrow

        public void drawArrow​(java.awt.Color c,
                              int thickness,
                              java.awt.Point start,
                              java.awt.Point end,
                              int arrowSize)
      • writeFile

        protected void writeFile​(java.io.File imageFile)
      • readImage

        protected java.awt.image.BufferedImage readImage​(java.io.File imageFile)
      • crop

        public java.awt.Image crop​(java.awt.Rectangle bounds)
      • padImage

        public java.awt.Image padImage​(java.awt.Color c,
                                       int top,
                                       int left,
                                       int right,
                                       int bottom)
      • placeImagesSideBySide

        public java.awt.Image placeImagesSideBySide​(java.awt.Image left,
                                                    java.awt.Image right)
      • createEmptyImage

        public java.awt.image.BufferedImage createEmptyImage​(int width,
                                                             int height)
      • takeSnippet

        public java.awt.Image takeSnippet​(java.awt.Rectangle bounds)
        Crops a part of the current image, keeping what is inside the given bounds. This method creates a shape such that the top and bottom of the cropped image have a jagged line, looking somewhat like a sideways lightening bolt.
        Parameters:
        bounds - the bounds to keep
        Returns:
        the snippet
      • setDividerPercentage

        public void setDividerPercentage​(java.lang.Class<? extends ComponentProvider> provider1,
                                         java.lang.Class<? extends ComponentProvider> provider2,
                                         float percentage)
      • findChildWithType

        public <T extends javax.swing.JComponent> T findChildWithType​(java.awt.Container node,
                                                                      java.lang.Class<T> cls,
                                                                      java.util.function.Predicate<T> pred)
      • findComponent

        public <T extends javax.swing.JComponent> T findComponent​(java.lang.Class<T> cls,
                                                                  java.util.function.Predicate<T> pred)
      • showTab

        public java.awt.Component showTab​(java.lang.String title)