Class ContextProvider

java.lang.Object
org.eclipse.mat.query.ContextProvider

public abstract class ContextProvider extends Object
Base class for context provider which is an object which returns the heap objects represented by an arbitrary row in a table/tree. This is used by IResult.getResultMetaData() to provide additional information about rows in a report.
See Also:
  • Constructor Details

    • ContextProvider

      public ContextProvider(String label)
      Creates a ContextProvider which will be queried later to find out more details about a row in a report.
      Parameters:
      label - The label used for context menus.
    • ContextProvider

      public ContextProvider(String label, ContextDerivedData.DerivedOperation... operations)
      Creates a ContextProvider which will be queried later to find out more details about a row in a report.
      Parameters:
      label - The label used for context menus.
      operations - operations which can be used to calculate extra column information
    • ContextProvider

      public ContextProvider(ContextProvider template)
      Constructor using copying values from the give template context provider.
      Parameters:
      template - a similar ContextProvider
  • Method Details

    • getLabel

      public String getLabel()
      The label for this context provider. Used for context menus to provide a root menu item, with all the queries for this context as sub-items.
      Returns:
      the label
    • isDefault

      public final boolean isDefault()
      The default context provider is that for the whole snapshot.
      Returns:
      true if it represents the whole snapshot
    • hasSameTarget

      public final boolean hasSameTarget(ContextProvider other)
      Used to see if two context providers are the same.
      Parameters:
      other - the other context provider to compare
      Returns:
      true if they are the same
    • getOperations

      public ContextDerivedData.DerivedOperation[] getOperations()
      Extra operations to calculate more columns.
      Returns:
      an array of extra operations, could be empty, but not null
    • getIcon

      public URL getIcon()
      Returns an icon which could be used on context menus as a top level to represent this entire type of data available from an IStructuredResult.
      Returns:
      a URL which can be used to get the icon, can be null
      Since:
      1.1
    • getContext

      public abstract IContextObject getContext(Object row)
      Return the context object associated with the specified row.
      Parameters:
      row - the row requested
      Returns:
      details of the row