use of org.eclipse.linuxtools.internal.docker.core.ContainerFileProxy in project linuxtools by eclipse.
the class ContainerCopyFrom method addPages.
@Override
public void addPages() {
ProgressMonitorDialog pd = new ProgressMonitorDialog(Activator.getActiveWorkbenchShell());
ContainerFileSystemProvider provider = new ContainerFileSystemProvider(connection, container.id());
PopulateContainerFilesOperation sfo = new PopulateContainerFilesOperation(// $NON-NLS-1$ //$NON-NLS-2$
new ContainerFileProxy("", "", true), null, provider);
try {
pd.run(true, true, sfo);
} catch (InvocationTargetException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
boolean isRunning = EnumDockerStatus.fromStatusMessage(container.status()) == EnumDockerStatus.RUNNING;
// we only want to browse a Container's file system if
// it is running and it has specified to use a tty
boolean usingTTY = false;
if (isRunning) {
IDockerContainerInfo info = connection.getContainerInfo(container.id());
if (info != null) {
usingTTY = info.config().tty();
}
}
mainPage = new ContainerCopyFromPage(sfo.getResult(), provider, container.name(), isRunning && usingTTY);
addPage(mainPage);
}
use of org.eclipse.linuxtools.internal.docker.core.ContainerFileProxy in project linuxtools by eclipse.
the class ContainerCopyTo method addPages.
@Override
public void addPages() {
ProgressMonitorDialog pd = new ProgressMonitorDialog(Activator.getActiveWorkbenchShell());
ContainerFileSystemProvider provider = new ContainerFileSystemProvider(connection, container.id());
PopulateContainerFilesOperation sfo = new PopulateContainerFilesOperation(// $NON-NLS-1$ //$NON-NLS-2$
new ContainerFileProxy("", "", true), null, provider);
try {
pd.run(true, true, sfo);
} catch (InvocationTargetException | InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
boolean isRunning = EnumDockerStatus.fromStatusMessage(container.status()) == EnumDockerStatus.RUNNING;
// we only want to browse a Container's file system if
// it is running and it has specified to use a tty
boolean usingTTY = false;
if (isRunning) {
IDockerContainerInfo info = connection.getContainerInfo(container.id());
if (info != null) {
usingTTY = info.config().tty();
}
}
mainPage = new ContainerCopyToPage(sfo.getResult(), provider, container.name(), isRunning && usingTTY);
addPage(mainPage);
}
use of org.eclipse.linuxtools.internal.docker.core.ContainerFileProxy in project linuxtools by eclipse.
the class ContainerCopyFrom method performFinish.
@Override
public boolean performFinish() {
target = mainPage.getTarget();
@SuppressWarnings("rawtypes") Iterator iterator = mainPage.getValueIterator();
ArrayList<ContainerFileProxy> copyList = new ArrayList<>();
while (iterator.hasNext()) {
MinimizedFileSystemElement e = (MinimizedFileSystemElement) iterator.next();
ContainerFileProxy p = (ContainerFileProxy) e.getFileSystemObject();
copyList.add(p);
}
sources = copyList;
return true;
}
use of org.eclipse.linuxtools.internal.docker.core.ContainerFileProxy in project linuxtools by eclipse.
the class ContainerCopyFromPage method getValueIterator.
/*
* Get an iterator for the selected items to copy
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public Iterator getValueIterator() {
if (canBrowseContainer) {
return selectionGroup.getAllWhiteCheckedItems();
} else {
// We need to fake a collection of MinimizedFileSystemElement with
// one element.
ArrayList out = new ArrayList();
String sourceName = sourceText.getText();
MinimizedFileSystemElement element = new MinimizedFileSystemElement(sourceName, null, false);
element.setFileSystemObject(// $NON-NLS-1$
new ContainerFileProxy(sourceName, "", false));
out.add(element);
return out.iterator();
}
}
use of org.eclipse.linuxtools.internal.docker.core.ContainerFileProxy in project linuxtools by eclipse.
the class ContainerCopyToPage method handleContainerBrowseButtonPressed.
@Override
protected void handleContainerBrowseButtonPressed() {
ContainerDirectorySelectionDialog dialog = new ContainerDirectorySelectionDialog(sourceNameField.getShell(), this.root, this.provider, NLS.bind(CONTAINER_DIRECTORY_MSG, containerName));
if (dialog.open() == IStatus.OK) {
Object[] result = dialog.getResult();
ContainerFileProxy proxy = (ContainerFileProxy) result[0];
// If it is valid then proceed to populate
setErrorMessage(null);
setContainerFieldValue(proxy.getFullPath());
selectionGroup.setFocus();
}
updateWidgetEnablements();
}
Aggregations