01: /*******************************************************************************
02: * Copyright (c) 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.pde.internal.ui.editor.contentassist;
11:
12: import org.eclipse.jface.fieldassist.IContentProposalListener;
13: import org.eclipse.jface.fieldassist.IContentProposalListener2;
14: import org.eclipse.jface.viewers.ILabelProvider;
15: import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
16:
17: /**
18: * TypeFieldAssistDisposer
19: *
20: */
21: public class TypeFieldAssistDisposer {
22:
23: private ContentAssistCommandAdapter fAdapter;
24:
25: private TypeContentProposalListener fListener;
26:
27: /**
28: *
29: */
30: public TypeFieldAssistDisposer(ContentAssistCommandAdapter adapter,
31: TypeContentProposalListener listener) {
32: fAdapter = adapter;
33: fListener = listener;
34: }
35:
36: /**
37: *
38: */
39: public void dispose() {
40: if (fAdapter == null) {
41: return;
42: }
43: // Dispose of the label provider
44: ILabelProvider labelProvider = fAdapter.getLabelProvider();
45: if ((labelProvider != null)) {
46: fAdapter.setLabelProvider(null);
47: labelProvider.dispose();
48: }
49: // Remove the listeners
50: if (fListener != null) {
51: fAdapter
52: .removeContentProposalListener((IContentProposalListener) fListener);
53: fAdapter
54: .removeContentProposalListener((IContentProposalListener2) fListener);
55: }
56: }
57:
58: }
|