use of org.eclipse.ui.IWorkbenchPart in project linuxtools by eclipse.
the class FilterContainersWithLabelsCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final boolean checked = !HandlerUtil.toggleCommandState(event.getCommand());
if (activePart instanceof DockerContainersView) {
final DockerContainersView containersView = (DockerContainersView) activePart;
containersView.showContainersWithLabels(checked);
}
return null;
}
use of org.eclipse.ui.IWorkbenchPart in project linuxtools by eclipse.
the class OpenInHierarchyViewCommandHandler method execute.
@Override
public Object execute(ExecutionEvent event) {
// retrieve the selected image
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerConnection2 currentConnection = (IDockerConnection2) CommandUtils.getCurrentConnection(activePart);
// run a job to retrieve the image hierarchy
final RetrieveImageHierarchyJob retrieveImageHierarchyJob = new RetrieveImageHierarchyJob(currentConnection, CommandUtils.getSelectedElement(activePart));
retrieveImageHierarchyJob.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
// input
if (retrieveImageHierarchyJob.getImageHierarchy() == null) {
Activator.logWarningMessage(CommandMessages.getString(// $NON-NLS-1$
"command.showIn.imageHierarchyView.failure.missingHierarchy"));
}
Display.getDefault().asyncExec(() -> {
try {
final DockerImageHierarchyView dockerImageHierarchyView = (DockerImageHierarchyView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(DockerImageHierarchyView.VIEW_ID, null, IWorkbenchPage.VIEW_VISIBLE);
dockerImageHierarchyView.setConnection((IDockerConnection) currentConnection);
dockerImageHierarchyView.show(retrieveImageHierarchyJob.getImageHierarchy());
} catch (PartInitException e) {
Activator.logErrorMessage(CommandMessages.getString(// $NON-NLS-1$
"command.showIn.imageHierarchyView.failure"), e);
}
});
}
});
retrieveImageHierarchyJob.schedule();
//
return null;
}
use of org.eclipse.ui.IWorkbenchPart in project linuxtools by eclipse.
the class PullImageCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
if (connection == null) {
MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), CommandMessages.getString(MISSING_CONNECTION), CommandMessages.getString(ERROR_PULLING_IMAGE_NO_CONNECTION));
} else {
final ImagePull wizard = new ImagePull(connection);
final boolean pullImage = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (pullImage) {
performPullImage(connection, wizard.getSelectedImageName(), // part of the IRegistry interface
(AbstractRegistry) wizard.getSelectedRegistryAccount());
}
}
return null;
}
use of org.eclipse.ui.IWorkbenchPart in project linuxtools by eclipse.
the class PushImageCommandHandler method execute.
@Override
public Object execute(final ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final IDockerImage selectedImage = CommandUtils.getSelectedImage(activePart);
final ImagePush wizard = new ImagePush(selectedImage, selectedImage.repo() + ":" + selectedImage.tags().get(0));
final boolean pushImage = CommandUtils.openWizard(wizard, HandlerUtil.getActiveShell(event));
if (pushImage) {
final IDockerConnection connection = CommandUtils.getCurrentConnection(activePart);
performPushImage(wizard, connection);
}
return null;
}
use of org.eclipse.ui.IWorkbenchPart in project linuxtools by eclipse.
the class RefreshCommandHandler method execute.
@Override
public Object execute(ExecutionEvent event) {
final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
final List<Job> jobs = getRefreshJobs(activePart);
for (Job job : jobs) {
job.setPriority(Job.LONG);
job.setUser(true);
job.schedule();
}
return null;
}
Aggregations