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
|
/*******************************************************************************
* Copyright (c) 2014, 2015 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.ui.views;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.linuxtools.docker.core.IDockerConnectionInfo;
/**
* @author xcoulon
*
*/
public class ConnectionInfoContentProvider implements ITreeContentProvider {
private static final Object[] EMPTY = new Object[0];
@Override
public void dispose() {
}
@Override
public void inputChanged(final Viewer viewer, final Object oldInput, final Object newInput) {
}
@Override
public Object[] getElements(final Object inputElement) {
if(inputElement instanceof IDockerConnectionInfo) {
final IDockerConnectionInfo connectionInfo = (IDockerConnectionInfo) inputElement;
return new Object[] {
new Object[]{"Containers", connectionInfo.getContainers()}, //$NON-NLS-1$
new Object[]{"Images", connectionInfo.getImages()}, //$NON-NLS-1$
new Object[]{"Storage driver", connectionInfo.getStorageDriver()}, //$NON-NLS-1$
new Object[]{"Execution driver", connectionInfo.getExecutionDriver()}, //$NON-NLS-1$
new Object[]{"Kernel version", connectionInfo.getKernelVersion()}, //$NON-NLS-1$
new Object[]{"Operating system", connectionInfo.getOs()}, //$NON-NLS-1$
new Object[]{"File descriptors", connectionInfo.getFileDescriptors()}, //$NON-NLS-1$
new Object[]{"Go routines", connectionInfo.getGoroutines()}, //$NON-NLS-1$
new Object[]{"Init path", connectionInfo.getInitPath()}, //$NON-NLS-1$
new Object[]{"API version", connectionInfo.getApiVersion()}, //$NON-NLS-1$
new Object[]{"Version", connectionInfo.getVersion()}, //$NON-NLS-1$
new Object[]{"Git commit", connectionInfo.getGitCommit()}, //$NON-NLS-1$
};
}
return EMPTY;
}
@Override
public Object[] getChildren(final Object parentElement) {
return EMPTY;
}
@Override
public Object getParent(final Object element) {
return null;
}
@Override
public boolean hasChildren(final Object element) {
return false;
}
}
|