/** | |
* <copyright> | |
* | |
* Copyright (c) 2013 itemis and others. | |
* All rights reserved. This program and the accompanying materials | |
* are made available under the terms of the Eclipse Public License v2.0 | |
* which accompanies this distribution, and is available at | |
* https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html | |
* | |
* Contributors: | |
* itemis - Initial API and implementation | |
* | |
* </copyright> | |
*/ | |
package org.eclipse.sphinx.examples.hummingbird20.diagram.gmf.edit.parts; | |
import org.eclipse.draw2d.Connection; | |
import org.eclipse.draw2d.PolylineDecoration; | |
import org.eclipse.draw2d.RotatableDecoration; | |
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart; | |
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart; | |
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles; | |
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx; | |
import org.eclipse.gmf.runtime.notation.View; | |
import org.eclipse.sphinx.examples.hummingbird20.diagram.gmf.edit.policies.ConnectionItemSemanticEditPolicy; | |
import org.eclipse.swt.graphics.Color; | |
/** | |
* @generated | |
*/ | |
public class ConnectionEditPart extends ConnectionNodeEditPart implements ITreeBranchEditPart { | |
/** | |
* @generated | |
*/ | |
public static final int VISUAL_ID = 4001; | |
/** | |
* @generated | |
*/ | |
public ConnectionEditPart(View view) { | |
super(view); | |
} | |
/** | |
* @generated | |
*/ | |
@Override | |
protected void createDefaultEditPolicies() { | |
super.createDefaultEditPolicies(); | |
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new ConnectionItemSemanticEditPolicy()); | |
} | |
/** | |
* Creates figure for this edit part. Body of this method does not depend on settings in generation model so you may | |
* safely remove <i>generated</i> tag and modify it. | |
* | |
* @generated | |
*/ | |
@Override | |
protected Connection createConnectionFigure() { | |
return new ConnectionFigure(); | |
} | |
/** | |
* @generated | |
*/ | |
public ConnectionFigure getPrimaryShape() { | |
return (ConnectionFigure) getFigure(); | |
} | |
/** | |
* @generated | |
*/ | |
public class ConnectionFigure extends PolylineConnectionEx { | |
/** | |
* @generated | |
*/ | |
public ConnectionFigure() { | |
setForegroundColor(THIS_FORE); | |
setTargetDecoration(createTargetDecoration()); | |
} | |
/** | |
* @generated | |
*/ | |
private RotatableDecoration createTargetDecoration() { | |
PolylineDecoration df = new PolylineDecoration(); | |
return df; | |
} | |
} | |
/** | |
* @generated | |
*/ | |
static final Color THIS_FORE = new Color(null, 0, 0, 0); | |
} |