Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e40da64603d89693c095746e758ca68ae3994baf (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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
/*
 * Copyright (c) 2006, 2010 Borland Software Corporation and others
 * 
 * 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:
 *    Dmitry Stadnik (Borland) - initial API and implementation
 *    Alexander Shatalin (Borland) - initial API and implementation
 */

«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«EXTENSION xpt::diagram::ViewmapAttributesUtils»

«DEFINE fields FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	private org.eclipse.gef.tools.DirectEditManager manager;

	«EXPAND xpt::Common::generatedMemberComment»
	private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;

	«EXPAND xpt::Common::generatedMemberComment»
	private «EXPAND CodeStyle::G('java.util.List', '?')» parserElements;

	«EXPAND xpt::Common::generatedMemberComment»
	private String defaultText;
«ENDDEFINE»

«DEFINE methods(needsRefreshBounds : Boolean, readOnly : Boolean, useElementIcon : Boolean, viewmap : gmfgen::Viewmap,
		modelFacet : gmfgen::LabelModelFacet, host : gmfgen::GenCommonBase, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
	«EXPAND getLabelTextHelper-»
	
	«EXPAND setLabelTextHelper-»
	
	«EXPAND getLabelIconHelper-»
	
	«EXPAND setLabelIconHelper-»
	
	«EXPAND labelSetter-»
	
	«EXPAND getModelChildren-»
	
	«EXPAND getChildBySemanticHint-»
	
	«EXPAND getParserElement(modelFacet)-»
	
	«EXPAND getLabelIcon(useElementIcon, diagram)-»
	
	«EXPAND getLabelText-»
	
	«EXPAND setLabelText(diagram)-»
	
	«EXPAND getEditText-»
	
	«EXPAND isEditable(readOnly)-»
	
	«EXPAND getEditTextValidator-»
	
	«EXPAND getCompletionProcessor-»
	
	«EXPAND getParserOptions-»
	
	«EXPAND getParser(modelFacet, diagram, host)-»
	
	«EXPAND getManager(diagram)-»
	
	«EXPAND setManager-»
	
	«EXPAND performDirectEdit-»
	
	«EXPAND performDirectEditAtPoint-»
	
	«EXPAND performDirectEditWithInitialChar-»
	
	«EXPAND performDirectEditRequest-»
	
	«EXPAND refreshVisuals(needsRefreshBounds)-»
	
	«EXPAND refreshLabel(diagram)-»
	
	«EXPAND refreshUnderline-»
	
	«EXPAND refreshStrikeThrough-»
	
	«EXPAND refreshFont-»
	
	«EXPAND setFontColor-»
	
	«EXPAND addSemanticListeners-»
	
	«EXPAND removeSemanticListeners-»
	
	«EXPAND getAccessibleEditPart-»
	
	«EXPAND getFontStyleOwnerView(viewmap)-»
«ENDDEFINE»

«DEFINE labelSetterName FOR gmfgen::ParentAssignedViewmap-»
«IF setterName <> null»«setterName»«ELSE»setLabel«ENDIF-»
«ENDDEFINE»

«DEFINE labelSetterName FOR gmfgen::Viewmap»setLabel«ENDDEFINE»

«DEFINE getLabelTextHelper FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
		if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
		} else {
			return ((org.eclipse.draw2d.Label) figure).getText();
		}
	}
«ENDDEFINE»

«DEFINE setLabelTextHelper FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
		if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
		} else {
			((org.eclipse.draw2d.Label) figure).setText(text);
		}
	}
«ENDDEFINE»

«DEFINE getLabelIconHelper FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
		if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
		} else {
			return ((org.eclipse.draw2d.Label) figure).getIcon();
		}
	}
«ENDDEFINE»

«DEFINE setLabelIconHelper FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
		if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
		} else {
			((org.eclipse.draw2d.Label) figure).setIcon(icon);
		}
	}
«ENDDEFINE»

«DEFINE labelSetter FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public void «EXPAND labelSetterName FOR viewmap»(«EXPAND labelSetterFigureClassName FOR viewmap» figure) {
		unregisterVisuals();
		setFigure(figure);
		defaultText = getLabelTextHelper(figure);
		registerVisuals();
		refreshVisuals();
	}
«ENDDEFINE»

