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); }
@SuppressWarnings("unused") public void createControl(Composite parent) { Composite topComp = new Composite(parent, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 1; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; topComp.setLayout(innerLayout); GridData gd = new GridData(GridData.FILL_BOTH); topComp.setLayoutData(gd); // General Settings Group general_grp = new Group(topComp, SWT.NONE); general_grp.setText("General"); GridLayout general_layout = new GridLayout(); general_layout.horizontalSpacing = 8; general_layout.numColumns = 2; general_grp.setLayout(general_layout); gd = new GridData(GridData.FILL_HORIZONTAL); general_grp.setLayoutData(gd); Label versionLabel = newLabel(general_grp, "Django version"); djVersionCombo = new Combo(general_grp, SWT.READ_ONLY); gd = new GridData(GridData.FILL_HORIZONTAL); djVersionCombo.setLayoutData(gd); // Database Settings Group group = new Group(topComp, SWT.NONE); group.setText("Database settings"); GridLayout layout = new GridLayout(); layout.horizontalSpacing = 8; layout.numColumns = 2; group.setLayout(layout); gd = new GridData(GridData.FILL_HORIZONTAL); group.setLayoutData(gd); // Database Engine Label engineLabel = newLabel(group, "Database &Engine"); engineCombo = new Combo(group, 0); final IWizardNewProjectNameAndLocationPage projectPage = projectPageCallback.call(); engineCombo.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { updateSqlitePathIfNeeded(projectPage); } public void widgetDefaultSelected(SelectionEvent e) {} }); gd = new GridData(GridData.FILL_HORIZONTAL); engineCombo.setLayoutData(gd); // Database Name Label nameLabel = newLabel(group, "Database &Name"); nameText = newText(group); // Database Host Label hostLabel = newLabel(group, "Database &Host"); hostText = newText(group); // Database Port Label portLabel = newLabel(group, "Database P&ort"); portText = newText(group); // Database User Label userLabel = newLabel(group, "&Username"); userText = newText(group); // Database Pass Label passLabel = newLabel(group, "&Password"); passText = newText(group); passText.setEchoChar('*'); setErrorMessage(null); setMessage(null); setControl(topComp); }