Lines 18-37
Link Here
|
18 |
import org.eclipse.draw2d.IFigure; |
18 |
import org.eclipse.draw2d.IFigure; |
19 |
import org.eclipse.draw2d.MarginBorder; |
19 |
import org.eclipse.draw2d.MarginBorder; |
20 |
import org.eclipse.draw2d.PositionConstants; |
20 |
import org.eclipse.draw2d.PositionConstants; |
21 |
import org.eclipse.draw2d.RectangleFigure; |
|
|
22 |
import org.eclipse.draw2d.StackLayout; |
21 |
import org.eclipse.draw2d.StackLayout; |
23 |
import org.eclipse.draw2d.ToolbarLayout; |
22 |
import org.eclipse.draw2d.ToolbarLayout; |
24 |
import org.eclipse.draw2d.geometry.Dimension; |
23 |
import org.eclipse.draw2d.geometry.Dimension; |
|
|
24 |
import org.eclipse.draw2d.geometry.Insets; |
25 |
import org.eclipse.draw2d.geometry.Point; |
25 |
import org.eclipse.draw2d.geometry.Point; |
26 |
import org.eclipse.draw2d.geometry.PointList; |
26 |
import org.eclipse.draw2d.geometry.PointList; |
27 |
import org.eclipse.draw2d.geometry.Rectangle; |
27 |
import org.eclipse.draw2d.geometry.Rectangle; |
28 |
import org.eclipse.emf.common.notify.Notification; |
28 |
import org.eclipse.emf.common.notify.Notification; |
29 |
import org.eclipse.emf.ecore.EObject; |
29 |
import org.eclipse.emf.ecore.EObject; |
30 |
import org.eclipse.emf.ecore.EcorePackage; |
30 |
import org.eclipse.emf.ecore.EcorePackage; |
|
|
31 |
import org.eclipse.emf.ecoretools.diagram.edit.figures.AlphaDropShadowBorder; |
31 |
import org.eclipse.emf.ecoretools.diagram.edit.figures.FigureFromLabelUtils; |
32 |
import org.eclipse.emf.ecoretools.diagram.edit.figures.FigureFromLabelUtils; |
|
|
33 |
import org.eclipse.emf.ecoretools.diagram.edit.figures.GradientRectangleFigure; |
34 |
import org.eclipse.emf.ecoretools.diagram.edit.policies.AlphaResizableShapeEditPolicy; |
32 |
import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationItemSemanticEditPolicy; |
35 |
import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationItemSemanticEditPolicy; |
33 |
import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy; |
36 |
import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy; |
34 |
import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry; |
37 |
import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry; |
|
|
38 |
import org.eclipse.emf.ecoretools.diagram.preferences.IEcoreToolsPreferenceConstants; |
35 |
import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes; |
39 |
import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes; |
36 |
import org.eclipse.gef.EditPart; |
40 |
import org.eclipse.gef.EditPart; |
37 |
import org.eclipse.gef.EditPolicy; |
41 |
import org.eclipse.gef.EditPolicy; |
Lines 45-50
Link Here
|
45 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy; |
49 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy; |
46 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; |
50 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy; |
47 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
51 |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; |
|
|
52 |
import org.eclipse.gmf.runtime.diagram.ui.figures.DiagramColorConstants; |
48 |
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; |
53 |
import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest; |
49 |
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; |
54 |
import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout; |
50 |
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; |
55 |
import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel; |
Lines 133-142
Link Here
|
133 |
} |
138 |
} |
134 |
|
139 |
|
135 |
/** |
140 |
/** |
136 |
* @generated |
141 |
* @generated NOT |
137 |
*/ |
142 |
*/ |
138 |
protected IFigure createNodeShape() { |
143 |
protected IFigure createNodeShape() { |
139 |
AnnotationFigure figure = new AnnotationFigure(); |
144 |
AnnotationFigure figure = new AnnotationFigure(); |
|
|
145 |
figure.setShouldUseGradient((Boolean) getViewer().getProperty(IEcoreToolsPreferenceConstants.PREF_FILL_FIGURE_USING_GRADIENT)); |
140 |
return primaryShape = figure; |
146 |
return primaryShape = figure; |
141 |
} |
147 |
} |
142 |
|
148 |
|
Lines 208-213
Link Here
|
208 |
return getPrimaryShape().getPointsList(); |
214 |
return getPrimaryShape().getPointsList(); |
209 |
} |
215 |
} |
210 |
}; |
216 |
}; |
|
|
217 |
AlphaDropShadowBorder shadowBorder = new AlphaDropShadowBorder(); |
218 |
shadowBorder.setShouldDrawDropShadow((Boolean) getViewer().getProperty(IEcoreToolsPreferenceConstants.PREF_USE_SHADOW_ON_BORDER)); |
219 |
result.setBorder(shadowBorder); |
211 |
return result; |
220 |
return result; |
212 |
} |
221 |
} |
213 |
|
222 |
|
Lines 289-298
Link Here
|
289 |
super.refreshVisuals(); |
298 |
super.refreshVisuals(); |
290 |
} |
299 |
} |
291 |
|
300 |
|
|
|
301 |
@Override |
302 |
public EditPolicy getPrimaryDragEditPolicy() { |
303 |
return new AlphaResizableShapeEditPolicy(); |
304 |
} |
305 |
|
292 |
/** |
306 |
/** |
293 |
* @generated |
307 |
* @generated NOT |
294 |
*/ |
308 |
*/ |
295 |
public class AnnotationFigure extends RectangleFigure { |
309 |
public class AnnotationFigure extends GradientRectangleFigure { |
296 |
|
310 |
|
297 |
/** |
311 |
/** |
298 |
* @generated |
312 |
* @generated |
Lines 347-352
Link Here
|
347 |
desiredBounds.addPoint(point5); |
361 |
desiredBounds.addPoint(point5); |
348 |
|
362 |
|
349 |
graphics.fillPolygon(desiredBounds); |
363 |
graphics.fillPolygon(desiredBounds); |
|
|
364 |
|
365 |
if (shouldUseGradient()) { |
366 |
// fill gradient |
367 |
// get gradient rectangle |
368 |
Rectangle gradientRectangle = r.getCopy(); |
369 |
gradientRectangle.crop(new Insets(BENT_CORNER_HEIGHT, 0, 0, 0)); |
370 |
// draw gradient rectangle |
371 |
graphics.pushState(); |
372 |
graphics.setBackgroundColor(DiagramColorConstants.white); |
373 |
graphics.setForegroundColor(getBackgroundColor()); |
374 |
graphics.fillGradient(gradientRectangle, true); |
375 |
graphics.popState(); |
376 |
} |
350 |
} |
377 |
} |
351 |
|
378 |
|
352 |
@Override |
379 |
@Override |