diff options
author | Tor Norbye <tnorbye@google.com> | 2012-05-31 12:04:10 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-09-04 20:39:34 -0700 |
commit | f25890ca71100673ba58c343a211fc838cc59706 (patch) | |
tree | 8a231896247bb5f23e43e319449a74f5afc349ec /rule_api/src | |
parent | 8f569b2594013c3f67c82d989bddbf5b3ada5d01 (diff) | |
download | sdk-f25890ca71100673ba58c343a211fc838cc59706.zip sdk-f25890ca71100673ba58c343a211fc838cc59706.tar.gz sdk-f25890ca71100673ba58c343a211fc838cc59706.tar.bz2 |
Default action for view rules.
For now, text-oriented widgets declare their default action to
be to set the text attribute. Also hook up the default rename
keybinding to setting the id.
Change-Id: I14e8e06d0842759b1ac05e7e9494deb30b3cc40f
Diffstat (limited to 'rule_api/src')
-rw-r--r-- | rule_api/src/com/android/ide/common/api/AbstractViewRule.java | 6 | ||||
-rw-r--r-- | rule_api/src/com/android/ide/common/api/IViewRule.java | 11 |
2 files changed, 17 insertions, 0 deletions
diff --git a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java index 068580f..e23a567 100644 --- a/rule_api/src/com/android/ide/common/api/AbstractViewRule.java +++ b/rule_api/src/com/android/ide/common/api/AbstractViewRule.java @@ -63,6 +63,12 @@ public class AbstractViewRule implements IViewRule { } @Override + @Nullable + public String getDefaultActionId(@NonNull INode node) { + return null; + } + + @Override public void paintSelectionFeedback(@NonNull IGraphics graphics, @NonNull INode parentNode, @NonNull List<? extends INode> childNodes, @Nullable Object view) { } diff --git a/rule_api/src/com/android/ide/common/api/IViewRule.java b/rule_api/src/com/android/ide/common/api/IViewRule.java index b16df26..88b795f 100644 --- a/rule_api/src/com/android/ide/common/api/IViewRule.java +++ b/rule_api/src/com/android/ide/common/api/IViewRule.java @@ -102,6 +102,17 @@ public interface IViewRule { void addContextMenuActions(@NonNull List<RuleAction> actions, @NonNull INode node); /** + * Returns the id of the default action to invoke for this view, typically when the + * user presses F2. The id should correspond to the {@link RuleAction#getId()} returned + * by one of the actions added by {@link #addContextMenuActions(List, INode)}. + * + * @param node the primary selected node + * @return the id of default action, or null if none is default + */ + @Nullable + String getDefaultActionId(@NonNull INode node); + + /** * Invoked by the Rules Engine to ask the parent layout for the set of layout actions * to display in the layout bar. The layout rule should add these into the provided * list. The order the items are added in does not matter; the |