public final class Presentation
extends java.lang.Object
implements java.lang.Cloneable
AnAction
,
ActionPlaces
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_WEIGHT |
static double |
EVEN_HIGHER_WEIGHT |
static double |
HIGHER_WEIGHT |
static java.util.function.Supplier<java.lang.String> |
NULL_STRING |
static java.lang.String |
PROP_DESCRIPTION
value: String
|
static java.lang.String |
PROP_DISABLED_ICON
value: Icon
|
static java.lang.String |
PROP_ENABLED
The actual value is a Boolean.
|
static java.lang.String |
PROP_HOVERED_ICON
value: Icon
|
static java.lang.String |
PROP_ICON
value: Icon
|
static java.lang.String |
PROP_MNEMONIC_INDEX
value: Integer
|
static java.lang.String |
PROP_MNEMONIC_KEY
value: Integer
|
static java.lang.String |
PROP_SELECTED_ICON
value: Icon
|
static java.lang.String |
PROP_TEXT
Defines tool tip for button at tool bar or text for element at menu
value: String
|
static java.lang.String |
PROP_VISIBLE
value: Boolean
|
Constructor and Description |
---|
Presentation() |
Presentation(java.lang.String text) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l) |
Presentation |
clone() |
void |
copyFrom(Presentation presentation) |
<T> T |
getClientProperty(Key<T> key) |
java.lang.Object |
getClientProperty(java.lang.String key) |
java.lang.String |
getDescription() |
javax.swing.Icon |
getDisabledIcon() |
int |
getDisplayedMnemonicIndex() |
javax.swing.Icon |
getHoveredIcon() |
javax.swing.Icon |
getIcon() |
int |
getMnemonic() |
javax.swing.Icon |
getSelectedIcon() |
java.lang.String |
getText() |
java.lang.String |
getTextWithMnemonic() |
java.util.function.Supplier<TextWithMnemonic> |
getTextWithMnemonic(java.util.function.Supplier<java.lang.String> text,
boolean mayContainMnemonic) |
java.util.function.Supplier<TextWithMnemonic> |
getTextWithPossibleMnemonic() |
double |
getWeight() |
boolean |
isEnabled()
Returns the state of this action.
|
boolean |
isEnabledAndVisible() |
boolean |
isVisible() |
<T> void |
putClientProperty(Key<T> key,
T value) |
void |
putClientProperty(java.lang.String key,
java.lang.Object value) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l) |
void |
restoreTextWithMnemonic(Presentation presentation) |
static java.lang.String |
restoreTextWithMnemonic(java.lang.String text,
int mnemonic) |
void |
setDescription(java.lang.String description) |
void |
setDescription(java.util.function.Supplier<java.lang.String> dynamicDescription) |
void |
setDisabledIcon(javax.swing.Icon icon) |
void |
setEnabled(boolean enabled)
Sets whether the action enabled or not.
|
void |
setEnabledAndVisible(boolean enabled) |
void |
setHoveredIcon(javax.swing.Icon hoveredIcon) |
void |
setIcon(javax.swing.Icon icon) |
void |
setSelectedIcon(javax.swing.Icon selectedIcon) |
void |
setText(java.lang.String text)
Sets the text with mnemonic.
|
void |
setText(java.lang.String text,
boolean mayContainMnemonic)
Sets the presentation text.
|
void |
setText(java.util.function.Supplier<java.lang.String> text)
Sets the text with mnemonic supplier.
|
void |
setText(java.util.function.Supplier<java.lang.String> text,
boolean mayContainMnemonic)
Sets the presentation text.
|
void |
setTextWithMnemonic(java.util.function.Supplier<TextWithMnemonic> textWithMnemonicSupplier)
Sets the presentation text
|
void |
setVisible(boolean visible) |
void |
setWeight(double weight)
Some action groups (like 'New...') may filter out actions with non-highest priority.
|
java.lang.String |
toString() |
public static final java.util.function.Supplier<java.lang.String> NULL_STRING
public static final java.lang.String PROP_TEXT
public static final java.lang.String PROP_MNEMONIC_KEY
public static final java.lang.String PROP_MNEMONIC_INDEX
public static final java.lang.String PROP_DESCRIPTION
public static final java.lang.String PROP_ICON
public static final java.lang.String PROP_DISABLED_ICON
public static final java.lang.String PROP_SELECTED_ICON
public static final java.lang.String PROP_HOVERED_ICON
public static final java.lang.String PROP_VISIBLE
public static final java.lang.String PROP_ENABLED
public static final double DEFAULT_WEIGHT
public static final double HIGHER_WEIGHT
public static final double EVEN_HIGHER_WEIGHT
public Presentation()
public Presentation(java.lang.String text)
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
public java.lang.String getText()
public void setText(java.util.function.Supplier<java.lang.String> text, boolean mayContainMnemonic)
text
- presentation text. Use it if you need to localize text.mayContainMnemonic
- if true, the text has text-with-mnemonic format, otherwise
it's a plain text and no mnemonic will be used.public void setText(java.lang.String text, boolean mayContainMnemonic)
text
- presentation text.mayContainMnemonic
- if true, the text has text-with-mnemonic format, otherwise
it's a plain text and no mnemonic will be used.public java.util.function.Supplier<TextWithMnemonic> getTextWithMnemonic(java.util.function.Supplier<java.lang.String> text, boolean mayContainMnemonic)
public void setTextWithMnemonic(java.util.function.Supplier<TextWithMnemonic> textWithMnemonicSupplier)
textWithMnemonicSupplier
- text with mnemonic to setpublic void setText(java.lang.String text)
setText(String, boolean)
public void setText(java.util.function.Supplier<java.lang.String> text)
public java.lang.String getTextWithMnemonic()
setText(String)
(e.g. to copy the presentation).public java.util.function.Supplier<TextWithMnemonic> getTextWithPossibleMnemonic()
public void restoreTextWithMnemonic(Presentation presentation)
public static java.lang.String restoreTextWithMnemonic(java.lang.String text, int mnemonic)
public java.lang.String getDescription()
public void setDescription(java.util.function.Supplier<java.lang.String> dynamicDescription)
public void setDescription(java.lang.String description)
public javax.swing.Icon getIcon()
public void setIcon(javax.swing.Icon icon)
public javax.swing.Icon getDisabledIcon()
public void setDisabledIcon(javax.swing.Icon icon)
public javax.swing.Icon getHoveredIcon()
public void setHoveredIcon(javax.swing.Icon hoveredIcon)
public javax.swing.Icon getSelectedIcon()
public void setSelectedIcon(javax.swing.Icon selectedIcon)
public int getMnemonic()
public int getDisplayedMnemonicIndex()
public boolean isVisible()
public void setVisible(boolean visible)
public boolean isEnabled()
true
if action is enabled, false
otherwisepublic void setEnabled(boolean enabled)
AnAction.actionPerformed(com.intellij.openapi.actionSystem.AnActionEvent)
won't be called. In case when action represents a button or a menu item, the
representing button or item will be greyed out.enabled
- true
if you want to enable action, false
otherwisepublic final void setEnabledAndVisible(boolean enabled)
public Presentation clone()
clone
in class java.lang.Object
public void copyFrom(Presentation presentation)
public <T> T getClientProperty(Key<T> key)
public <T> void putClientProperty(Key<T> key, T value)
public java.lang.Object getClientProperty(java.lang.String key)
public void putClientProperty(java.lang.String key, java.lang.Object value)
public double getWeight()
public void setWeight(double weight)
weight
- please use HIGHER_WEIGHT
or EVEN_HIGHER_WEIGHT
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isEnabledAndVisible()