|
1 /* |
|
2 * Copyright (c) 2006, 2007 Borland Software Corporation |
|
3 * |
|
4 * All rights reserved. This program and the accompanying materials |
|
5 * are made available under the terms of the Eclipse Public License v1.0 |
|
6 * which accompanies this distribution, and is available at |
|
7 * http://www.eclipse.org/legal/epl-v10.html |
|
8 * |
|
9 * Contributors: |
|
10 * Dmitry Stadnik (Borland) - initial API and implementation |
|
11 * Alexander Shatalin (Borland) - initial API and implementation |
|
12 */ |
|
13 |
|
14 «IMPORT "http://www.eclipse.org/gmf/2008/GenModel"» |
|
15 |
|
16 «DEFINE initializer FOR gmfgen::GenExternalNodeLabel-» |
|
17 «EXPAND xpt::Common::generatedMemberComment» |
|
18 static { |
|
19 registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID»), new org.eclipse.draw2d.geometry.Point(0, 0)); |
|
20 } |
|
21 «ENDDEFINE» |
|
22 |
|
23 «DEFINE constructor FOR gmfgen::GenExternalNodeLabel-» |
|
24 «EXPAND xpt::Common::generatedMemberComment» |
|
25 public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) { |
|
26 super(view); |
|
27 } |
|
28 «ENDDEFINE» |
|
29 |
|
30 «DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenExternalNodeLabel-» |
|
31 super.createDefaultEditPolicies(); |
|
32 installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy()); |
|
33 «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-» |
|
34 «ENDDEFINE» |
|
35 |
|
36 «DEFINE getBorderItemLocator FOR gmfgen::GenExternalNodeLabel-» |
|
37 «EXPAND xpt::Common::generatedMemberComment» |
|
38 public org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator getBorderItemLocator() { |
|
39 org.eclipse.draw2d.IFigure parentFigure = getFigure().getParent(); |
|
40 if (parentFigure != null && parentFigure.getLayoutManager() != null) { |
|
41 Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure()); |
|
42 return (org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator) constraint; |
|
43 } |
|
44 return null; |
|
45 } |
|
46 «ENDDEFINE» |
|
47 |
|
48 «DEFINE refreshBounds FOR gmfgen::GenExternalNodeLabel-» |
|
49 «EXPAND xpt::Common::generatedMemberComment» |
|
50 public void refreshBounds() { |
|
51 int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue(); |
|
52 int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue(); |
|
53 int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue(); |
|
54 int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue(); |
|
55 getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height)); |
|
56 } |
|
57 «ENDDEFINE» |
|
58 |
|
59 «DEFINE handleNotificationEventBody FOR gmfgen::GenExternalNodeLabel-» |
|
60 Object feature = event.getFeature(); |
|
61 «EXPAND xpt::diagram::editparts::Common::handleText FOR this-» |
|
62 super.handleNotificationEvent(event); |
|
63 «ENDDEFINE» |
|
64 |
|
65 «DEFINE createFigure FOR gmfgen::GenExternalNodeLabel-» |
|
66 «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-» |
|
67 «ENDDEFINE» |