Пример #1
0
  public void updateSqlitePathIfNeeded(final IWizardNewProjectNameAndLocationPage projectPage) {
    String selection = engineCombo.getText();
    if (selection.endsWith("sqlite3")) {
      String projectName = projectPage.getProjectName();
      IPath base = projectPage.getLocationPath().append(projectName);
      int sourceFolderConfigurationStyle = projectPage.getSourceFolderConfigurationStyle();

      switch (sourceFolderConfigurationStyle) {
        case IWizardNewProjectNameAndLocationPage.PYDEV_NEW_PROJECT_CREATE_PROJECT_AS_SRC_FOLDER:
        case IWizardNewProjectNameAndLocationPage.PYDEV_NEW_PROJECT_NO_PYTHONPATH:
          break;
        default:
          base = base.append("src");
      }

      nameText.setText(base.append("sqlite.db").toOSString());
    }
  }
Пример #2
0
  public void setPreviousPage(IWizardPage page) {
    super.setPreviousPage(page);
    final IWizardNewProjectNameAndLocationPage projectPage = projectPageCallback.call();
    final String projectType = projectPage.getProjectType();

    if (djVersionCombo.getItemCount() == 0) {
      // fill it only if it's still not properly filled
      djVersionCombo.removeAll();
      for (String version : DJANGO_VERSIONS) {
        djVersionCombo.add(version);
      }
    }

    final String projectInterpreter = projectPage.getProjectInterpreter();
    if (!projectType.equals(previousProjectType)
        || !projectInterpreter.equals(previousProjectInterpreter)) {
      discoverDefaultVersion(projectType, projectInterpreter);
    }
    djVersionCombo.setText(defaultVersion);

    if (!projectType.equals(previousProjectType)) {
      List<String> engines =
          DB_ENGINES.get(
              projectType.startsWith("jython")
                  ? DjangoSettingsPage.JYTHON
                  : DjangoSettingsPage.CPYTHON);
      engineCombo.removeAll();
      for (String engine : engines) {
        engineCombo.add(engine);
      }

      engineCombo.setText(engines.get(0));
    }

    this.previousProjectType = projectType;
    this.previousProjectInterpreter = projectInterpreter;

    // Always update the sqlite path if needed.
    updateSqlitePathIfNeeded(projectPage);
  }