Project

General

Profile

Download (2.11 KB) Statistics
| Branch: | Tag: | Revision:
1
/*******************************************************************************
2
 * Copyright (c) 2006 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

    
12
package org.eclipse.ui.navigator;
13

    
14
/**
15
 * A descriptive construct to relay information about a menu insertion point;
16
 * including the name of the insertion point and whether the item should be
17
 * rendered as a separator or group marker.
18
 * 
19
 * @since 3.2
20
 * 
21
 */
22
public final class MenuInsertionPoint {
23
	private String name;
24

    
25
	private boolean isSeparator;
26
	
27
	private String toString;
28

    
29
	/**
30
	 * 
31
	 * @param aName
32
	 *            The name that clients will refer to when inserting items into
33
	 *            the menu at this point.
34
	 * @param toMakeASeparator
35
	 *            A value of true will cause the point to be rendered as a
36
	 *            org.eclipse.jface.action.Separator (a "bar" in the menu);
37
	 *            false will cause the point to be rendered as a
38
	 *            org.eclipse.jface.action.GroupMarker.
39
	 */
40
	public MenuInsertionPoint(String aName, boolean toMakeASeparator) {
41
		name = aName;
42
		isSeparator = toMakeASeparator;
43
	}
44

    
45
	/**
46
	 * 
47
	 * @return True if the point should be rendered as a
48
	 *         org.eclipse.jface.action.Separator (a "bar" in the menu); or
49
	 *         false if the point should be rendered as a
50
	 *         org.eclipse.jface.action.GroupMarker.
51
	 */
52
	public boolean isSeparator() {
53
		return isSeparator;
54
	}
55

    
56
	/**
57
	 * 
58
	 * @return The name that clients will refer to when inserting items into the
59
	 *         menu at this point.
60
	 */
61
	public String getName() {
62
		return name;
63
	}
64

    
65
	public String toString() { 
66
		if(toString == null) {
67
			toString = "MenuInsertionPoint[name=\""+name+"\", isSeparator="+isSeparator+"]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
68
		}
69
		return toString;
70
	}
71
}
(40-40/49)