1 /*******************************************************************************
2  * Copyright (c) 2006 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.team.internal.ui.history;
15 
16 import org.eclipse.swt.graphics.Image;
17 import org.eclipse.team.core.history.IFileRevision;
18 
19 
20 public abstract class AbstractHistoryCategory {
21 
22 	/**
23 	 * Returns the name of this category.
24 	 * @return a string
25 	 */
getName()26 	abstract public String getName();
27 
28 	/**
29 	 * Returns the image that will be displayed next to the category name or <code>null</code>
30 	 * if no image is required.
31 	 * @return an image or <code>null</code>
32 	 */
getImage()33 	public Image getImage() {
34 		return null;
35 	}
36 
37 	/**
38 	 * Returns whether this category currently has any revisions associated with it.
39 	 * @return <code>true</code> if there are any revisions, <code>false</code> otherwise.
40 	 */
hasRevisions()41 	abstract public boolean hasRevisions();
42 
43 	/**
44 	 * Takes in an array of IFileRevision and collects the revisions that belong to this category.
45 	 * The shouldRemove flag indicates whether match file revisions need to be removed from the
46 	 * passed in file revision array (in order to increase efficency).
47 	 * @param fileRevisions	an array of IFileRevisions
48 	 * @param shouldRemove	<code>true</code> if the method should remove the matching revisions from fileRevisions, <code>false</code> otherwise
49 	 * @return	<code>true</code> if any revisions match this category, <code>false</code> otherwise
50 	 */
collectFileRevisions(IFileRevision[] fileRevisions, boolean shouldRemove)51 	abstract public boolean collectFileRevisions(IFileRevision[] fileRevisions, boolean shouldRemove);
52 
53 	/**
54 	 * Returns the file revisions that are currently associated with this category or <code>null</code> if
55 	 * there are no file revisions associated with this category.
56 	 * @return an array of IFileRevision or <code>null</code>
57 	 */
getRevisions()58 	abstract public IFileRevision[] getRevisions();
59 }
60