Search in sources :

Example 1 with ContainerPortDialog

use of org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerPortDialog in project linuxtools by eclipse.

the class RunImagePortsTab method onAddPort.

private SelectionListener onAddPort(final CheckboxTableViewer exposedPortsTableViewer) {
    return SelectionListener.widgetSelectedAdapter(e -> {
        final ContainerPortDialog dialog = new ContainerPortDialog(getShell());
        dialog.create();
        if (dialog.open() == IDialogConstants.OK_ID) {
            final ExposedPortModel port = dialog.getPort();
            model.addAvailablePort(port);
            model.getSelectedPorts().add(port);
            port.setSelected(true);
            exposedPortsTableViewer.setChecked(port, true);
            updateLaunchConfigurationDialog();
        }
    });
}
Also used : ContainerPortDialog(org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerPortDialog) ExposedPortModel(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRunSelectionModel.ExposedPortModel)

Example 2 with ContainerPortDialog

use of org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerPortDialog in project linuxtools by eclipse.

the class RunImagePortsTab method onEditPort.

private SelectionListener onEditPort(final CheckboxTableViewer exposedPortsTableViewer) {
    return SelectionListener.widgetSelectedAdapter(e -> {
        final IStructuredSelection selection = exposedPortsTableViewer.getStructuredSelection();
        final ExposedPortModel selectedContainerPort = (ExposedPortModel) selection.getFirstElement();
        final ContainerPortDialog dialog = new ContainerPortDialog(getShell(), selectedContainerPort);
        dialog.create();
        if (dialog.open() == IDialogConstants.OK_ID) {
            final ExposedPortModel configuredPort = dialog.getPort();
            selectedContainerPort.setContainerPort(configuredPort.getContainerPort());
            selectedContainerPort.setHostAddress(configuredPort.getHostAddress());
            selectedContainerPort.setHostPort(configuredPort.getHostPort());
        }
        updateLaunchConfigurationDialog();
    });
}
Also used : ExposedPortModel(org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRunSelectionModel.ExposedPortModel) ContainerPortDialog(org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerPortDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

ContainerPortDialog (org.eclipse.linuxtools.internal.docker.ui.wizards.ContainerPortDialog)2 ExposedPortModel (org.eclipse.linuxtools.internal.docker.ui.wizards.ImageRunSelectionModel.ExposedPortModel)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1