Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 1793b093eae6b754392fbaa62a669d1c764368c2 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*******************************************************************************
 * Copyright (c) 2011 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 * IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ui.history;

import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.team.ui.history.IHistoryPageSource;
import org.eclipse.ui.*;

/**
 * Fake part to use in page book for the History view
 */
public class HistoryPageSourceWorkbenchPart implements IWorkbenchPart {
	private Object object;
	private IHistoryPageSource source;
	private IWorkbenchPartSite site;

	@Override
	public boolean equals(Object obj) {
		return (obj instanceof HistoryPageSourceWorkbenchPart) &&
		    source.equals(((HistoryPageSourceWorkbenchPart)obj).getSource());
	}

	@Override
	public int hashCode() {
		return source.hashCode();
	}

	/**
	 * Constructs a part that binds the object and its history page source to the given site.
	 *
	 * @param object
	 *            the object the input whose history is to be displayed
	 * @param source
	 *            the history page source
	 * @param site
	 *            the part site
	 */
	public HistoryPageSourceWorkbenchPart(Object object, IHistoryPageSource source, IWorkbenchPartSite site) {
		this.object= object;
		this.source = source;
		this.site = site;
	}

	@Override
	public void addPropertyListener(IPropertyListener listener) {
	}

	@Override
	public void createPartControl(Composite parent) {
	}

	@Override
	public void dispose() {
	}

	@Override
	public IWorkbenchPartSite getSite() {
		return site;
	}

	@Override
	public String getTitle() {
		return ""; //$NON-NLS-1$
	}

	@Override
	public Image getTitleImage() {
		return null;
	}

	@Override
	public String getTitleToolTip() {
		return ""; //$NON-NLS-1$
	}

	@Override
	public void removePropertyListener(IPropertyListener listener) {
	}

	@Override
	public void setFocus() {
	}

	@Override
	public <T> T getAdapter(Class<T> adapter) {
		return null;
	}

	public IHistoryPageSource getSource() {
		return source;
	}

	public Object getObject() {
		return object;
	}
}

Back to the top