Mercurial > projects > dwt-addons
view dwtx/jface/viewers/NamedHandleObjectLabelProvider.d @ 43:ea8ff534f622
Fix override and super aliases
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 11 Apr 2008 01:24:25 +0200 |
parents | b6c35faf97c8 |
children | 46a6e0e6ccd4 |
line wrap: on
line source
/******************************************************************************* * Copyright (c) 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 * Port to the D programming language: * Frank Benoit <benoit@tionex.de> *******************************************************************************/ module dwtx.jface.viewers.NamedHandleObjectLabelProvider; import dwtx.jface.viewers.DialogCellEditor; import dwtx.jface.viewers.LabelProvider; import dwtx.core.commands.common.NamedHandleObject; import dwtx.core.commands.common.NotDefinedException; import dwt.dwthelper.utils; /** * A label provider for instances of <code>NamedHandlerObject</code>, which * exposes the name as the label. * * @since 3.2 */ public final class NamedHandleObjectLabelProvider : LabelProvider { /** * The text of the element is simply the name of the element if its a * defined instance of <code>NamedHandleObject</code>. Otherwise, this * method just returns <code>null</code>. * * @param element * The element for which the text should be retrieved; may be * <code>null</code>. * @return the name of the handle object; <code>null</code> if there is no * name or if the element is not a named handle object. */ public override final String getText(Object element) { if ( cast(NamedHandleObject)element ) { try { return (cast(NamedHandleObject) element).getName(); } catch (NotDefinedException e) { return null; } } return null; } }