1 | protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID)↵ | | 1 | protected void populateManager(IContributionManager manager, Collection<? extends IAction> actions, String contributionID)↵
|
2 | {↵ | | 2 | {↵
|
3 | if (actions != null)↵ | | 3 | if (actions != null)↵
|
4 | {↵ | | 4 | {↵
|
5 | for (IAction action : actions)↵ | | 5 | for (IAction action : actions)↵
|
6 | {↵ | | 6 | {↵
|
7 | if (contributionID != null)↵ | | 7 | if (contributionID != null)↵
|
8 | {↵ | | 8 | {↵
|
9 | manager.insertBefore(contributionID, action);↵ | | 9 | manager.insertBefore(contributionID, action);↵
|
10 | }↵ | | 10 | }↵
|
11 | else↵ | | 11 | else↵
|
12 | {↵ | | 12 | {↵
|
13 | manager.add(action);↵ | | 13 | manager.add(action);↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
16 | }↵ | | 16 | }↵
|
17 | }↵ | | 17 | }↵
|
18 | ↵ | | 18 | ↵
|
19 | /**↵ | | 19 | /**↵
|
20 | * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s↵ | | 20 | * This removes from the specified <code>manager</code> all {@link org.eclipse.jface.action.ActionContributionItem}s↵
|
21 | * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.↵ | | 21 | * based on the {@link org.eclipse.jface.action.IAction}s contained in the <code>actions</code> collection.↵
|
22 | * <!-- begin-user-doc -->↵ | | 22 | * <!-- begin-user-doc -->↵
|
23 | * <!-- end-user-doc -->↵ | | 23 | * <!-- end-user-doc -->↵
|
24 | * @generated↵ | | 24 | * @generated↵
|
25 | */↵ | | 25 | */↵
|
26 | protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions)↵ | | 26 | protected void depopulateManager(IContributionManager manager, Collection<? extends IAction> actions)↵
|
27 | {↵ | | 27 | {↵
|
28 | if (actions != null)↵ | | 28 | if (actions != null)↵
|
29 | {↵ | | 29 | {↵
|
30 | IContributionItem[] items = manager.getItems();↵ | | 30 | IContributionItem[] items = manager.getItems();↵
|
31 | for (int i = 0; i < items.length; i++)↵ | | 31 | for (int i = 0; i < items.length; i++)↵
|
32 | {↵ | | 32 | {↵
|
33 | // Look into SubContributionItems↵ | | 33 | // Look into SubContributionItems↵
|
34 | //↵ | | 34 | //↵
|
35 | IContributionItem contributionItem = items[i];↵ | | 35 | IContributionItem contributionItem = items[i];↵
|
36 | while (contributionItem instanceof SubContributionItem)↵ | | 36 | while (contributionItem instanceof SubContributionItem)↵
|
37 | {↵ | | 37 | {↵
|
38 | contributionItem = ((SubContributionItem)contributionItem).getInnerItem();↵ | | 38 | contributionItem = ((SubContributionItem)contributionItem).getInnerItem();↵
|
39 | }↵ | | 39 | }↵
|
|
40 | // Delete the ActionContributionItems with matching action.↵ | | 40 | // Delete the ActionContributionItems with matching action.↵
|
41 | //↵ | | 41 | //↵
|
42 | if (contributionItem instanceof ActionContributionItem)↵ | | 42 | if (contributionItem instanceof ActionContributionItem)↵
|
43 | {↵ | | 43 | {↵
|
44 | IAction action = ((ActionContributionItem)contributionItem).getAction();↵ | | 44 | IAction action = ((ActionContributionItem)contributionItem).getAction();↵
|
45 | if (actions.contains(action))↵ | | 45 | if (actions.contains(action))↵
|
46 | {↵ | | 46 | {↵
|
47 | manager.remove(contributionItem);↵ | | 47 | manager.remove(contributionItem);↵
|
48 | }↵ | | 48 | }↵
|
49 | }↵ | | 49 | }↵
|
50 | }↵ | | 50 | }↵
|
51 | }↵ | | 51 | }↵
|
52 | }↵ | | 52 | }↵
|
|
53 | /**↵ | | 53 | /**↵
|
54 | * This populates the pop-up menu before it appears.↵ | | 54 | * This populates the pop-up menu before it appears.↵
|
55 | * <!-- begin-user-doc -->↵ | | 55 | * <!-- begin-user-doc -->↵
|
56 | * <!-- end-user-doc -->↵ | | 56 | * <!-- end-user-doc -->↵
|
57 | * @generated↵ | | 57 | * @generated↵
|
58 | */↵ | | 58 | */↵
|
59 | @Override↵ | | 59 | @Override↵
|
60 | public void menuAboutToShow(IMenuManager menuManager)↵ | | 60 | public void menuAboutToShow(IMenuManager menuManager)↵
|
61 | {↵ | | 61 | {↵
|
62 | super.menuAboutToShow(menuManager);↵ | | 62 | super.menuAboutToShow(menuManager);↵
|
63 | MenuManager submenuManager = null;↵ | | 63 | MenuManager submenuManager = null;↵
|
|
64 | submenuManager = new MenuManager(EcoreEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));↵ | | 64 | submenuManager = new MenuManager(Ecore2XMLUIPlugin.INSTANCE.getString("_UI_CreateChild_menu_item")); //$NON-NLS-1$↵
|
65 | populateManager(submenuManager, createChildActions, null);↵ | | 65 | populateManager(submenuManager, createChildActions, null);↵
|
66 | menuManager.insertBefore("edit", submenuManager);↵ | | 66 | menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$↵
|
|
67 | submenuManager = new MenuManager(EcoreEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));↵ | | 67 | submenuManager = new MenuManager(Ecore2XMLUIPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item")); //$NON-NLS-1$↵
|
68 | populateManager(submenuManager, createSiblingActions, null);↵ | | 68 | populateManager(submenuManager, createSiblingActions, null);↵
|
69 | menuManager.insertBefore("edit", submenuManager);↵ | | 69 | menuManager.insertBefore("edit", submenuManager); //$NON-NLS-1$↵
|
70 | }↵ | | 70 | }↵
|
|
71 | /**↵ | | 71 | /**↵
|
72 | * This inserts global actions before the "additions-end" separator.↵ | | 72 | * This inserts global actions before the "additions-end" separator.↵
|
73 | * <!-- begin-user-doc -->↵ | | 73 | * <!-- begin-user-doc -->↵
|
74 | * <!-- end-user-doc -->↵ | | 74 | * <!-- end-user-doc -->↵
|
75 | * @generated↵ | | 75 | * @generated↵
|
76 | */↵ | | 76 | */↵
|
77 | @Override↵ | | 77 | @Override↵
|
78 | protected void addGlobalActions(IMenuManager menuManager)↵ | | 78 | protected void addGlobalActions(IMenuManager menuManager)↵
|
79 | {↵ | | 79 | {↵
|
80 | menuManager.insertAfter("additions-end", new Separator("ui-actions"));↵ | | 80 | menuManager.insertAfter("additions-end", new Separator("ui-actions")); //$NON-NLS-1$ //$NON-NLS-2$↵
|
81 | menuManager.insertAfter("ui-actions", showPropertiesViewAction);↵ | | 81 | menuManager.insertAfter("ui-actions", showPropertiesViewAction); //$NON-NLS-1$↵
|
|
82 | refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); ↵ | | 82 | refreshViewerAction.setEnabled(refreshViewerAction.isEnabled()); ↵
|
83 | menuManager.insertAfter("ui-actions", refreshViewerAction);↵ | | 83 | menuManager.insertAfter("ui-actions", refreshViewerAction); //$NON-NLS-1$↵
|
|
84 | super.addGlobalActions(menuManager);↵ | | 84 | super.addGlobalActions(menuManager);↵
|
85 | }↵ | | 85 | }↵
|
|
86 | /**↵ | | 86 | /**↵
|
87 | * This ensures that a delete action will clean up all references to deleted objects.↵ | | 87 | * This ensures that a delete action will clean up all references to deleted objects.↵
|
88 | * <!-- begin-user-doc -->↵ | | 88 | * <!-- begin-user-doc -->↵
|
89 | * <!-- end-user-doc -->↵ | | 89 | * <!-- end-user-doc -->↵
|
90 | * @generated↵ | | 90 | * @generated↵
|
91 | */↵ | | 91 | */↵
|
92 | @Override↵ | | 92 | @Override↵
|
93 | protected boolean removeAllReferencesOnDelete()↵ | | 93 | protected boolean removeAllReferencesOnDelete()↵
|
94 | {↵ | | 94 | {↵
|
95 | return true; | | 95 | return true;
|