01: /*******************************************************************************
02: * Copyright (c) 2003, 2004 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Common Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/cpl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.openwfe.gpe.policies;
11:
12: import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
13:
14: import org.openwfe.gpe.figures.NoChildLabel;
15: import org.openwfe.gpe.parts.NoChildPart;
16:
17: /**
18: * Handles selection of SimpleActivites. Primary
19: * selection is denoted by highlight and a focus rectangle. Normal selection is denoted
20: * by highlight only.
21: *
22: * @author Daniel Lee
23: */
24: public class SimpleActivitySelectionEditPolicy extends
25: NonResizableEditPolicy {
26:
27: private NoChildLabel getLabel() {
28: NoChildPart part = (NoChildPart) getHost();
29: return ((NoChildLabel) part.getFigure());
30: }
31:
32: /**
33: * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#hideFocus()
34: */
35: protected void hideFocus() {
36: getLabel().setFocus(false);
37: }
38:
39: /**
40: * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection()
41: */
42: protected void hideSelection() {
43: getLabel().setSelected(false);
44: getLabel().setFocus(false);
45:
46: }
47:
48: /**
49: * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#showFocus()
50: */
51: protected void showFocus() {
52: getLabel().setFocus(true);
53: }
54:
55: /**
56: * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
57: */
58: protected void showPrimarySelection() {
59: getLabel().setSelected(true);
60: getLabel().setFocus(true);
61: }
62:
63: /**
64: * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
65: */
66: protected void showSelection() {
67: getLabel().setSelected(true);
68: getLabel().setFocus(false);
69: }
70:
71: }
|