KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > viewsupport > LabelProviderDisposer


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.viewsupport;
12
13
14 import org.eclipse.swt.events.DisposeEvent;
15 import org.eclipse.swt.events.DisposeListener;
16
17 import org.eclipse.jface.viewers.ILabelProvider;
18
19 /**
20  * Helper class to manage images that should be disposed when a control is disposed
21  * contol.addWidgetListener(new LabelProviderDisposer(myLabelProvider));
22  */

23 public class LabelProviderDisposer implements DisposeListener {
24     
25     private ILabelProvider fLabelProvider;
26         
27     public LabelProviderDisposer(ILabelProvider labelProvider) {
28         fLabelProvider= labelProvider;
29     }
30     
31     public void widgetDisposed(DisposeEvent e) {
32         fLabelProvider.dispose();
33     }
34 }
35
36
37
Popular Tags