Package org.eclipse.wst.server.core

Examples of org.eclipse.wst.server.core.ServerPort


   *
   * @see org.eclipse.wst.server.core.model.ServerDelegate#getServerPorts()
   */
  public ServerPort[] getServerPorts() {
    List<ServerPort> ports = new ArrayList<ServerPort>();
    ports.add(new ServerPort(PROPERTY_HTTP_PORT, "Web Connector", Integer.parseInt(getHTTPPort()), "http"));
    ports.add(new ServerPort(PROPERTY_RMI_PORT, "RMI Naming", Integer.parseInt(getRMINamingPort()), "rmi"));
    return (ServerPort[]) ports.toArray(new ServerPort[ports.size()]);
  }
View Full Code Here


    viewer.setCellEditors(new CellEditor[] { null,
        new TextCellEditor(ports) });

    ICellModifier cellModifier = new ICellModifier() {
      public Object getValue(Object element, String property) {
        ServerPort sp = (ServerPort) element;
        return sp.getPort() + "";
      }

      public boolean canModify(Object element, String property) {
        return "port".equals(property);
      }

      public void modify(Object element, String property, Object value) {
        Item item = (Item) element;
        ServerPort sp = (ServerPort) item.getData();
        GeronimoServerDelegate gs = getGeronimoServer();
        gs.setInstanceProperty(sp.getId(), (String) value);
        changePortNumber(sp.getId(), Integer.parseInt((String) value));
      }
    };

    viewer.setCellModifier(cellModifier);
  }
View Full Code Here

  private void fillTable(Table ports) {
    ServerPort[] serverPorts = getServer().getServerPorts(null);
    if (serverPorts != null) {
      for (int i = 0; i < serverPorts.length; i++) {
        ServerPort port = serverPorts[i];
        TableItem item = new TableItem(ports, SWT.NONE);
        String[] s = new String[] { port.getName(),
            Integer.toString(port.getPort()) };
        item.setText(s);
        item.setImage(Activator.getImage(Activator.IMG_PORT));
        item.setData(port);
      }
    }
View Full Code Here

  protected void changePortNumber(String id, 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.getId().equals(id)) {
        items[i].setData(new ServerPort(id, sp.getName(), port, sp.getProtocol()));
        items[i].setText(1, port + "");
        return;
      }
    }
  }
View Full Code Here

    if (!SocketUtil.isLocalhost(getServer().getHost()))
      return;

    ServerPort[] ports = getServer().getServerPorts(null);
    for (int i = 0; i < ports.length; i++) {
      ServerPort sp = ports[i];
      if (SocketUtil.isPortInUse(ports[i].getPort(), 5))
        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, 0, Messages.bind(Messages.errorPortInUse, Integer.toString(sp.getPort()), sp.getName()), null));
    }

    stopUpdateServerStateTask();
    setServerState(IServer.STATE_STARTING);
    setMode(launchMode);
View Full Code Here

TOP

Related Classes of org.eclipse.wst.server.core.ServerPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.