annotate dwtx/jface/action/AbstractGroupMarker.d @ 16:e0f0aaf75edd

PopupDialog, bindings and actions
author Frank Benoit <benoit@tionex.de>
date Tue, 01 Apr 2008 08:00:31 +0200
parents
children ea8ff534f622
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
1 /*******************************************************************************
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
3 * All rights reserved. This program and the accompanying materials
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
4 * are made available under the terms of the Eclipse Public License v1.0
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
5 * which accompanies this distribution, and is available at
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
6 * http://www.eclipse.org/legal/epl-v10.html
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
7 *
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
8 * Contributors:
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
9 * IBM Corporation - initial API and implementation
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
10 * Port to the D programming language:
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
11 * Frank Benoit <benoit@tionex.de>
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
12 *******************************************************************************/
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
13 module dwtx.jface.action.AbstractGroupMarker;
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
14
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
15 import dwtx.jface.action.ContributionItem;
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
16
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
17 import dwtx.core.runtime.Assert;
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
18
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
19 import dwt.dwthelper.utils;
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
20
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
21 /**
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
22 * Abstract superclass for group marker classes.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
23 * <p>
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
24 * This class is not intended to be subclassed outside the framework.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
25 * </p>
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
26 */
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
27 public abstract class AbstractGroupMarker : ContributionItem {
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
28 /**
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
29 * Constructor for use by subclasses.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
30 */
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
31 protected this() {
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
32 }
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
33
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
34 /**
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
35 * Create a new group marker with the given name.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
36 * The group name must not be <code>null</code> or the empty string.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
37 * The group name is also used as the item id.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
38 *
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
39 * @param groupName the name of the group
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
40 */
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
41 protected this(String groupName) {
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
42 super(groupName);
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
43 Assert.isTrue(groupName !is null && groupName.length > 0);
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
44 }
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
45
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
46 /**
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
47 * Returns the group name.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
48 *
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
49 * @return the group name
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
50 */
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
51 public String getGroupName() {
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
52 return getId();
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
53 }
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
54
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
55 /**
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
56 * The <code>AbstractGroupMarker</code> implementation of this <code>IContributionItem</code>
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
57 * method returns <code>true</code> iff the id is not <code>null</code>. Subclasses may override.
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
58 */
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
59 public bool isGroupMarker() {
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
60 return getId() !is null;
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
61 }
e0f0aaf75edd PopupDialog, bindings and actions
Frank Benoit <benoit@tionex.de>
parents:
diff changeset
62 }