|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.rse.ui.Mnemonics
public class Mnemonics
Instances of this class may be used to supply mnemonics to the text for controls. There are preferences which can be set by products to control how these mnemonics are generated and applied.
There are two types of mnemonics which can be added to a label: embedded mnemonics and appended mnemonics. An embedded mnemonic uses an existing letter in the label for the mnemonic. An appended mnemonic is added to the end of the label (but prior to any punctuation or accelerators) and is of the form (X).
The org.eclipse.rse.ui/MNEMONICS_POLICY preference establishes the
desire to generated embedded mnemonics using letters that already
exist in the text of the controls and/or to generate appended mnemonics
if an embedded mnemonic cannot be found or is not desired.
The policy is composed of bit flags.
See EMBED_MNEMONICS
and APPEND_MNEMONICS
for the flag values.
See POLICY_DEFAULT
for the default policy value.
A policy value of 0 will disable the generation of all mnemonics.
The org.eclipse.rse.ui/APPEND_MNEMONICS_PATTERN preference is used to
further qualify the appending behavior by the current locale. If the
current locale name matches this pattern then appending can be performed.
See APPEND_MNEMONICS_PATTERN_DEFAULT
for the default pattern.
Mnemonics on menus are allowed to have duplicates. Attempts are made to find the least used mnemonic when finding a duplicate.
Field Summary | |
---|---|
static int |
APPEND_MNEMONICS
An option bit mask - value 2. |
static String |
APPEND_MNEMONICS_PATTERN_DEFAULT
Some products will to append mnemonics only for certain locales. |
static String |
APPEND_MNEMONICS_PATTERN_PREFERENCE
The simple name of the preference that holds the pattern to be used for matching against the locale to determine if APPEND_MNEMONICS option applies. |
static int |
EMBED_MNEMONICS
An option bit mask - value 1. |
static int |
POLICY_DEFAULT
The default mnemonics policy. |
static String |
POLICY_PREFERENCE
The simple name of the preference that determines the policy to be used when applying mnemonics to menus and composites. |
Constructor Summary | |
---|---|
Mnemonics()
|
Method Summary | |
---|---|
static String |
applyMnemonic(String label,
char mnemonicChar)
Given a label and mnemonic, this applies that mnemonic to the label. |
void |
clear()
Clear the list of used mnemonic characters |
void |
clear(String usedMnemonics)
Resets the list of used mnemonic characters to those in the string. |
static char |
getMnemonic(String text)
Helper method to return the mnemonic from a string. |
boolean |
isUniqueMnemonic(char ch)
Determine if given char is a unique mnemonic. |
static String |
removeMnemonic(String text)
Helper method to strip the mnemonic from a string. |
Mnemonics |
setApplyMnemonicsToPrecedingLabels(boolean apply)
Set whether to apply mnemonics to labels preceding text fields, combos and inheritable entry fields. |
boolean |
setMnemonic(Button button)
Adds a mnemonic to an SWT Button such that the user can select it via Ctrl/Alt+mnemonic. |
void |
setMnemonics(Composite parent)
Given a Composite, this method walks all the children recursively and and sets the mnemonics uniquely for each child control where a mnemonic makes sense (eg, buttons). |
void |
setMnemonics(Composite parent,
Set ignoredControls)
Given a Composite, this method walks all the children recursively and and sets the mnemonics uniquely for each child control where a mnemonic makes sense (for example, buttons). |
void |
setMnemonics(Menu menu)
Given a menu, this method walks all the items and assigns each a mnemonic. |
Mnemonics |
setOnPreferencePage(boolean page)
Set if the mnemonics are for a preference page Preference pages already have a few buttons with mnemonics set by Eclipse We have to make sure we do not use the ones they use |
Mnemonics |
setOnWizardPage(boolean page)
Set if the mnemonics are for a wizard page Wizard pages already have a few buttons with mnemonics set by Eclipse We have to make sure we do not use the ones they use |
String |
setUniqueMnemonic(String label)
Sets a mnemonic in the given string and returns the result. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EMBED_MNEMONICS
public static final int APPEND_MNEMONICS
public static final String APPEND_MNEMONICS_PATTERN_PREFERENCE
public static final String APPEND_MNEMONICS_PATTERN_DEFAULT
public static final String POLICY_PREFERENCE
public static final int POLICY_DEFAULT
Constructor Detail |
---|
public Mnemonics()
Method Detail |
---|
public static char getMnemonic(String text)
text
- the label from which to extract the mnemonic
public static String applyMnemonic(String label, char mnemonicChar)
label
- String to which to apply the mnemonicmnemonicChar
- the character that is to be the mnemonic character
public static String removeMnemonic(String text)
text
- the label from which to strip the mnemonic
public void clear()
public void clear(String usedMnemonics)
usedMnemonics
- A String listing the characters to mark used as
mnemonics. Each character will be considered in a case
insensitive manner.public String setUniqueMnemonic(String label)
label
- The string to which to apply the mnemonic
public boolean isUniqueMnemonic(char ch)
ch
- the character to test.
public Mnemonics setApplyMnemonicsToPrecedingLabels(boolean apply)
false
if it does not work
in your dialog, wizard, preference or property page, i.e. you have labels preceding these
widgets that do not necessarily refer to them.
apply
- true
to apply mnemonic to preceding labels, false
otherwise.
public boolean setMnemonic(Button button)
button
- the button to equip with a mnemonic
true
if the button was actually changedpublic void setMnemonics(Menu menu)
menu
- the menu to examinepublic void setMnemonics(Composite parent)
parent
- the parent control to examine.public void setMnemonics(Composite parent, Set ignoredControls)
parent
- the parent control to examine.ignoredControls
- the set of controls in which to not set mnemonics.
If the controls are composites, their children are also not examined.public Mnemonics setOnPreferencePage(boolean page)
public Mnemonics setOnWizardPage(boolean page)
|
RSE Release 3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |