コード例 #1
0
 /** @return */
 String getDialogTitle() {
   String title = DB_Results.getDbTitle();
   if (title == null) {
     // DB is not connected
     int version;
     if (this.mVersionRadioButton.getSelection()) {
       version = ECLIPSE_MAINTENANCE_VERSION;
     } else {
       version = ECLIPSE_DEVELOPMENT_VERSION;
     }
     title = "Eclipse " + version + " - DB not connected";
   }
   return title;
 }
コード例 #2
0
  /** Stores the values of the controls back to the preference store. */
  private void storeValues() {
    IPreferenceStore store = getPreferenceStore();

    // Set version
    int version;
    if (this.mVersionRadioButton.getSelection()) {
      version = ECLIPSE_MAINTENANCE_VERSION;
    } else {
      version = ECLIPSE_DEVELOPMENT_VERSION;
    }
    store.setValue(PRE_ECLIPSE_VERSION, version);

    // Set database values
    store.setValue(PRE_DATABASE_CONNECTION, this.dbConnectionCheckBox.getSelection());
    final boolean dbLocal = this.dbLocalRadioButton.getSelection();
    store.setValue(PRE_DATABASE_LOCAL, dbLocal);
    String location = this.databaseLocationCombo.getText();
    if (dbLocal) {
      store.setValue(PRE_DATABASE_LOCATION, location);
    } else {
      store.setValue(PRE_DATABASE_LOCATION, NETWORK_DATABASE_LOCATION);
    }
    int count = this.databaseLocationCombo.getItemCount();
    for (int i = 0; i < count; i++) {
      String item = this.databaseLocationCombo.getItem(i);
      if (item.equals(location)) {
        this.databaseLocationCombo.remove(i);
        break;
      }
    }
    if (dbLocal) {
      this.databaseLocationCombo.add(location, 0);
    }
    int i = 0;
    for (; i < count; i++) {
      String item = this.databaseLocationCombo.getItem(i);
      if (item.length() == 0) break;
      store.setValue(PRE_DATABASE_LOCATION + "." + i, item);
    }
    while (store.getString(PRE_DATABASE_LOCATION + "." + i).length() > 0) {
      store.setToDefault(PRE_DATABASE_LOCATION + "." + i);
      i++;
    }

    // Set milestones
    count = this.milestonesCombo.getItemCount();
    for (i = 0; i < count; i++) {
      store.putValue(PRE_MILESTONE_BUILDS + version + i, this.milestonesCombo.getItem(i));
    }
    Util.setMilestones(this.milestonesCombo.getItems());

    // Set default dimension
    String defaultDimension = this.defaultDimensionCombo.getText();
    store.putValue(PRE_DEFAULT_DIMENSION, defaultDimension);
    DB_Results.setDefaultDimension(defaultDimension);

    // Set generated dimensions
    int[] indices = this.resultsDimensionsList.getSelectionIndices();
    int length = indices.length;
    String[] dimensions = new String[length];
    if (length > 0) {
      for (i = 0; i < indices.length; i++) {
        dimensions[i] = this.resultsDimensionsList.getItem(indices[i]);
        store.putValue(PRE_RESULTS_DIMENSION + "." + i, dimensions[i]);
      }
    }
    int currentLength = DB_Results.getResultsDimensions().length;
    if (currentLength > length) {
      for (i = currentLength - 1; i >= length; i--) {
        store.putValue(PRE_RESULTS_DIMENSION + "." + i, ""); // reset extra dimensions
      }
    }
    DB_Results.setResultsDimensions(dimensions);

    // Set config descriptors
    /* TODO See whether config descriptors need to be set as preferences or not...
    TableItem[] items = this.configDescriptorsTable.getItems();
    length = items.length;
    for (int i = 0; i < length; i++) {
    	TableItem item = items[i];
    	store.putValue(PRE_CONFIG_DESCRIPTOR_NAME + "." + i, item.getText(0));
    	store.putValue(PRE_CONFIG_DESCRIPTOR_DESCRIPTION + "." + i, item.getText(1));
    }
    */
  }