コード例 #1
0
  @Override
  public boolean performOk() {
    DataSourceProviderRegistry registry = DataSourceProviderRegistry.getInstance();
    java.util.List<DBPConnectionType> toRemove = new ArrayList<>();
    for (DBPConnectionType type : registry.getConnectionTypes()) {
      if (!changedInfo.values().contains(type)) {
        // Remove
        toRemove.add(type);
      }
    }
    for (DBPConnectionType connectionType : toRemove) {
      registry.removeConnectionType(connectionType);
    }

    for (DBPConnectionType changed : changedInfo.keySet()) {
      DBPConnectionType source = changedInfo.get(changed);
      if (source == changed) {
        // New type
        registry.addConnectionType(changed);
      } else {
        // Changed type
        source.setName(changed.getName());
        source.setDescription(changed.getDescription());
        source.setAutocommit(changed.isAutocommit());
        source.setConfirmExecute(changed.isConfirmExecute());
        source.setColor(changed.getColor());
      }
    }
    registry.saveConnectionTypes();
    return super.performOk();
  }
コード例 #2
0
  private void showSelectedType(DBPConnectionType connectionType) {
    colorPicker.select(UIUtils.getConnectionTypeColor(connectionType));
    typeName.setText(connectionType.getName());
    typeDescription.setText(connectionType.getDescription());
    autocommitCheck.setSelection(connectionType.isAutocommit());
    confirmCheck.setSelection(connectionType.isConfirmExecute());

    deleteButton.setEnabled(!connectionType.isPredefined());
  }