Class PluginContextFactory


  • public final class PluginContextFactory
    extends java.lang.Object
    A factory for PluginContext instances.
    Since:
    3.0
    Author:
    Chris Jennings
    • Method Detail

      • createContext

        public static PluginContext createContext​(AbstractInstalledPlugin ip,
                                                  int modifiers)
                                           throws PluginException
        Creates a plug-in context for the plug-in currently managed by the specified installed plug-in instance.
        Parameters:
        ip - the installed plug-in whose plug-in instance will use the context
        modifiers - a bitmap of the modifier keys to indicate are currently pressed, or 0
        Returns:
        a suitable plug-in context
        Throws:
        PluginException - if an exception occurs while accessing the plug-in
      • createProbeContext

        public static PluginContext createProbeContext​(AbstractInstalledPlugin ip,
                                                       Plugin p)
                                                throws PluginException
        Creates a plug-in context suitable for probing the plug-in currently managed by the specified installed plug-in instance.
        Parameters:
        ip - the installed plug-in whose plug-in instance will use the context
        p - the plug-in to be probed
        Returns:
        a suitable plug-in context
        Throws:
        PluginException - if an exception occurs while accessing the plug-in
      • createContext

        public static PluginContext createContext​(Plugin plugin,
                                                  int modifiers)
        Creates a context for a plug-in. The plug-in must be the active plug-in instance for an InstalledPlugin.
        Parameters:
        plugin - the plug-in to look up the installed plug-in for
        modifiers - the modifier keys to indicate are currently pressed
        Returns:
        a suitable plug-in context
        Throws:
        java.lang.IllegalArgumentException - if the plug-in is not being managed by any installed plug-in
        See Also:
        BundleInstaller.getInstalledPlugins()
      • createProbeContext

        public static PluginContext createProbeContext​(Plugin plugin)
        Creates a context suitable for probing a plug-in. The plug-in must be the active plug-in instance for an InstalledPlugin.
        Parameters:
        plugin - the plug-in to look up the installed plug-in for
        Returns:
        a suitable plug-in context
        Throws:
        java.lang.IllegalArgumentException - if the plug-in is not being managed by any installed plug-in
        See Also:
        BundleInstaller.getInstalledPlugins()
      • createDummyContext

        public static PluginContext createDummyContext()
        Returns a dummy context. Dummy contexts are used when a script is run from a code editor. They provide basic functionality so that plug-in developers can test plug-in scripts by running the script directly from the editor.
        Returns:
        a dummy plug-in context
      • createDummyContext

        public static PluginContext createDummyContext​(int modifiers)
        Returns a dummy context. Dummy contexts are used when a script is run from a code editor. They provide basic functionality so that plug-in developers can test plug-in scripts by running the script directly from the editor.
        Parameters:
        modifiers - a bit mask of the modifier keys that the context will report as being held down at activation
        Returns:
        a dummy plug-in context