«DEFINE labelSetterFigureClassName FOR gmfgen::ParentAssignedViewmap-»
	«IF figureQualifiedClassName <> null-»
	«figureQualifiedClassName»
	«ELSE-»
	org.eclipse.draw2d.IFigure
	«ENDIF-»
«ENDDEFINE»

«DEFINE labelSetterFigureClassName FOR gmfgen::Viewmap-»
	org.eclipse.draw2d.IFigure
«ENDDEFINE»

«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	«EXPAND CodeStyle::SuppressWarnings('"rawtypes"')-»
	protected java.util.List getModelChildren() {
		return java.util.Collections.EMPTY_LIST;
	}
«ENDDEFINE»

«DEFINE getChildBySemanticHint FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
		return null;
	}
«ENDDEFINE»

«DEFINE getParserElement(modelFacet : gmfgen::LabelModelFacet) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.emf.ecore.EObject getParserElement() {
«IF modelFacet = null»
		org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
		return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
«ELSE»«EXPAND getParserElement FOR modelFacet»«ENDIF-»
	}
«ENDDEFINE»

«DEFINE getParserElement FOR gmfgen::LabelModelFacet-»
		return resolveSemanticElement();
«ENDDEFINE»

«DEFINE getParserElement FOR gmfgen::DesignLabelModelFacet-»
		return (org.eclipse.gmf.runtime.notation.View) getModel();
«ENDDEFINE»

«DEFINE getLabelIcon(useElementIcon : Boolean, diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.swt.graphics.Image getLabelIcon() {
		«IF useElementIcon-»
		org.eclipse.emf.ecore.EObject parserElement = getParserElement();
		if (parserElement == null) {
			return null;
		}
		return «diagram.getElementTypesQualifiedClassName()».getImage(parserElement.eClass());
		«ELSE-»
		return null;
		«ENDIF-»
	}
«ENDDEFINE»

«DEFINE getLabelText FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected String getLabelText() {
		String text = null;
		org.eclipse.emf.ecore.EObject parserElement = getParserElement();
		if (parserElement != null && getParser() != null) {
			text = getParser().getPrintString(
				new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
				getParserOptions().intValue());
		}
		if (text == null || text.length() == 0) {
			text = defaultText;
		}
		return text;
	}
«ENDDEFINE»

«DEFINE setLabelText(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public void setLabelText(String text) {
		setLabelTextHelper(getFigure(), text);
		Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
		if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
			((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
		}
		Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
		if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
			((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
		}
	}
«ENDDEFINE»

«DEFINE getEditText FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public String getEditText() {
		if (getParserElement() == null || getParser() == null) {
			return ""; «EXPAND xpt::Common::nonNLS»
		}
		return getParser().getEditString(
			new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
			getParserOptions().intValue());
	}
«ENDDEFINE»

«DEFINE isEditable(readOnly : Boolean) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected boolean isEditable() {
		«IF readOnly-»
		return false;
		«ELSE-»
		return getParser() != null;
		«ENDIF-»
	}
«ENDDEFINE»

«DEFINE getEditTextValidator FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
		return new org.eclipse.jface.viewers.ICellEditorValidator() {

			public String isValid(final Object value) {
				if (value instanceof String) {
					final org.eclipse.emf.ecore.EObject element = getParserElement();
					final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
					try {
						org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
							(org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
								new org.eclipse.emf.transaction.RunnableWithResult.Impl«EXPAND CodeStyle::G('org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus')»() {

							public void run() {
								setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
							}
						});
						return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
					} catch (InterruptedException ie) {
						ie.printStackTrace();
					}
				}

				// shouldn't get here
				return null;
			}
		};
	}
«ENDDEFINE»

«DEFINE getCompletionProcessor FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
		if (getParserElement() == null || getParser() == null) {
			return null;
		}
		return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
	}
«ENDDEFINE»

«DEFINE getParserOptions FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
		return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
	}
«ENDDEFINE»

«DEFINE getParser(modelFacet : gmfgen::LabelModelFacet, diagram : gmfgen::GenDiagram, host : gmfgen::GenCommonBase) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
		if (parser == null) {
			parser = «EXPAND parsers::ParserProvider::accessorCall(host, modelFacet, 'getParserElement()')»;
		}
		return parser;
	}
«ENDDEFINE»

