/** * @param name java.lang.String * @param port int */ protected void changePortNumber(String name, int port) { TableItem[] items = ports.getItems(); int size = items.length; for (int i = 0; i < size; i++) { ServerPort sp = (ServerPort) items[i].getData(); if (sp.getName().equals(name)) { items[i].setData(new ServerPort(sp.getId(), sp.getName(), port, sp.getProtocol())); items[i].setText(1, port + ""); CarbonServer42Utils.setServerConfigMapValue(server.getOriginal(), sp.getId(), port + ""); CarbonServer42Utils.updateTransportPorts(server.getOriginal()); CarbonServer42Utils.updateAxis2XML(server.getOriginal()); /*if (i == selection) { selectPort(); }*/ return; } } }
/** Initialize the fields in this editor. */ protected void initialize() { if (ports == null) return; ports.removeAll(); CarbonServer42Utils.isServerStartBrowserPopup(server.getOriginal()); ServerPort[] serverPorts = ServerController.getInstance().getServerManager().getServerPorts(server.getOriginal()); for (ServerPort serverPort : serverPorts) { ServerPort port = serverPort; TableItem item = new TableItem(ports, SWT.NONE); String portStr = "-"; if (port.getPort() >= 0) { portStr = port.getPort() + ""; } String[] s = new String[] {port.getName(), portStr}; item.setText(s); // item.setImage(TomcatUIPlugin.getImage(TomcatUIPlugin.IMG_PORT)); int i = CarbonServerConstants.portCaptions.indexOf(port.getName()); if (i != -1) { port = new ServerPort( CarbonServerConstants.portIds.get(i), port.getName(), port.getPort(), port.getProtocol()); } item.setData(port); } if (readOnly) { viewer.setCellEditors(new CellEditor[] {null, null}); viewer.setCellModifier(null); } else { setupPortEditors(); } }