Exemplo n.º 1
0
  /** After clicking execute button, all data in dialog is saved to GoIOptionsPack */
  public void storeValuesToOptionsPack(QueryOptionsPack opt) {
    // store Length Limit
    opt.setLengthLimit(Integer.parseInt(lengthLimit.getText()));

    // if currentView is selected
    if (currentViewButton.getSelection()) {
      opt.setCurrentView(true);
    }
    // if newView is selected
    else {
      opt.setCurrentView(false);
    }

    if (downstreamButton != null) {
      // if downstream is selected
      if (downstreamButton.getSelection()) {
        opt.setDownstream(true);
        opt.setUpstream(false);
      }
      // if upstream is selected
      else if (upstreamButton.getSelection()) {
        opt.setDownstream(false);
        opt.setUpstream(true);
      }
      // if both is selected
      else {
        opt.setDownstream(true);
        opt.setUpstream(true);
      }
    }

    // store stop distance according to user's selection
    if (shortestPlusKButton != null) {
      opt.setLimitType(!shortestPlusKButton.getSelection());
      opt.setShortestPlusKLimit(Integer.parseInt(shortestPlusK.getText()));
    }

    // if strict is selected.
    if (strictButton != null && strictButton.getSelection()) {
      opt.setStrict(true);
    } else {
      opt.setStrict(false);
    }

    if (sourceST != null) opt.setSourceList(sourceST.getSymbols());
    if (targetST != null) opt.setTargetList(targetST.getSymbols());

    if (forSIF) {
      opt.setSifTypes(selectedTypes);
    }
  }
 @Override
 public boolean isComplete() {
   if (isCustom) {
     return !CommonUtils.isEmpty(urlText.getText());
   } else {
     if (metaURL == null) {
       return false;
     }
     for (String prop : metaURL.getRequiredProperties()) {
       if ((prop.equals(DriverDescriptor.PROP_HOST) && CommonUtils.isEmpty(hostText.getText()))
           || (prop.equals(DriverDescriptor.PROP_PORT) && CommonUtils.isEmpty(portText.getText()))
           || (prop.equals(DriverDescriptor.PROP_DATABASE)
               && CommonUtils.isEmpty(dbText.getText()))) {
         return false;
       }
     }
     return true;
   }
 }
 private void handleFilter() {
   boolean changed = false;
   String newFilter;
   if (fFilterText == null || (newFilter = fFilterText.getText().trim()).length() == 0)
     newFilter = "*"; // $NON-NLS-1$
   changed = fAvailableFilter.setPattern(newFilter);
   if (changed) {
     fAvailableListViewer.refresh();
     updateButtonEnablement(false, false);
   }
 }
 private void updateCreateButton(DBPDriver driver) {
   if (driver == null) {
     createButton.setEnabled(false);
     return;
   }
   // Enable ""Create" button
   String paramCreate =
       CommonUtils.toString(driver.getDriverParameter(GenericConstants.PARAM_CREATE_URL_PARAM));
   createButton.setEnabled(
       !CommonUtils.isEmpty(paramCreate) && !CommonUtils.isEmpty(pathText.getText()));
 }
Exemplo n.º 5
0
    public java.util.List<String> getSymbols() {
      java.util.List<String> list = new ArrayList<String>();
      String text = symbolText.getText();
      for (String s : text.replaceAll(",", " ").split("\\s+")) {
        if (s != null) {
          s = s.trim();

          if (s.length() > 0 && !list.contains(s)) list.add(s);
        }
      }
      return list;
    }
  @Override
  public void saveSettings(DBPDataSourceContainer dataSource) {
    DBPConnectionConfiguration connectionInfo = dataSource.getConnectionConfiguration();
    final Set<String> properties =
        metaURL == null ? Collections.<String>emptySet() : metaURL.getAvailableProperties();

    if (hostText != null && properties.contains(DriverDescriptor.PROP_HOST)) {
      connectionInfo.setHostName(hostText.getText().trim());
    }
    if (portText != null && properties.contains(DriverDescriptor.PROP_PORT)) {
      connectionInfo.setHostPort(portText.getText().trim());
    }
    if (serverText != null && properties.contains(DriverDescriptor.PROP_SERVER)) {
      connectionInfo.setServerName(serverText.getText().trim());
    }
    if (dbText != null && properties.contains(DriverDescriptor.PROP_DATABASE)) {
      connectionInfo.setDatabaseName(dbText.getText().trim());
    }
    if (pathText != null
        && (properties.contains(DriverDescriptor.PROP_FOLDER)
            || properties.contains(DriverDescriptor.PROP_FILE))) {
      connectionInfo.setDatabaseName(pathText.getText().trim());
    }
    if (userNameText != null) {
      connectionInfo.setUserName(userNameText.getText().trim());
    }
    if (passwordText != null) {
      connectionInfo.setUserPassword(passwordText.getText());
    }
    super.saveSettings(dataSource);
    if (isCustom) {
      if (urlText != null) {
        connectionInfo.setUrl(urlText.getText().trim());
      }
    } else {
      if (urlText != null && connectionInfo.getUrl() != null) {
        urlText.setText(connectionInfo.getUrl());
      }
    }
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.wizard.WizardPage#isPageComplete()
  */
 public boolean isPageComplete() {
   if (fNameText.getText().trim().length() == 0) return false;
   return true;
 }