«DEFINE getManager(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gef.tools.DirectEditManager getManager() {
		if (manager == null) {
			setManager(new org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager(this,
				org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.getTextCellEditorClass(this),
				«diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
		}
		return manager;
	}
«ENDDEFINE»

«DEFINE setManager FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
		this.manager = manager;
	}
«ENDDEFINE»

«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void performDirectEdit() {
		getManager().show();
	}
«ENDDEFINE»
	
«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
		if (getManager().getClass() == org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.class) {
			((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
		}
	}
«ENDDEFINE»
	
«DEFINE performDirectEditWithInitialChar FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	private void performDirectEdit(char initialCharacter) {
		if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
			((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
		} else {
			performDirectEdit();
		}
	}
«ENDDEFINE»
	
«DEFINE performDirectEditRequest FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void performDirectEditRequest(org.eclipse.gef.Request request) {
		final org.eclipse.gef.Request theRequest = request;
		try {
			getEditingDomain().runExclusive(new Runnable() {

				public void run() {
					if (isActive() && isEditable()) {
						if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
							Character initialChar = (Character) theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
							performDirectEdit(initialChar.charValue());
						} else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
							org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
							performDirectEdit(editRequest.getLocation());
						} else {
							performDirectEdit();
						}
					}
				}
			});
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
«ENDDEFINE»
	
«DEFINE refreshVisuals(needsRefreshBounds : Boolean) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void refreshVisuals() {
		super.refreshVisuals();
		refreshLabel();
		refreshFont();
		refreshFontColor();
		refreshUnderline();
		refreshStrikeThrough();
		«IF needsRefreshBounds-»
		refreshBounds();
		«ENDIF-»
	}
«ENDDEFINE»
	
«DEFINE refreshLabel(diagram : gmfgen::GenDiagram) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void refreshLabel() {
		setLabelTextHelper(getFigure(), getLabelText());
		setLabelIconHelper(getFigure(), getLabelIcon());
		Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
		if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
			((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
		}
		Object sfEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE);
		if (sfEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
			((«diagram.getTextSelectionEditPolicyQualifiedClassName()») sfEditPolicy).refreshFeedback();
		}
	}
«ENDDEFINE»
	
«DEFINE refreshUnderline FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void refreshUnderline() {
		org.eclipse.gmf.runtime.notation.FontStyle style =
			(org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
				org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
		if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
		}
	}
«ENDDEFINE»
	
«DEFINE refreshStrikeThrough FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void refreshStrikeThrough() {
		org.eclipse.gmf.runtime.notation.FontStyle style =
			(org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
				org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
		if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
			((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
		}
	}
«ENDDEFINE»
	
«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void refreshFont() {
		org.eclipse.gmf.runtime.notation.FontStyle style =
			(org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
				org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
		if (style != null) {
			org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
				style.getFontName(), style.getFontHeight(),
				(style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
				(style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
			setFont(fontData);
		}
	}
«ENDDEFINE»
	
«DEFINE setFontColor FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void setFontColor(org.eclipse.swt.graphics.Color color) {
		getFigure().setForegroundColor(color);
	}
«ENDDEFINE»
	
«DEFINE addSemanticListeners FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void addSemanticListeners() {
		if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
			org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
			parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
			for (int i = 0; i < parserElements.size(); i++) {
				addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «EXPAND xpt::Common::nonNLS»
			}
		} else {
			super.addSemanticListeners();
		}
	}
«ENDDEFINE»
	
«DEFINE removeSemanticListeners FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected void removeSemanticListeners() {
		if (parserElements != null) {
			for (int i = 0; i < parserElements.size(); i++) {
				removeListenerFilter("SemanticModel" + i); «EXPAND xpt::Common::nonNLS»
			}
		} else {
			super.removeSemanticListeners();
		}
	}
«ENDDEFINE»
	
«DEFINE getAccessibleEditPart FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
		if (accessibleEP == null) {
			accessibleEP = new AccessibleGraphicalEditPart() {

				public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
					e.result = getLabelTextHelper(getFigure());
				}
			};
		}
		return accessibleEP;
	}
«ENDDEFINE»
	
«DEFINE getFontStyleOwnerView(viewmap : gmfgen::Viewmap) FOR gmfgen::GenCommonBase-»
	«EXPAND xpt::Common::generatedMemberComment»
	 private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
		«IF viewmap.isFixedFont()-»
		return (org.eclipse.gmf.runtime.notation.View) getModel();
		«ELSE-»
		return getPrimaryView();
		«ENDIF-»
	 }
«ENDDEFINE»

Back to the top