@Override
  public Object[] getChildren(final Object parentElement) {
    if (parentElement instanceof IDockerConnection) {
      final IDockerConnection dockerConnection = (IDockerConnection) parentElement;
      return new Object[] {
        new DockerImagesCategory(dockerConnection), new DockerContainersCategory(dockerConnection)
      };
    } else if (parentElement instanceof DockerContainersCategory) {
      final DockerContainersCategory containersCategory = (DockerContainersCategory) parentElement;
      final IDockerConnection connection = containersCategory.getConnection();
      if (connection.isContainersLoaded()) {
        return connection.getContainers().toArray();
      }
      loadContainers(containersCategory);
      return new Object[] {new LoadingStub(containersCategory)};
    } else if (parentElement instanceof DockerImagesCategory) {
      final DockerImagesCategory imagesCategory = (DockerImagesCategory) parentElement;
      final IDockerConnection connection = imagesCategory.getConnection();
      if (connection.isImagesLoaded()) {
        return connection.getImages().toArray();
      }
      loadImages(imagesCategory);
      return new Object[] {new LoadingStub(imagesCategory)};
    } else if (parentElement instanceof IDockerContainer) {
      final DockerContainer container = (DockerContainer) parentElement;
      if (container.isInfoLoaded()) {
        final IDockerContainerInfo info = container.info();
        final IDockerNetworkSettings networkSettings = info.networkSettings();
        final IDockerHostConfig hostConfig = info.hostConfig();
        return new Object[] {
          new DockerContainerPortMappingsCategory(container, networkSettings.ports()),
          new DockerContainerVolumesCategory(container, hostConfig.binds()),
          new DockerContainerLinksCategory(container, hostConfig.links())
        };
      }
      loadContainerInfo(container);
      return new Object[] {new LoadingStub(container)};
    } else if (parentElement instanceof DockerContainerLinksCategory) {
      final DockerContainerLinksCategory linksCategory =
          (DockerContainerLinksCategory) parentElement;
      return linksCategory.getLinks().toArray();
    } else if (parentElement instanceof DockerContainerPortMappingsCategory) {
      final DockerContainerPortMappingsCategory portMappingsCategory =
          (DockerContainerPortMappingsCategory) parentElement;
      return portMappingsCategory.getPortMappings().toArray();

    } else if (parentElement instanceof DockerContainerVolumesCategory) {
      final DockerContainerVolumesCategory volumesCategory =
          (DockerContainerVolumesCategory) parentElement;
      return volumesCategory.getVolumes().toArray();
    }
    return EMPTY;
  }
 @Override
 public Object[] getChildren(Object parentElement) {
   final Object propertyValue = ((Object[]) parentElement)[1];
   if (propertyValue instanceof IDockerContainerState) {
     final IDockerContainerState containerState = (IDockerContainerState) propertyValue;
     return new Object[] {
       new Object[] {"ExitCode", containerState.exitCode()}, // $NON-NLS-1$
       new Object[] {
         "Finished at", LabelUtils.toFinishedDate(containerState.finishDate())
       }, //$NON-NLS-1$
       new Object[] {"Running", containerState.running()}, // $NON-NLS-1$
       new Object[] {"Paused", containerState.paused()}, // $NON-NLS-1$
       new Object[] {"Pid", containerState.pid()}, // $NON-NLS-1$
     };
   } else if (propertyValue instanceof IDockerHostConfig) {
     final IDockerHostConfig hostConfig = (IDockerHostConfig) propertyValue;
     return new Object[] {
       new Object[] {"Binds", LabelUtils.reduce(hostConfig.binds())}, // $NON-NLS-1$
       new Object[] {"ContainerIDFile", hostConfig.containerIDFile()}, // $NON-NLS-1$
       new Object[] {"Dns", LabelUtils.reduce(hostConfig.dns())}, // $NON-NLS-1$
       new Object[] {"DnsSearch", LabelUtils.reduce(hostConfig.dnsSearch())}, // $NON-NLS-1$
       new Object[] {"Links", splitLinks(hostConfig.links())}, // $NON-NLS-1$
       new Object[] {"LxcConf", hostConfig.lxcConf()}, // $NON-NLS-1$
       new Object[] {"NetworkMode", hostConfig.networkMode()}, // $NON-NLS-1$
       new Object[] {"PortBindings", LabelUtils.reduce(hostConfig.portBindings())}, // $NON-NLS-1$
       new Object[] {"Privileged", hostConfig.privileged()}, // $NON-NLS-1$
       new Object[] {"PublishAllPorts", hostConfig.publishAllPorts()}, // $NON-NLS-1$
       new Object[] {"VolumesFrom", LabelUtils.reduce(hostConfig.volumesFrom())}, // $NON-NLS-1$
     };
   } else if (propertyValue instanceof IDockerContainerConfig) {
     final IDockerContainerConfig config = (IDockerContainerConfig) propertyValue;
     return new Object[] {
       new Object[] {"AttachStderr", config.attachStderr()}, // $NON-NLS-1$
       new Object[] {"AttachStdin", config.attachStdin()}, // $NON-NLS-1$
       new Object[] {"AttachStdout", config.attachStdout()}, // $NON-NLS-1$
       new Object[] {"Cmd", LabelUtils.reduce(config.cmd())}, // $NON-NLS-1$
       new Object[] {"CpuSet", config.cpuset()}, // $NON-NLS-1$
       new Object[] {"CpuShares", config.cpuShares()}, // $NON-NLS-1$
       new Object[] {"Domainname", config.domainname()}, // $NON-NLS-1$
       new Object[] {"Entrypoint", LabelUtils.reduce(config.entrypoint())}, // $NON-NLS-1$
       new Object[] {"Env", LabelUtils.reduce(config.env())}, // $NON-NLS-1$
       new Object[] {"ExposedPorts", LabelUtils.reduce(config.exposedPorts())}, // $NON-NLS-1$
       new Object[] {"Hostname", config.hostname()}, // $NON-NLS-1$
       new Object[] {"Image", config.image()}, // $NON-NLS-1$
       new Object[] {"Memory", config.memory()}, // $NON-NLS-1$
       new Object[] {"MemorySwap", config.memorySwap()}, // $NON-NLS-1$
       new Object[] {"NetworkDisabled", config.networkDisabled()}, // $NON-NLS-1$
       new Object[] {"OnBuild", config.onBuild()}, // $NON-NLS-1$
       new Object[] {"OpenStdin", config.openStdin()}, // $NON-NLS-1$
       new Object[] {"PortSpecs", LabelUtils.reduce(config.portSpecs())}, // $NON-NLS-1$
       new Object[] {"StdinOnce", config.stdinOnce()}, // $NON-NLS-1$
       new Object[] {"Tty", config.tty()}, // $NON-NLS-1$
       new Object[] {"Volumes", config.volumes()}, // $NON-NLS-1$
       new Object[] {"WorkingDir", config.workingDir()}, // $NON-NLS-1$
     };
   } else if (propertyValue instanceof IDockerPortBinding) {
     final IDockerPortBinding portBinding = (IDockerPortBinding) propertyValue;
     return new Object[] {
       new Object[] {"Host IP/Port", LabelUtils.toString(portBinding)} // $NON-NLS-1$
     };
   } else if (propertyValue instanceof IDockerNetworkSettings) {
     final IDockerNetworkSettings networkSettings = (IDockerNetworkSettings) propertyValue;
     return new Object[] {
       new Object[] {"Bridge", networkSettings.bridge()}, // $NON-NLS-1$
       new Object[] {"Gateway", networkSettings.gateway()}, // $NON-NLS-1$
       new Object[] {"IPAddress", networkSettings.ipAddress()}, // $NON-NLS-1$
       new Object[] {"IPPrefixLen", networkSettings.ipPrefixLen()}, // $NON-NLS-1$
       new Object[] {"PortMapping", networkSettings.portMapping()}, // $NON-NLS-1$
       new Object[] {"Ports", LabelUtils.reduce(networkSettings.ports())}, // $NON-NLS-1$
     };
   } else if (propertyValue instanceof List<?>) {
     @SuppressWarnings("unchecked")
     final List<Object> propertyValues = (List<Object>) propertyValue;
     final Object[] result = new Object[propertyValues.size()];
     for (int i = 0; i < propertyValues.size(); i++) {
       result[i] = new Object[] {"", LabelUtils.toString(propertyValues.get(i))}; // $NON-NLS-1$
     }
     return result;
   } else if (propertyValue instanceof Map<?, ?>) {
     final Map<?, ?> propertyValues = (Map<?, ?>) propertyValue;
     final Object[] result = new Object[propertyValues.size()];
     int i = 0;
     for (Entry<?, ?> entry : propertyValues.entrySet()) {
       result[i] = new Object[] {entry.getKey(), entry.getValue()};
       i++;
     }
     return result;
   }
   return EMPTY;
 }