Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 212935 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gef/handles/ConnectionEndHandle.java (-24 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-28 Link Here
13
import org.eclipse.draw2d.ConnectionLocator;
13
import org.eclipse.draw2d.ConnectionLocator;
14
14
15
import org.eclipse.gef.ConnectionEditPart;
15
import org.eclipse.gef.ConnectionEditPart;
16
import org.eclipse.gef.DragTracker;
17
import org.eclipse.gef.RequestConstants;
18
import org.eclipse.gef.tools.ConnectionEndpointTracker;
19
16
20
/**
17
/**
21
 * A handle used at the end of the {@link org.eclipse.draw2d.Connection}.  
18
 * A handle used at the end of the {@link org.eclipse.draw2d.Connection}.  
22
 * This is treated differently than the start of the Connection.
19
 * This is treated differently than the start of the Connection.
20
 * @deprecated use {@link ConnectionEndpointHandle}
23
 */
21
 */
24
public final class ConnectionEndHandle
22
public final class ConnectionEndHandle
25
	extends ConnectionHandle
23
	extends ConnectionEndpointHandle
26
{
24
{
27
25
28
/**
26
/**
Lines 31-38 Link Here
31
 * @param owner the ConnectionEditPart owner
29
 * @param owner the ConnectionEditPart owner
32
 */
30
 */
33
public ConnectionEndHandle(ConnectionEditPart owner) {
31
public ConnectionEndHandle(ConnectionEditPart owner) {
34
	setOwner(owner);
32
	super(owner, ConnectionLocator.SOURCE);
35
	setLocator(new ConnectionLocator(getConnection(), ConnectionLocator.TARGET));
36
}
33
}
37
34
38
/**
35
/**
Lines 42-69 Link Here
42
 * @param fixed if true, handle cannot be dragged
39
 * @param fixed if true, handle cannot be dragged
43
 */
40
 */
44
public ConnectionEndHandle(ConnectionEditPart owner, boolean fixed) {
41
public ConnectionEndHandle(ConnectionEditPart owner, boolean fixed) {
45
	super(fixed);
42
	super(owner, fixed, ConnectionLocator.SOURCE);
46
	setOwner(owner);
47
	setLocator(new ConnectionLocator(getConnection(), ConnectionLocator.TARGET));
48
}
43
}
49
44
50
/**
45
/**
51
 * Creates a new ConnectionEndHandle.
46
 * Creates a new ConnectionEndHandle.
52
 */
47
 */
53
public ConnectionEndHandle() { }
48
public ConnectionEndHandle() { 
54
49
	super(ConnectionLocator.SOURCE);
55
/**
56
 * Creates and returns a new {@link ConnectionEndpointTracker}.
57
 * @return the new ConnectionEndpointTracker
58
 */
59
protected DragTracker createDragTracker() {
60
	if (isFixed())
61
		return null;
62
	ConnectionEndpointTracker tracker;
63
	tracker = new ConnectionEndpointTracker((ConnectionEditPart)getOwner());
64
	tracker.setCommandName(RequestConstants.REQ_RECONNECT_TARGET);
65
	tracker.setDefaultCursor(getCursor());
66
	return tracker;
67
}
50
}
68
51
69
}
52
}
(-)src/org/eclipse/gef/handles/ConnectionStartHandle.java (-24 / +7 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2005 IBM Corporation and others.
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 13-28 Link Here
13
import org.eclipse.draw2d.ConnectionLocator;
13
import org.eclipse.draw2d.ConnectionLocator;
14
14
15
import org.eclipse.gef.ConnectionEditPart;
15
import org.eclipse.gef.ConnectionEditPart;
16
import org.eclipse.gef.DragTracker;
17
import org.eclipse.gef.RequestConstants;
18
import org.eclipse.gef.tools.ConnectionEndpointTracker;
19
16
20
/**
17
/**
21
 * A handle used at the start of the {@link org.eclipse.draw2d.Connection}.  
18
 * A handle used at the start of the {@link org.eclipse.draw2d.Connection}.  
22
 * This is treated differently than the end of the Connection.
19
 * This is treated differently than the end of the Connection.
20
 * @deprecated use {@link ConnectionEndpointHandle}
23
 */
21
 */
24
public final class ConnectionStartHandle
22
public final class ConnectionStartHandle
25
	extends ConnectionHandle
23
	extends ConnectionEndpointHandle
26
{
24
{
27
	
25
	
28
/**
26
/**
Lines 31-38 Link Here
31
 * @param owner the ConnectionEditPart owner
29
 * @param owner the ConnectionEditPart owner
32
 */
30
 */
33
public ConnectionStartHandle(ConnectionEditPart owner) {
31
public ConnectionStartHandle(ConnectionEditPart owner) {
34
	setOwner(owner);
32
	super(owner, ConnectionLocator.TARGET);
35
	setLocator(new ConnectionLocator(getConnection(), ConnectionLocator.SOURCE));
36
}
33
}
37
34
38
/**
35
/**
Lines 42-69 Link Here
42
 * @param fixed if true, handle cannot be dragged.
39
 * @param fixed if true, handle cannot be dragged.
43
 */
40
 */
44
public ConnectionStartHandle(ConnectionEditPart owner, boolean fixed) {
41
public ConnectionStartHandle(ConnectionEditPart owner, boolean fixed) {
45
	super(fixed);
42
	super(owner, fixed, ConnectionLocator.SOURCE);
46
	setOwner(owner);
47
	setLocator(new ConnectionLocator(getConnection(), ConnectionLocator.SOURCE));
48
}
43
}
49
44
50
/**
45
/**
51
 * Creates a new ConnectionStartHandle.
46
 * Creates a new ConnectionStartHandle.
52
 */
47
 */
53
public ConnectionStartHandle() { }
48
public ConnectionStartHandle() { 
54
49
	super(ConnectionLocator.TARGET);
55
/**
56
 * Creates and returns a new {@link ConnectionEndpointTracker}.
57
 * @return the new ConnectionEndpointTracker
58
 */
59
protected DragTracker createDragTracker() {
60
	if (isFixed()) 
61
		return null;
62
	ConnectionEndpointTracker tracker;
63
	tracker = new ConnectionEndpointTracker((ConnectionEditPart)getOwner());
64
	tracker.setCommandName(RequestConstants.REQ_RECONNECT_SOURCE);
65
	tracker.setDefaultCursor(getCursor());
66
	return tracker;
67
}
50
}
68
51
69
}
52
}
(-)src/org/eclipse/gef/handles/ConnectionEndpointHandle.java (+112 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.gef.handles;
12
13
import org.eclipse.core.runtime.Assert;
14
15
import org.eclipse.draw2d.ConnectionLocator;
16
17
import org.eclipse.gef.ConnectionEditPart;
18
import org.eclipse.gef.DragTracker;
19
import org.eclipse.gef.RequestConstants;
20
import org.eclipse.gef.tools.ConnectionEndpointTracker;
21
22
/**
23
 * A handle used at the start or end of the
24
 * {@link org.eclipse.draw2d.Connection}. A ConnectionEndpointHandle may be
25
 * extended rather than using the final {@link ConnectionStartHandle} or
26
 * {@link ConnectionEndHandle}
27
 * 
28
 * @author Anthony Hunter
29
 * @since 3.4
30
 */
31
public class ConnectionEndpointHandle extends ConnectionHandle {
32
33
	/**
34
	 * Caches whether the handle is for the source or target endpoint. endPoint
35
	 * is either {@link ConnectionLocator#SOURCE} or
36
	 * {@link ConnectionLocator#TARGET}.
37
	 */
38
	private int endPoint;
39
40
	/**
41
	 * Creates a new ConnectionStartHandle, sets its owner to <code>owner</code>,
42
	 * and sets its locator to a {@link ConnectionLocator}.
43
	 * 
44
	 * @param owner
45
	 *            the ConnectionEditPart owner
46
	 * @param endPoint
47
	 *            one of {@link ConnectionLocator#SOURCE} or
48
	 *            {@link ConnectionLocator#TARGET}.
49
	 */
50
	public ConnectionEndpointHandle(ConnectionEditPart owner, int endPoint) {
51
		setOwner(owner);
52
		Assert.isTrue(endPoint == ConnectionLocator.SOURCE
53
				|| endPoint == ConnectionLocator.TARGET);
54
		this.endPoint = endPoint;
55
		setLocator(new ConnectionLocator(getConnection(), endPoint));
56
	}
57
58
	/**
59
	 * Creates a new ConnectionStartHandle and sets its owner to
60
	 * <code>owner</code>. If the handle is fixed, it cannot be dragged.
61
	 * 
62
	 * @param owner
63
	 *            the ConnectionEditPart owner
64
	 * @param fixed
65
	 *            if true, handle cannot be dragged.
66
	 * @param endPoint
67
	 *            one of {@link ConnectionLocator#SOURCE} or
68
	 *            {@link ConnectionLocator#TARGET}.
69
	 */
70
	public ConnectionEndpointHandle(ConnectionEditPart owner, boolean fixed,
71
			int endPoint) {
72
		super(fixed);
73
		setOwner(owner);
74
		Assert.isTrue(endPoint == ConnectionLocator.SOURCE
75
				|| endPoint == ConnectionLocator.TARGET);
76
		this.endPoint = endPoint;
77
		setLocator(new ConnectionLocator(getConnection(), endPoint));
78
	}
79
80
	/**
81
	 * Creates a new ConnectionStartHandle.
82
	 * 
83
	 * @param endPoint
84
	 *            one of {@link ConnectionLocator#SOURCE} or
85
	 *            {@link ConnectionLocator#TARGET}.
86
	 */
87
	public ConnectionEndpointHandle(int endPoint) {
88
		Assert.isTrue(endPoint == ConnectionLocator.SOURCE
89
				|| endPoint == ConnectionLocator.TARGET);
90
		this.endPoint = endPoint;
91
	}
92
93
	/**
94
	 * Creates and returns a new {@link ConnectionEndpointTracker}.
95
	 * 
96
	 * @return the new ConnectionEndpointTracker
97
	 */
98
	protected DragTracker createDragTracker() {
99
		if (isFixed())
100
			return null;
101
		ConnectionEndpointTracker tracker;
102
		tracker = new ConnectionEndpointTracker((ConnectionEditPart) getOwner());
103
		if (endPoint == ConnectionLocator.SOURCE) {
104
			tracker.setCommandName(RequestConstants.REQ_RECONNECT_SOURCE);
105
		} else {
106
			tracker.setCommandName(RequestConstants.REQ_RECONNECT_TARGET);
107
		}
108
		tracker.setDefaultCursor(getCursor());
109
		return tracker;
110
	}
111
112
}

Return to bug 212935