01: /*******************************************************************************
02: * Copyright (c) 2000, 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.ui.texteditor.templates;
11:
12: import org.eclipse.jface.viewers.IStructuredContentProvider;
13: import org.eclipse.jface.viewers.Viewer;
14:
15: import org.eclipse.jface.text.templates.persistence.TemplateStore;
16:
17: /**
18: * A content provider for the template preference page's table viewer.
19: *
20: * @since 3.0
21: */
22: class TemplateContentProvider implements IStructuredContentProvider {
23:
24: /** The template store. */
25: private TemplateStore fStore;
26:
27: /*
28: * @see IStructuredContentProvider#getElements(Object)
29: */
30: public Object[] getElements(Object input) {
31: return fStore.getTemplateData(false);
32: }
33:
34: /*
35: * @see IContentProvider#inputChanged(Viewer, Object, Object)
36: */
37: public void inputChanged(Viewer viewer, Object oldInput,
38: Object newInput) {
39: fStore = (TemplateStore) newInput;
40: }
41:
42: /*
43: * @see IContentProvider#dispose()
44: */
45: public void dispose() {
46: fStore = null;
47: }
48:
49: }
|