org.openstreetmap.josm.gui.help
Class HelpUtil

java.lang.Object
  extended by org.openstreetmap.josm.gui.help.HelpUtil

public class HelpUtil
extends java.lang.Object


Constructor Summary
HelpUtil()
           
 
Method Summary
static java.lang.String buildAbsoluteHelpTopic(java.lang.String topic)
          Replies the absolute, localized help topic for the given topic and the current locale.
static java.lang.String buildAbsoluteHelpTopic(java.lang.String topic, java.util.Locale locale)
          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 for context.
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.
static java.lang.String getHelpTopicPrefix()
          Replies the help topic prefix for the current locale.
static java.lang.String getHelpTopicPrefix(java.util.Locale locale)
          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 pages
static 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HelpUtil

public 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(String), buildAbsoluteHelpTopic(String, Locale)

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

public static java.lang.String getHelpTopicPrefix()
Replies the help topic prefix for the current locale. Examples:

Returns:
the help topic prefix
See Also:
getHelpTopicPrefix(Locale)

getHelpTopicPrefix

public static java.lang.String getHelpTopicPrefix(java.util.Locale locale)
Replies the help topic prefix for the given locale. Examples:

Parameters:
locale - the locale. Locale.ENGLISH assumed, if null.
Returns:
the help topic prefix
See Also:
getHelpTopicPrefix(Locale)

buildAbsoluteHelpTopic

public static java.lang.String buildAbsoluteHelpTopic(java.lang.String topic,
                                                      java.util.Locale locale)
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.
locale - the locale. Locale.ENGLISH assumed, if null.
Returns:
the absolute, localized help topic

buildAbsoluteHelpTopic

public static java.lang.String buildAbsoluteHelpTopic(java.lang.String topic)
Replies the absolute, localized help topic for the given topic and the current locale.

Parameters:
topic - the relative help topic. Home help topic assumed, if null.
Returns:
the absolute, localized help topic
See Also:
Locale.getDefault(), buildAbsoluteHelpTopic(String, Locale)

getContextSpecificHelpTopic

public static java.lang.String getContextSpecificHelpTopic(java.lang.Object context)
Replies the context specific help topic configured for 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 of HelpAction.

Returns:

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 component the component
topic - 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(...). Example
     String helpTopic = ht("/Dialog/RelationEditor");
  or
     putValue("help", ht("/Dialog/RelationEditor"));
  

Parameters:
helpTopic -


JOSM