Skip to main content
summaryrefslogtreecommitdiffstats
blob: 98cb03481522810f5a88bf578806e7aa4a966a36 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*******************************************************************************
 * Copyright (c) 2004, 2008 Tasktop Technologies and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Tasktop Technologies - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.internal.tasks.ui.search;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

/**
 * @author Rob Elves (moved into task.ui)
 * @see org.eclipse.jface.viewers.IContentProvider
 */
public abstract class SearchResultContentProvider implements ITreeContentProvider {

	/** An empty array of objects */
	protected final Object[] EMPTY_ARR = new Object[0];

	/** The search result for this content provider */
	protected RepositorySearchResult searchResult;

	public void dispose() {
		// nothing to do
	}

	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		if (newInput instanceof RepositorySearchResult) {
			initialize((RepositorySearchResult) newInput);
		}
	}

	/**
	 * Initializes the content provider with the given search result.
	 * 
	 * @param result
	 *            The search result to use with this content provider
	 */
	protected void initialize(RepositorySearchResult result) {
		searchResult = result;
	}

	/**
	 * This method is called whenever the set of matches for the given elements changes.
	 * 
	 * @param updatedElements
	 *            The array of objects that has to be refreshed
	 * @see
	 * @see org.eclipse.search.ui.text.AbstractTextSearchViewPage#elementsChanged(java.lang.Object[])
	 */
	public abstract void elementsChanged(Object[] updatedElements);

	/**
	 * Clears the viewer.
	 */
	public abstract void clear();
}

Back to the top