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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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
buildUrl(String... segments)
Combine segments of an URL in the style expected byModelObjectWithContextMenu.MenuItem
.static Icon
getIcon(Action action)
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
getMenuItemIconUrlByClassSpec(String spec)
Gets the qualified URL for an icon spec.static String
getQualifiedUrl(Icon icon)
Gets the qualified URL of the specified icon.
-
-
-
Method Detail
-
buildUrl
@NonNull public static String buildUrl(String... segments)
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
@CheckForNull public static String getMenuItemIconUrlByClassSpec(@CheckForNull String spec)
Gets the qualified URL for an icon spec.- Parameters:
spec
- the icon spec.- Returns:
- the qualified URL for a menu item
-
getMenuItemIconUrl
public static String getMenuItemIconUrl(String url)
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
@CheckForNull public static Icon getIconByClassSpec(String spec)
Navigate the signature changes in different versions ofIconSet
.- Parameters:
spec
- the spec to look up.- Returns:
- the
Icon
ornull
-
getIcon
@CheckForNull public static Icon getIcon(@NonNull Action action)
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
-
-