Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6c37979327e8eb9f4f15d53e406aed5642c67da2 (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
/******************************************************************************
 *  Copyright (c) 2011 GitHub Inc.
 *  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:
 *    Kevin Sawicki (GitHub Inc.) - initial API and implementation
 *****************************************************************************/
package org.eclipse.mylyn.internal.github.ui.pr;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.egit.github.core.RepositoryCommit;
import org.eclipse.mylyn.internal.github.core.pr.PullRequestComposite;
import org.eclipse.ui.model.WorkbenchAdapter;

/**
 * Pull request adapter
 */
public class PullRequestAdapter extends WorkbenchAdapter {

	private final PullRequestCommitAdapter[] commits;

	/**
	 * Create pull request adapter
	 * 
	 * @param request
	 */
	public PullRequestAdapter(PullRequestComposite request) {
		List<PullRequestCommitAdapter> prCommits = new ArrayList<PullRequestCommitAdapter>();
		List<RepositoryCommit> requestCommits = request.getCommits();
		if (requestCommits != null)
			for (RepositoryCommit commit : requestCommits)
				prCommits.add(new PullRequestCommitAdapter(commit));
		commits = prCommits.toArray(new PullRequestCommitAdapter[prCommits
				.size()]);
	}

	@Override
	public Object[] getChildren(Object object) {
		return commits;
	}

}

Back to the top