Search in sources :

Example 1 with TableCellMouseAdapter

use of org.jboss.tools.openshift.internal.common.ui.TableCellMouseAdapter in project jbosstools-openshift by jbosstools.

the class ServicesAndRoutingPage method onTableCellClicked.

private MouseListener onTableCellClicked() {
    return new TableCellMouseAdapter(ROUTE_PORT_COLUMN_INDEX) {

        @Override
        public void mouseUpCell(MouseEvent event) {
            IServicePort port = model.getSelectedServicePort();
            ServicePortAdapter target = new ServicePortAdapter((ServicePortAdapter) port);
            target.setRoutePort(!target.isRoutePort());
            target.setName(NLS.bind("{0}-tcp", target.getPort()));
            model.updateServicePort(port, target);
            model.setSelectedServicePort(target);
            Display.getDefault().asyncExec(() -> {
                if (portsViewer != null && portsViewer.getTable() != null && !portsViewer.getTable().isDisposed()) {
                    portsViewer.refresh();
                }
            });
        }
    };
}
Also used : IServicePort(com.openshift.restclient.model.IServicePort) MouseEvent(org.eclipse.swt.events.MouseEvent) TableCellMouseAdapter(org.jboss.tools.openshift.internal.common.ui.TableCellMouseAdapter)

Aggregations

IServicePort (com.openshift.restclient.model.IServicePort)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 TableCellMouseAdapter (org.jboss.tools.openshift.internal.common.ui.TableCellMouseAdapter)1