Class ContextMenuIconUtils
java.lang.Object
com.cloudbees.plugins.credentials.ContextMenuIconUtils
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
public class ContextMenuIconUtils
extends Object
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddMenuItem(ModelObjectWithContextMenu.ContextMenu menu, Action action) Adds a menu item for the specified action.static voidaddMenuItem(ModelObjectWithContextMenu.ContextMenu menu, String prefix, Action action) Adds a menu item for the specified action with the supplied prefix offset.static voidaddMenuItem(ModelObjectWithContextMenu.ContextMenu menu, String prefix, Action action, ModelObjectWithContextMenu.ContextMenu subMenu) Adds a menu item for the specified action with the supplied prefix offset and optional sub menu.static StringCombine segments of an URL in the style expected byModelObjectWithContextMenu.MenuItem.static IconIconSetsupport has not been implemented forModelObjectWithContextMenu.ContextMenuas of Jenkins 2.5.static IcongetIconByClassSpec(String spec) Navigate the signature changes in different versions ofIconSet.static StringgetMenuItemIconUrl(String url) Converts a regular icon url into a menu item icon urlstatic StringGets the qualified URL for an icon spec.static StringgetQualifiedUrl(Icon icon) Gets the qualified URL of the specified icon.
-
Method Details
-
buildUrl
Combine segments of an URL in the style expected byModelObjectWithContextMenu.MenuItem.- Parameters:
segments- the segments.- Returns:
- the combined URL.
-
addMenuItem
public static void addMenuItem(@NonNull ModelObjectWithContextMenu.ContextMenu menu, @CheckForNull String prefix, @NonNull Action action, @CheckForNull ModelObjectWithContextMenu.ContextMenu subMenu) Adds a menu item for the specified action with the supplied prefix offset and optional sub menu.- Parameters:
menu- the menu to add to.prefix- the prefix offset of the action urls.action- the action.subMenu- the sub menu.
-
addMenuItem
public static void addMenuItem(@NonNull ModelObjectWithContextMenu.ContextMenu menu, @CheckForNull String prefix, @NonNull Action action) Adds a menu item for the specified action with the supplied prefix offset.- Parameters:
menu- the menu to add to.prefix- the prefix offset of the action urls.action- the action.
-
addMenuItem
public static void addMenuItem(@NonNull ModelObjectWithContextMenu.ContextMenu menu, @NonNull Action action) Adds a menu item for the specified action.- Parameters:
menu- the menu to add to.action- the action.
-
getMenuItemIconUrlByClassSpec
Gets the qualified URL for an icon spec.- Parameters:
spec- the icon spec.- Returns:
- the qualified URL for a menu item
-
getMenuItemIconUrl
Converts a regular icon url into a menu item icon url- Parameters:
url- the "regular" icon url.- Returns:
- the url for a menu item.
-
getIconByClassSpec
Navigate the signature changes in different versions ofIconSet.- Parameters:
spec- the spec to look up.- Returns:
- the
Iconornull
-
getIcon
IconSetsupport has not been implemented forModelObjectWithContextMenu.ContextMenuas of Jenkins 2.5. Hacks to work around some of the fun method signature migrations inIconSet.- Parameters:
action- the action.- Returns:
- the
Iconornull
-
getQualifiedUrl
Gets the qualified URL of the specified icon.- Parameters:
icon- the icon.- Returns:
- the qualified URL of the icon.
-