Skip to main content
summaryrefslogtreecommitdiffstats
blob: ab4e3e802a499cddaeb723fa476374de7b0c86df (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
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.team.internal.ui.sync.views;

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

import org.eclipse.core.resources.IResource;
import org.eclipse.team.core.subscribers.SyncInfo;
import org.eclipse.team.internal.ui.sync.sets.SubscriberInput;

/**
 * A compressed folder appears under a project and contains out-of-sync resources
 */
public class CompressedFolder extends SynchronizeViewNode {

	public CompressedFolder( SubscriberInput input, IResource resource) {
		super(input, resource);
	}
	
	/* (non-Javadoc)
	 * @see org.eclipse.team.internal.ui.sync.views.SynchronizeViewNode#getOutOfSyncDescendants()
	 */
	public SyncInfo[] getChildSyncInfos() {
		IResource[] children = getSyncSet().members(getResource());
		List result = new ArrayList();
		for (int i = 0; i < children.length; i++) {
			IResource child = children[i];
			SyncInfo info = getSyncSet().getSyncInfo(child);
			if (info != null) {
				if (child.getType() == IResource.FOLDER) {
					// for folders, add all out-of-sync children
					// NOTE: the method getOutOfSyncDescendants includes the out-of-sync parent
					result.addAll(Arrays.asList(getSyncSet().getOutOfSyncDescendants(child)));
				} else {
					// for files, just add the info
					result.add(info);
				}
			}
		}
		return (SyncInfo[]) result.toArray(new SyncInfo[result.size()]);
	}
}

Back to the top