Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 10e2a785aca5338304d2ba830c60ec165b56fa1e (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
/*
 * Copyright (c) 2006, 2009 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:
 *    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 initializer FOR gmfgen::GenLinkLabel-»
	«EXPAND xpt::Common::generatedMemberComment»
	static {
		registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::typeMethodCall»,
				new org.eclipse.draw2d.geometry.Point(«labelOffsetX(viewmap, 0)», «labelOffsetY(viewmap, 0)»));
	}
«ENDDEFINE»

«DEFINE _constructor FOR gmfgen::GenLinkLabel-»
	«EXPAND xpt::Common::generatedMemberComment»
	public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
		super(view);
	}
«ENDDEFINE»

«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLinkLabel-»
	super.createDefaultEditPolicies();
	installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE,
			new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
	installEditPolicy(org.eclipse.gef.EditPolicy.SELECTION_FEEDBACK_ROLE,
			new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»());
	installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE,
			new org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableLabelEditPolicy() {

		protected java.util.List createSelectionHandles() {
			org.eclipse.gef.handles.MoveHandle mh = new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
			mh.setBorder(null);
			return java.util.Collections.singletonList(mh);
		}
	});
	«EXPAND xpt::diagram::editparts::Common::behaviour FOR self-»
«ENDDEFINE»

«DEFINE getKeyPoint FOR gmfgen::GenLinkLabel-»
	«EXPAND xpt::Common::generatedMemberComment»
	public int getKeyPoint() {
		return org.eclipse.draw2d.ConnectionLocator.«alignment»;
	}
«ENDDEFINE»

«DEFINE handleNotificationEventBody FOR gmfgen::GenLinkLabel-»
	Object feature = event.getFeature();
	«EXPAND xpt::diagram::editparts::Common::handleText FOR self-»
	super.handleNotificationEvent(event);
«ENDDEFINE»

Back to the top