blob: 4c85c97c26d5c7956f9ae00e460fd8535ddae7c1 [file] [log] [blame]
/*********************************************************************
* Copyright (c) 2005, 2019 SAP SE
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* Contributors:
* SAP SE - initial API, implementation and documentation
* mgorning - Bug 343983 - Notification for Cancelled Reconnection Events
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
package org.eclipse.graphiti.ui.internal.util.draw2d;
import org.eclipse.draw2d.ConnectionLocator;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.handles.ConnectionEndpointHandle;
import org.eclipse.gef.tools.ConnectionEndpointTracker;
import org.eclipse.graphiti.ui.internal.policy.GFConnectionEndpointTracker;
/**
* @noinstantiate This class is not intended to be instantiated by clients.
* @noextend This class is not intended to be subclassed by clients.
*/
public class GFConnectionEndpointHandle extends ConnectionEndpointHandle {
private static Dimension HANDLE_DIMENSION = new Dimension(6, 6);
public GFConnectionEndpointHandle(ConnectionEditPart owner, int endPoint) {
super(owner, endPoint);
}
@Override
protected void init() {
setPreferredSize(HANDLE_DIMENSION);
}
@Override
protected DragTracker createDragTracker() {
if (isFixed())
return null;
ConnectionEndpointTracker tracker;
tracker = new GFConnectionEndpointTracker((ConnectionEditPart) getOwner());
if (getEndPoint() == ConnectionLocator.SOURCE) {
tracker.setCommandName(RequestConstants.REQ_RECONNECT_SOURCE);
} else {
tracker.setCommandName(RequestConstants.REQ_RECONNECT_TARGET);
}
tracker.setDefaultCursor(getCursor());
return tracker;
}
}