Class MenuBuildUtils
java.lang.Object
com.biglybt.ui.swt.MenuBuildUtils
A class which helps generate build SWT menus.
It provides two main functions. The first provides the ability to create
regenerateable menus (it will dispose old items when not displayed and
invoke a callback method to regenerate it).
The second provides the ability to create SWT menus based on the plugin
API for menu creation - this allows internal code that generates menus
to include plugins to append to their own internal menus.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceprivate static classstatic interfacestatic interfaceAn interface to be used for addMaintenanceListenerForMenu.static classThis is an implementation of the PluginMenuController interface for use with MenuItemImpl classes - note that this is not intended for use by subclasses of MenuItemImpl (like TableContextMenuItemImpl).static interfaceThis is an interface used by addPluginMenuItems. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static AtomicBooleanstatic final MenuBuildUtils.PluginMenuControllerAn instance of MenuItemPluginMenuControllerImpl with a default value of null - this will be the value passed when notifying selection and fill listeners.private static AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MenuItemaddChatMenu(MenuManager menu_manager, MenuItem chat_item, MenuBuildUtils.ChatKeyResolver chat_key_resolver) static voidaddChatMenu(org.eclipse.swt.widgets.Menu menu, String chat_resource, String chat_key) static voidaddChatSelectionMenu(MenuManager menu_manager, MenuItem chat_item, String existing_chat, MenuBuildUtils.ChatSelectionListener _listener) static voidaddChatSelectionMenu(org.eclipse.swt.widgets.Menu menu, String resource_key, String existing_chat, MenuBuildUtils.ChatSelectionListener _listener) static voidaddColourChooser(org.eclipse.swt.widgets.Menu menu, String item_resource, boolean can_clear, List<org.eclipse.swt.graphics.RGB> existing, Consumer<org.eclipse.swt.graphics.RGB> receiver) static voidaddCommunityChatMenu(org.eclipse.swt.widgets.Menu menu) static voidaddMaintenanceListenerForMenu(org.eclipse.swt.widgets.Menu menu, MenuBuildUtils.MenuBuilder builder) static voidaddMaintenanceListenerForMenu(org.eclipse.swt.widgets.Menu menu, MenuBuildUtils.MenuBuilder builder, boolean alwaysBuilt) Creates and adds a listener object to implement regeneratable menus.static voidaddMOCHistory(org.eclipse.swt.widgets.Menu moc_menu, Consumer<String> moc_setter) static org.eclipse.swt.widgets.MenuItemaddOpenWithMenu(org.eclipse.swt.widgets.Menu menu, boolean has_menu, Object target, boolean torrent) static voidaddPluginMenuItems(MenuItem[] items, org.eclipse.swt.widgets.Menu parent, boolean prev_was_separator, boolean enable_items, MenuBuildUtils.PluginMenuController controller) Creates menu items inside the given menu based on the plugin API MenuItem instances provided.static voidaddSeparator(org.eclipse.swt.widgets.Menu menu) Adds a separator if the current last item isn't one alreadystatic voidaddToMOCHistory(String path) static booleanhasOpenWithMenu(Object target, boolean torrent) private static List<BuddyPluginBeta.ChatInstance> splitLongMenuListIntoHierarchy(List<String> flat_entries, int split_after)
-
Field Details
-
BASIC_MENU_ITEM_CONTROLLER
An instance of MenuItemPluginMenuControllerImpl with a default value of null - this will be the value passed when notifying selection and fill listeners. -
pub_chat_pending
-
anon_chat_pending
-
-
Constructor Details
-
MenuBuildUtils
public MenuBuildUtils()
-
-
Method Details
-
addMaintenanceListenerForMenu
public static void addMaintenanceListenerForMenu(org.eclipse.swt.widgets.Menu menu, MenuBuildUtils.MenuBuilder builder) -
addMaintenanceListenerForMenu
public static void addMaintenanceListenerForMenu(org.eclipse.swt.widgets.Menu menu, MenuBuildUtils.MenuBuilder builder, boolean alwaysBuilt) Creates and adds a listener object to implement regeneratable menus. The first piece of functionality it offers is the ability to call a callback method to generate the menu when it is about to be displayed (the callback method is done by passing an object implementing the MenuBuilder interface). This means that the caller of this method only needs to provide the logic to construct the menu's contents. This is helpful if you want to update an existing menu. The second piece of functionality is that it automatically does what is required to dispose of existing menu items when the menu is hidden. -
splitLongMenuListIntoHierarchy
-
addCommunityChatMenu
public static void addCommunityChatMenu(org.eclipse.swt.widgets.Menu menu) -
addChatMenu
-
sortChats
private static List<BuddyPluginBeta.ChatInstance> sortChats(List<BuddyPluginBeta.ChatInstance> chats) -
addChatSelectionMenu
public static void addChatSelectionMenu(org.eclipse.swt.widgets.Menu menu, String resource_key, String existing_chat, MenuBuildUtils.ChatSelectionListener _listener) -
addSeparator
public static void addSeparator(org.eclipse.swt.widgets.Menu menu) Adds a separator if the current last item isn't one already- Parameters:
menu-
-
addColourChooser
-
hasOpenWithMenu
-
addOpenWithMenu
public static org.eclipse.swt.widgets.MenuItem addOpenWithMenu(org.eclipse.swt.widgets.Menu menu, boolean has_menu, Object target, boolean torrent) -
addMOCHistory
-
addToMOCHistory
-