Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f87c90c803e80af10baf7bd80c910c07981d1064 (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
/*******************************************************************************
 * Copyright (c) 2000, 2005 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.action;

import org.eclipse.core.runtime.Assert;

/**
 * Abstract superclass for group marker classes.
 * <p>
 * This class is not intended to be subclassed outside the framework.
 * </p>
 */
public abstract class AbstractGroupMarker extends ContributionItem {
    /**
     * Constructor for use by subclasses.
     */
    protected AbstractGroupMarker() {
    }

    /**
     * Create a new group marker with the given name.
     * The group name must not be <code>null</code> or the empty string.
     * The group name is also used as the item id.
     * 
     * @param groupName the name of the group
     */
    protected AbstractGroupMarker(String groupName) {
        super(groupName);
        Assert.isTrue(groupName != null && groupName.length() > 0);
    }

    /**
     * Returns the group name.
     *
     * @return the group name
     */
    public String getGroupName() {
        return getId();
    }

    /**
     * The <code>AbstractGroupMarker</code> implementation of this <code>IContributionItem</code>
     * method returns <code>true</code> iff the id is not <code>null</code>. Subclasses may override.
     */
    public boolean isGroupMarker() {
        return getId() != null;
    }
}

Back to the top