blob: ffcfc33c7acebd17d843ab54480b0c98f25b1187 [file] [log] [blame]
/******************************************************************************
* Copyright (c) 2003, 2004 IBM Corporation and others.
* 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:
* IBM Corporation - initial API and implementation
****************************************************************************/
package org.eclipse.gmf.runtime.diagram.ui.geoshapes.internal.editparts;
import org.eclipse.draw2d.Connection;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy;
import org.eclipse.gmf.runtime.diagram.ui.internal.editpolicies.NonSemanticEditPolicy;
import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
import org.eclipse.gmf.runtime.notation.View;
/**
* @author jschofie
*
* Controls the interactions between the Line and its underlying view
*/
public class LineEditPart extends ConnectionNodeEditPart {
public LineEditPart(View view) {
super(view);
}
/* (non-Javadoc)
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart#createConnectionFigure()
*/
protected Connection createConnectionFigure() {
PolylineConnectionEx conn = new PolylineConnectionEx();
return conn;
}
/**
* Adds support for diagram links.
* @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#createDefaultEditPolicies()
*/
protected void createDefaultEditPolicies() {
super.createDefaultEditPolicies();
// Remove semantic edit policy and install a non-semantic edit policy
removeEditPolicy(EditPolicyRoles.SEMANTIC_ROLE);
installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE,
new NonSemanticEditPolicy());
// This View doesn't have semantic elements so use a component edit
// policy that only gets a command to delete the view
installEditPolicy(EditPolicy.COMPONENT_ROLE,
new ViewComponentEditPolicy());
}
}