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 void
addMenuItem
(ModelObjectWithContextMenu.ContextMenu menu, Action action) Adds a menu item for the specified action.static void
addMenuItem
(ModelObjectWithContextMenu.ContextMenu menu, String prefix, Action action) Adds a menu item for the specified action with the supplied prefix offset.static void
addMenuItem
(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 String
Combine segments of an URL in the style expected byModelObjectWithContextMenu.MenuItem
.static Icon
IconSet
support has not been implemented forModelObjectWithContextMenu.ContextMenu
as of Jenkins 2.5.static Icon
getIconByClassSpec
(String spec) Navigate the signature changes in different versions ofIconSet
.static String
getMenuItemIconUrl
(String url) Converts a regular icon url into a menu item icon urlstatic String
Gets the qualified URL for an icon spec.static String
getQualifiedUrl
(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
Icon
ornull
-
getIcon
IconSet
support has not been implemented forModelObjectWithContextMenu.ContextMenu
as of Jenkins 2.5. Hacks to work around some of the fun method signature migrations inIconSet
.- Parameters:
action
- the action.- Returns:
- the
Icon
ornull
-
getQualifiedUrl
Gets the qualified URL of the specified icon.- Parameters:
icon
- the icon.- Returns:
- the qualified URL of the icon.
-