public String getText(Object element) { if (element instanceof NavigatorContentDescriptor) { return ((INavigatorContentDescriptor) element).getName(); } else if (element instanceof ICommonFilterDescriptor) { return ((ICommonFilterDescriptor) element).getName(); } return null; }
/** * * @param descriptorId * The unique id of a particular descriptor * @return The name (value of the 'name' attribute) of the given descriptor */ public String getText(String descriptorId) { INavigatorContentDescriptor descriptor = getContentDescriptor(descriptorId); if (descriptor != null) { return descriptor.getName(); } return descriptorId; }
public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection structuredSelection = (IStructuredSelection) event .getSelection(); Object element = structuredSelection.getFirstElement(); if (element instanceof INavigatorContentDescriptor) { INavigatorContentDescriptor ncd = (INavigatorContentDescriptor) element; String desc = NLS .bind( CommonNavigatorMessages.CommonFilterSelectionDialog_Hides_all_content_associated, new Object[] { ncd.getName() }); descriptionText.setText(desc); } else if (element instanceof ICommonFilterDescriptor) { ICommonFilterDescriptor cfd = (ICommonFilterDescriptor) element; String description = cfd.getDescription(); if(description != null) descriptionText.setText(description); else descriptionText.setText(NLS.bind(CommonNavigatorMessages.FilterDialogSelectionListener_Enable_the_0_filter_, cfd.getName())); } }