Package org.openstreetmap.josm.gui.help
Class HelpUtil
- java.lang.Object
-
- org.openstreetmap.josm.gui.help.HelpUtil
-
public final class HelpUtil extends java.lang.Object
Provides utility methods for help system.- Since:
- 2252
-
-
Constructor Summary
Constructors Modifier Constructor Description private
HelpUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
buildAbsoluteHelpTopic(java.lang.String topic, LanguageInfo.LocaleType type)
Replies the absolute, localized help topic for the given topic.static java.lang.String
extractAbsoluteHelpTopic(java.lang.String url)
Extracts the absolute help topic from an URL.static java.lang.String
extractRelativeHelpTopic(java.lang.String url)
Extracts the relative help topic from an URL.static java.lang.String
getContextSpecificHelpTopic(java.lang.Object context)
Replies the context specific help topic configured forcontext
.private static javax.swing.Action
getHelpAction()
Replies the global help action, if available.static java.lang.String
getHelpTopicEditUrl(java.lang.String absoluteHelpTopic)
Replies the URL to the edit page for the absolute help topic.private static java.lang.String
getHelpTopicPrefix(LanguageInfo.LocaleType type)
Replies the help topic prefix for the given locale.static java.lang.String
getHelpTopicUrl(java.lang.String absoluteHelpTopic)
Replies the URL on the wiki for an absolute help topic.static java.lang.String
getWikiBaseHelpUrl()
Replies the base wiki URL for help pagesstatic java.lang.String
getWikiBaseUrl()
Replies the base wiki URL.static java.lang.String
ht(java.lang.String helpTopic)
This is a simple marker method for help topic literals.static void
setHelpContext(javax.swing.JComponent component, java.lang.String relativeHelpTopic)
Makes a component aware of context sensitive help.
-
-
-
Constructor Detail
-
HelpUtil
private HelpUtil()
-
-
Method Detail
-
getWikiBaseUrl
public static java.lang.String getWikiBaseUrl()
Replies the base wiki URL.- Returns:
- the base wiki URL
-
getWikiBaseHelpUrl
public static java.lang.String getWikiBaseHelpUrl()
Replies the base wiki URL for help pages- Returns:
- the base wiki URL for help pages
-
getHelpTopicUrl
public static java.lang.String getHelpTopicUrl(java.lang.String absoluteHelpTopic)
Replies the URL on the wiki for an absolute help topic. The URL is encoded in UTF-8.- Parameters:
absoluteHelpTopic
- the absolute help topic- Returns:
- the url
- See Also:
buildAbsoluteHelpTopic(java.lang.String, org.openstreetmap.josm.tools.LanguageInfo.LocaleType)
-
getHelpTopicEditUrl
public static java.lang.String getHelpTopicEditUrl(java.lang.String absoluteHelpTopic)
Replies the URL to the edit page for the absolute help topic.- Parameters:
absoluteHelpTopic
- the absolute help topic- Returns:
- the URL to the edit page
-
extractRelativeHelpTopic
public static java.lang.String extractRelativeHelpTopic(java.lang.String url)
Extracts the relative help topic from an URL. Replies null, if no relative help topic is found.- Parameters:
url
- the url- Returns:
- the relative help topic in the URL, i.e. "/Action/New"
-
extractAbsoluteHelpTopic
public static java.lang.String extractAbsoluteHelpTopic(java.lang.String url)
Extracts the absolute help topic from an URL. Replies null, if no absolute help topic is found.- Parameters:
url
- the url- Returns:
- the absolute help topic in the URL, i.e. "/De:Help/Action/New"
-
getHelpTopicPrefix
private static java.lang.String getHelpTopicPrefix(LanguageInfo.LocaleType type)
Replies the help topic prefix for the given locale. Examples:- /Help if the locale is a locale with language "en"
- /De:Help if the locale is a locale with language "de"
- Parameters:
type
- the type of the locale to use- Returns:
- the help topic prefix
- Since:
- 5915
-
buildAbsoluteHelpTopic
public static java.lang.String buildAbsoluteHelpTopic(java.lang.String topic, LanguageInfo.LocaleType type)
Replies the absolute, localized help topic for the given topic. Example: for a topic "/Dialog/RelationEditor" and the locale "de", this method replies "/De:Help/Dialog/RelationEditor"- Parameters:
topic
- the relative help topic. Home help topic assumed, if null.type
- the locale.Locale.ENGLISH
assumed, if null.- Returns:
- the absolute, localized help topic
- Since:
- 5915
-
getContextSpecificHelpTopic
public static java.lang.String getContextSpecificHelpTopic(java.lang.Object context)
Replies the context specific help topic configured forcontext
.- Parameters:
context
- The UI object used as context- Returns:
- the help topic. null, if no context specific help topic is found
-
getHelpAction
private static javax.swing.Action getHelpAction()
Replies the global help action, if available. Otherwise, creates an instance ofHelpAction
.- Returns:
- instance of help action
-
setHelpContext
public static void setHelpContext(javax.swing.JComponent component, java.lang.String relativeHelpTopic)
Makes a component aware of context sensitive help. A relative help topic doesn't start with /Help and doesn't include a locale code. Example: /Dialog/RelationEditor is a relative help topic, /De:Help/Dialog/RelationEditor is not.- Parameters:
component
- the componentrelativeHelpTopic
- the help topic. Set to the default help topic if null.
-
ht
public static java.lang.String ht(java.lang.String helpTopic)
This is a simple marker method for help topic literals. If you declare a help topic literal in the source you should enclose it in ht(...). ExampleString helpTopic = ht("/Dialog/RelationEditor"); or putValue("help", ht("/Dialog/RelationEditor"));
- Parameters:
helpTopic
- Help topic to mark- Returns:
helpTopic
-
-