Java Reference
In-Depth Information
</
outlet
>
</
component
>
</
workflow
>
We need a template named
TooltipEditPolicy.xpt
that we can place in
a
/templates-diagram
folder of our
org.eclipse.dsl.requirements
project. This folder needs to be added as a source path in the project; as does the
/diagrams
folder, we've placed our
tooltip.ecore
model and corresponding
dynamic instance there. Following is the content of the Xpand template file,
which could use some improvement. Chapters 7 and 14 cover Xpand, so we
don't get into the details here.
«
IMPORT
tooltip»
«
IMPORT
gmfgen»
«
IMPORT
ecore»
«
EXTENSION
Utils»
«
DEFINE
Main
FOR
Model»
«
FOREACH
tooltips
AS
tooltip»
«
EXPAND
EditPolicy
FOR
tooltip»
«
ENDFOREACH
»
«
ENDDEFINE
»
«
DEFINE
EditPolicy
FOR
tooltip::Tooltip»
«
FILE
editpolicy.editPolicyQualifiedClassName.replaceAll("\\.", "/") +
".java"-»
package «packageName(editpolicy.editPolicyQualifiedClassName)»;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.RoundedRectangle;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.StackLayout;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.text.FlowPage;
import org.eclipse.draw2d.text.ParagraphTextLayout;
import org.eclipse.draw2d.text.TextFlow;
import org.eclipse.gef.Request;
import org.eclipse.gef.editpolicies.GraphicalEditPolicy;
import org.eclipse.gef.requests.LocationRequest;
import org.eclipse.requirements.Requirement;
import org.eclipse.requirements.diagram.edit.parts.RequirementEditPart;
public class «className(editpolicy.editPolicyQualifiedClassName)»
extends GraphicalEditPolicy {
Search WWH ::
Custom Search