01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: ******************************************************************************/package org.eclipse.ui.navigator;
11:
12: /**
13: * A descriptive construct to relay information about a menu insertion point;
14: * including the name of the insertion point and whether the item should be
15: * rendered as a separator or group marker.
16: *
17: * @since 3.2
18: *
19: */
20: public final class MenuInsertionPoint {
21: private String name;
22:
23: private boolean isSeparator;
24:
25: private String toString;
26:
27: /**
28: *
29: * @param aName
30: * The name that clients will refer to when inserting items into
31: * the menu at this point.
32: * @param toMakeASeparator
33: * A value of true will cause the point to be rendered as a
34: * org.eclipse.jface.action.Separator (a "bar" in the menu);
35: * false will cause the point to be rendered as a
36: * org.eclipse.jface.action.GroupMarker.
37: */
38: public MenuInsertionPoint(String aName, boolean toMakeASeparator) {
39: name = aName;
40: isSeparator = toMakeASeparator;
41: }
42:
43: /**
44: *
45: * @return True if the point should be rendered as a
46: * org.eclipse.jface.action.Separator (a "bar" in the menu); or
47: * false if the point should be rendered as a
48: * org.eclipse.jface.action.GroupMarker.
49: */
50: public boolean isSeparator() {
51: return isSeparator;
52: }
53:
54: /**
55: *
56: * @return The name that clients will refer to when inserting items into the
57: * menu at this point.
58: */
59: public String getName() {
60: return name;
61: }
62:
63: public String toString() {
64: if (toString == null) {
65: toString = "MenuInsertionPoint[name=\"" + name + "\", isSeparator=" + isSeparator + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
66: }
67: return toString;
68: }
69: }
|