List of usage examples for org.eclipse.jface.viewers DecoratingLabelProvider dispose
@Override public void dispose()
DecoratingLabelProvider
implementation of this IBaseLabelProvider
method disposes both the nested label provider and the label decorator. From source file:gov.redhawk.ide.debug.ui.LaunchUtil.java
License:Open Source License
/** * Presents the user with a dialog to choose which implementation from an SPD to run. * * @param impls The implementations to present to the user * @param mode The string "run" or "debug" (displayed to user) * @param shell The window object//www .j a va2s.c om * @return The selected implementation */ public static Implementation chooseImplementation(final Collection<Implementation> impls, final String mode, final Shell shell) { Assert.isNotNull(impls); Assert.isNotNull(mode); Assert.isNotNull(shell); if (impls.size() == 1) { return impls.iterator().next(); } final SpdItemProviderAdapterFactory adapterFactory = new SpdItemProviderAdapterFactory(); final DecoratingLabelProvider labelProvider = new DecoratingLabelProvider( new AdapterFactoryLabelProvider(adapterFactory), PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()); final ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider); dialog.setElements(impls.toArray()); dialog.setTitle("Select Implementation"); dialog.setMessage("Select an implementation to " + mode + ":"); dialog.setMultipleSelection(false); final int result = dialog.open(); labelProvider.dispose(); adapterFactory.dispose(); if (result == Window.OK) { return (Implementation) dialog.getFirstResult(); } return null; }