diff options
author | Tor Norbye <tnorbye@google.com> | 2011-01-11 18:19:09 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-01-11 18:19:09 -0800 |
commit | ef58d3413e367f006a942971e82d46cc08f5461d (patch) | |
tree | aca32f676f80c7d4b7a6eda67ed57f341b6f5c7f | |
parent | 9a37d8da4717dfcf99dec4a446dc6b8bf05381c5 (diff) | |
parent | 91d9ef572258d6fde6dfe748ee427cdf7aa80099 (diff) | |
download | sdk-ef58d3413e367f006a942971e82d46cc08f5461d.zip sdk-ef58d3413e367f006a942971e82d46cc08f5461d.tar.gz sdk-ef58d3413e367f006a942971e82d46cc08f5461d.tar.bz2 |
Merge "Reorder animation submenu" into tools_r9
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java | 40 |
1 files changed, 15 insertions, 25 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java index 878c50e..03a446a 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java @@ -59,8 +59,6 @@ public class PlayAnimationMenu extends SubmenuAction { private final LayoutCanvas mCanvas; /** Whether this menu is showing local animations or framework animations */ private boolean mFramework; - /** Most recently executed animation action: shown at the top of the context menu */ - private PlayAnimationAction mRecent; /** * Creates a "Play Animation" menu @@ -97,39 +95,33 @@ public class PlayAnimationMenu extends SubmenuAction { GraphicalEditorPart graphicalEditor = mCanvas.getLayoutEditor().getGraphicalEditor(); if (graphicalEditor.renderingSupports(Capability.PLAY_ANIMATION)) { - if (!mFramework) { - // Not in the framework submenu: include recent list and create new actions - - // First, most recent animation - if (mRecent != null) { - new ActionContributionItem(mRecent).fill(menu, -1); - new Separator().fill(menu, -1); - } - - // "Create New" action - new ActionContributionItem(new CreateAnimationAction()).fill(menu, -1); - - // Framework resources submenu - new Separator().fill(menu, -1); - PlayAnimationMenu sub = new PlayAnimationMenu(mCanvas, "Android Builtin", true); - new ActionContributionItem(sub).fill(menu, -1); - } - // List of animations Collection<String> animationNames = graphicalEditor.getResourceNames(mFramework, ResourceType.ANIMATOR); if (animationNames.size() > 0) { - if (!mFramework) { - new Separator().fill(menu, -1); - } // Sort alphabetically List<String> sortedNames = new ArrayList<String>(animationNames); Collections.sort(sortedNames); + for (String animation : sortedNames) { String title = animation; IAction action = new PlayAnimationAction(title, animation, mFramework); new ActionContributionItem(action).fill(menu, -1); } + + new Separator().fill(menu, -1); + } + + if (!mFramework) { + // Not in the framework submenu: include recent list and create new actions + + // "Create New" action + new ActionContributionItem(new CreateAnimationAction()).fill(menu, -1); + + // Framework resources submenu + new Separator().fill(menu, -1); + PlayAnimationMenu sub = new PlayAnimationMenu(mCanvas, "Android Builtin", true); + new ActionContributionItem(sub).fill(menu, -1); } } else { addDisabledMessageItem("Not supported on platform"); @@ -148,8 +140,6 @@ public class PlayAnimationMenu extends SubmenuAction { @Override public void run() { - mRecent = this; - SelectionManager selectionManager = mCanvas.getSelectionManager(); List<SelectionItem> selection = selectionManager.getSelections(); SelectionItem canvasSelection = selection.get(0); |