Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: d179fefecba3c473203ad4c0343ed62c5a340d0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
 * Copyright (c) 2008 Borland Software Corporation
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Artem Tikhomirov (Borland) - initial API and implementation
 */

IMPORT "http://www.eclipse.org/gmf/2008/GenModel"
IMPORT "http://www.eclipse.org/emf/2002/Ecore"

EXTENSION impl::actions::MenuAction

DEFINE Main FOR GenEditorGenerator
   <extension point="org.eclipse.ui.menus">
      EXPAND xpt::Common::xmlGeneratedTag
      <!-- menuContribution locationURI="menu:org.eclipse.ui.main.menu?after=">
      </menuContribution>
      <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?after=">
      </menuContribution -->
EXPAND menuContribution FOREACH contextMenus-
   </extension>

IF hasCommandsToContribute()-
   <extension point="org.eclipse.ui.commands">
      EXPAND xpt::Common::xmlGeneratedTag
      <category id="editor.iD" name="%cmdcategory.name" description="%cmdcategory.desc"/>
EXPAND commandContribution FOREACH contextMenus-
   </extension>
ENDIF-

IF hasHandlersToContribute()-
   <extension point="org.eclipse.ui.handlers">
      EXPAND xpt::Common::xmlGeneratedTag
EXPAND handlerContribution FOREACH contextMenus-
   </extension>
ENDIF-

   <!-- optionally, specify keybindings -->
ENDDEFINE

DEFINE menuContribution FOR gmfgen::GenContextMenu-
EXPAND _menuContribution(this, "popup:org.eclipse.gmf.runtime.diagram.ui.DiagramEditorContextMenu")-
ENDDEFINE

DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenContributionManagerERROR "Abstract menuContribution for " + thisENDDEFINE
DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenMenuManagerEXPAND _menuContribution(contextMenu, "popup:" + iD)ENDDEFINE
DEFINE menuContribution(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenToolBarManagerEXPAND _menuContribution(contextMenu, "toolbar:" + iD)ENDDEFINE

DEFINE _menuContribution(gmfgen::GenContextMenu contextMenu, String locationURI) FOR gmfgen::GenContributionManager-
      <menuContribution locationURI="locationURI">
EXPAND menuEntry(contextMenu) FOREACH items-
      </menuContribution>
EXPAND menuContribution(contextMenu) FOREACH items.typeSelect(GenContributionManager)-
ENDDEFINE


DEFINE commandContribution FOR gmfgen::GenContributionManager-
EXPAND commandContribution FOREACH items.typeSelect(GenCustomAction)-
EXPAND commandContribution FOREACH items.typeSelect(GenAction)-
EXPAND commandContribution FOREACH items.typeSelect(GenContributionManager)-
ENDDEFINE

DEFINE handlerContribution FOR gmfgen::GenContributionManager-
EXPAND handlerContribution FOREACH items.typeSelect(GenCustomAction).select(a | a.generateBoilerplate)-
EXPAND handlerContribution FOREACH items.typeSelect(GenContributionManager)-
ENDDEFINE

DEFINE commandContribution FOR gmfgen::GenCustomAction-
      <command id="EXPAND commandIdentifier"
         name="name"
         categoryId="owner.editorGen.editor.iD"
         defaultHandler="qualifiedClassName"/>
ENDDEFINE

DEFINE commandContribution FOR gmfgen::GenAction-
      <command id="EXPAND commandIdentifier"
         name="name/*FIXME: into i18n keys*/"
         categoryId="owner.editorGen.editor.iD"
         defaultHandler="qualifiedClassName"/>
ENDDEFINE

DEFINE handlerContribution FOR gmfgen::GenCustomAction-
      <handler
         commandId="EXPAND commandIdentifier"
         class="qualifiedClassName">
         <enabledWhen>
           <with variable="activePartId"><equals value="owner.editorGen.editor.iD"/></with>
         </enabledWhen>
      </handler>
ENDDEFINE

DEFINE commandIdentifier FOR gmfgen::GenCustomActionowner.editorGen.plugin.iD.qualifiedClassName.split('\\.').last()ENDDEFINE
DEFINE commandIdentifier FOR gmfgen::GenActionowner.editorGen.plugin.iD.qualifiedClassName.split('\\.').last()ENDDEFINE

DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenContributionItemREMNO-OP XXX or ERROR?ENDREMENDDEFINE
DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenSeparator-
         <separator IF groupName != nullname="groupName" ENDIFvisible="true"/>
ENDDEFINE
DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenGroupMarker-
         <separator name="groupName"/>
ENDDEFINE
DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenCommandAction-
         <command commandId="commandIdentifier">
            <visibleWhen>
EXPAND menuCondition FOR contextMenu-
            </visibleWhen>
         </command>
ENDDEFINE
DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenCustomAction-
         <command commandId="EXPAND commandIdentifier">
            <visibleWhen>
EXPAND menuCondition FOR contextMenu-
            </visibleWhen>
         </command>
ENDDEFINE
DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenAction-
         <command commandId="EXPAND commandIdentifier">
            <visibleWhen>
EXPAND menuCondition FOR contextMenu-
            </visibleWhen>
         </command>
ENDDEFINE

DEFINE menuEntry(gmfgen::GenContextMenu contextMenu) FOR gmfgen::GenMenuManager
         <menu id="iD" label="name">
            <visibleWhen>
EXPAND menuCondition FOR contextMenu-
            </visibleWhen>
         </menu>
ENDDEFINE

DEFINE menuCondition FOR gmfgen::GenContextMenu-
               <and>
                  <with variable="activePartId"><equals value="editorGen.editor.iD"/></with>
                  <with variable="selection"><iterateIF context.size() > 1 operator="or"ENDIF ifEmpty="false">
REMXXX, perhaps, <adapt type="EditPart">?ENDREM-
FOREACH context AS de-
                     <instanceof value="de.getEditPartQualifiedClassName()"/>
ENDFOREACH-
                  </iterate></with>
               </and>
ENDDEFINE

DEFINE i18n FOR gmfgen::GenEditorGenerator-
IF hasCommandsToContribute()-
# Commands and menu actions
cmdcategory.name=modelID Editor Commands
cmdcategory.desc=modelID Editor Commands
ENDIF
ENDDEFINE

Back to the top