Class DefaultContextMenuManager

java.lang.Object
de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.editing_tools.ContextMenuManager
de.ipk_gatersleben.ag_nw.graffiti.plugins.gui.editing_tools.DefaultContextMenuManager
All Implemented Interfaces:
IContextMenuManager

public class DefaultContextMenuManager
extends ContextMenuManager
This is the default context menu manager, that is used by the enhanced editing tools for displaying a context menu. Currently two ways to add context menus exist: (1) Plugin-Algorithms can implement the interface AlgorithmWithContextMenu. (2a) BeanShell Scripts can be placed in the home folder (extension .bsh). There the menu command text is detected from the first line of text. "// (at)Test-Command " would result in the Menu Item "Test-Command" ("//" is replaced by "" and then a String.trim() call is issued). Only scripts with a (at) in the first line will be placed in the context menu. (2b) The search folder (standard is the home directory) for the .bsh commands can be modified by adding a "scriptHomes" variable in the "~./.bshrc" init script. My sources the .bshrc file and uses this variable. Example: .bshrc: scriptHomes = "/home/klukas;/tmp"; ==> the home and the temp path will be scanned for ".bsh" files.
Author:
Christian Klukas
  • Constructor Details

    • DefaultContextMenuManager

      public DefaultContextMenuManager()
  • Method Details

    • getContextMenu

      public JPopupMenu getContextMenu​(MouseEvent e)
      Description copied from interface: IContextMenuManager
      This Method returns a Context Menu.
      Parameters:
      e - The MouseEvent to be processed.
      Returns:
      ContextMenu for the MouseEvent
    • returnScriptMenu

      public static void returnScriptMenu​(JMenu scriptEntries)
    • getContent

      public static String getContent​(String fileName)
    • getContent

      public static String getContent​(IOurl url)
    • ensureActiveSession

      public void ensureActiveSession​(MouseEvent e)
      Description copied from interface: IContextMenuManager
      This Method should be called by the editing tools in the mouse entered event-handler. It should activate the view and session where the mouse button is over.
      Parameters:
      e - The MouseEvent.