blob: 3002535d164edfe61236dca8d01ec5d49807ccb7 (
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
|
/*******************************************************************************
* Copyright (c) 2016 Red Hat.
* 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:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.linuxtools.internal.docker.core;
public class ContainerFileProxy {
private final String path;
private final String name;
private final String link;
private final boolean isFolder;
private final boolean isLink;
public ContainerFileProxy(String directory, String name,
boolean isFolder) {
this.path = directory + (directory.equals("/") ? "" : "/") + name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.name = name;
this.isFolder = isFolder;
this.isLink = false;
this.link = this.path;
}
public ContainerFileProxy(String directory, String name, boolean isFolder,
boolean isLink, String link) {
this.path = directory + (directory.equals("/") ? "" : "/") + name; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
this.name = name;
this.isFolder = isFolder;
this.isLink = isLink;
this.link = (link == null ? this.path : link);
}
public String getFullPath() {
return path;
}
public String getLabel() {
if (name.isEmpty())
return "/"; //$NON-NLS-1$
return name;
}
public boolean isFolder() {
return isFolder;
}
public boolean isLink() {
return isLink;
}
public String getLink() {
return link;
}
public String getName() {
return name;
}
@Override
public String toString() {
return getFullPath();
}
}
|