Skip to main content
summaryrefslogtreecommitdiffstats
blob: 59875dbc540ca46d84a40d109afef8e5f3477b05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*******************************************************************************
 * Copyright (c) 2004, 2005 Sybase, Inc. 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:
 *     Sybase, Inc. - initial API and implementation
 *******************************************************************************/

package org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy;

import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.preference.GEMPreferences;

/**
 * Customize the endpoint edit policy for pageflow links
 *
 */
public class PFLinkEndpointEditPolicy extends ConnectionEndpointEditPolicy {
	/**
	 * 
	 */
	public PFLinkEndpointEditPolicy() {
		super();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ConnectionEndpointEditPolicy#addSelectionHandles
	 */
	protected void addSelectionHandles() {
		super.addSelectionHandles();
		IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
		int connectionWidth = store.getInt(GEMPreferences.LINE_WIDTH);
		getConnectionFigure().setLineWidth(connectionWidth + 1);
	}

	private PolylineConnection getConnectionFigure() {
		return (PolylineConnection) ((GraphicalEditPart) getHost()).getFigure();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see ConnectionEndpointEditPolicy#removeSelectionHandles
	 */
	protected void removeSelectionHandles() {
		super.removeSelectionHandles();
		IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
		int connectionWidth = store.getInt(GEMPreferences.LINE_WIDTH);
		getConnectionFigure().setLineWidth(connectionWidth);
	}
}

Back to the top