Mercurial > projects > dwt-addons
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwtx/jface/action/AbstractGroupMarker.d Tue Apr 01 08:00:31 2008 +0200 @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2000, 2006 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 + * Port to the D programming language: + * Frank Benoit <benoit@tionex.de> + *******************************************************************************/ +module dwtx.jface.action.AbstractGroupMarker; + +import dwtx.jface.action.ContributionItem; + +import dwtx.core.runtime.Assert; + +import dwt.dwthelper.utils; + +/** + * Abstract superclass for group marker classes. + * <p> + * This class is not intended to be subclassed outside the framework. + * </p> + */ +public abstract class AbstractGroupMarker : ContributionItem { + /** + * Constructor for use by subclasses. + */ + protected this() { + } + + /** + * 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 this(String groupName) { + super(groupName); + Assert.isTrue(groupName !is 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 bool isGroupMarker() { + return getId() !is null; + } +}