diff options
Diffstat (limited to 'containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ImageInfoPropertySection.java')
-rw-r--r-- | containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ImageInfoPropertySection.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ImageInfoPropertySection.java b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ImageInfoPropertySection.java new file mode 100644 index 0000000000..0d7b779ec1 --- /dev/null +++ b/containers/org.eclipse.linuxtools.docker.ui/src/org/eclipse/linuxtools/internal/docker/ui/views/ImageInfoPropertySection.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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.core.runtime.Assert; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeSelection; +import org.eclipse.linuxtools.docker.core.IDockerImage; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; + +/** + * @author jjohnstn + * + */ +public class ImageInfoPropertySection extends BasePropertySection { + + private IDockerImage selectedImage; + + @Override + public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { + super.createControls(parent, aTabbedPropertySheetPage); + getTreeViewer().setContentProvider(new ImageInfoContentProvider()); + } + + @Override + public void setInput(final IWorkbenchPart part, final ISelection selection) { + super.setInput(part, selection); + Object input = null; + if (selection instanceof ITreeSelection) + input = ((ITreeSelection) selection).getFirstElement(); + else if (selection instanceof IStructuredSelection) + input = ((IStructuredSelection) selection).getFirstElement(); + + Assert.isTrue(input instanceof IDockerImage); + this.selectedImage = (IDockerImage) input; + if (getTreeViewer() != null) { + getTreeViewer().setInput(this.selectedImage); + } + } + +} |