コード例 #1
0
ファイル: TeiidView.java プロジェクト: bxvs888/teiid-designer
  private void populateJBossServerCombo() {
    serverMap.clear();

    IServer[] servers = DqpPlugin.getInstance().getServersProvider().getServers();
    for (IServer server : servers) {
      if (TeiidServerAdapterUtil.isJBossServer(server)) {
        serverMap.add(server);
      }
    }

    String[] items = serverMap.keySet().toArray(new String[0]);
    jbossServerCombo.setItems(items);

    if (items.length == 0) {
      newServerOrOpenServerViewHyperlink.setText(NEW_SERVER_LABEL);
    } else {
      newServerOrOpenServerViewHyperlink.setText(EDIT_SERVER_LABEL);
      jbossServerCombo.setText(items[0]);
    }

    // even if nothing in combo, still want the viewer to refresh
    handleServerComboSelection();
  }
コード例 #2
0
ファイル: TeiidView.java プロジェクト: bxvs888/teiid-designer
  /** Take the server combo's selection and apply it to the viewer */
  private void handleServerComboSelection() {
    TeiidEmptyNode emptyNode = new TeiidEmptyNode();
    // populate viewer
    String serverName = jbossServerCombo.getText();
    IServer server = serverMap.get(serverName);
    if (server == null) {
      viewer.setInput(emptyNode);
    } else {
      viewer.setInput(server);
    }

    // Ensures that the action provider is properly initialised in this view
    IStructuredSelection selection = new StructuredSelection(emptyNode);
    getNavigatorActionService().setContext(new ActionContext(selection));
    getNavigatorActionService().fillActionBars(getViewSite().getActionBars());
  }