blob: d84b05461ba158c9826888ff29b8e80f2834eb2b (
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
|
/*******************************************************************************
* Copyright (c) 2013 Igor Fedorenko
* 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:
* Igor Fedorenko - initial API and implementation
*******************************************************************************/
package org.eclipse.m2e.core.ui.internal.views.build;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IPath;
abstract class ContainerNode implements Node {
private final String name;
private final Map<IPath, ResourceNode> resources = new HashMap<IPath, ResourceNode>();
protected ContainerNode(String name) {
this.name = name;
}
public String getName() {
return name;
}
public synchronized ResourceNode addResource(IPath path) {
ResourceNode child = resources.get(path);
if(child == null) {
child = new ResourceNode(path);
resources.put(path, child);
}
return child;
}
public synchronized Collection<ResourceNode> getResources() {
return new ArrayList<ResourceNode>(resources.values());
}
}
|