public void refresh() { IGrailsInstall defaultInstall = GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall(); if (defaultInstall != null) { useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallation + defaultInstall.getName() + "')"); } else { setErrorMessage( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_noGrailsInstallation); setPageComplete(false); useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallationNoCurrent); } grailsInstallCombo.setItems( GrailsCoreActivator.getDefault().getInstallManager().getAllInstallNames()); String[] names = grailsInstallCombo.getItems(); for (int i = 0; i < names.length; i++) { if (GrailsCoreActivator.getDefault() .getInstallManager() .getGrailsInstall(names[i]) .isDefault()) { grailsInstallCombo.select(i); break; } } setChanged(); notifyObservers(); }
public Control createControl(Composite composite) { Group grailsHomeGroup = new Group(composite, SWT.NONE); grailsHomeGroup.setFont(composite.getFont()); grailsHomeGroup.setText("Grails Installation"); grailsHomeGroup.setLayout(initGridLayout(new GridLayout(1, false), true)); useDefault = new Button(grailsHomeGroup, SWT.RADIO); IGrailsInstall defaultInstall = GrailsCoreActivator.getDefault().getInstallManager().getDefaultGrailsInstall(); if (defaultInstall != null) { useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallation + defaultInstall.getName() + "')"); } else { setErrorMessage( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_noGrailsInstallation); setPageComplete(false); useDefault.setText( org.grails.ide.eclipse.ui.internal.wizard.NewGrailsWizardMessages .NewGrailsProjectWizardPageOne_useDefaultGrailsInstallationNoCurrent); } useDefault.setSelection(true); useDefault.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { grailsInstallCombo.setEnabled(false); } }); useSpecific = new Button(grailsHomeGroup, SWT.RADIO); useSpecific.setText("Use project specific Grails installation:"); useSpecific.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { grailsInstallCombo.setEnabled(true); } }); final Composite installComposite = new Composite(grailsHomeGroup, SWT.NULL); installComposite.setFont(composite.getFont()); installComposite.setLayout(new GridLayout(3, false)); installComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label options = new Label(installComposite, SWT.WRAP); options.setText("Install: "); options.setLayoutData(new GridData(GridData.BEGINNING)); grailsInstallCombo = new Combo(installComposite, SWT.DROP_DOWN | SWT.READ_ONLY); grailsInstallCombo.setItems( GrailsCoreActivator.getDefault().getInstallManager().getAllInstallNames()); grailsInstallCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); String[] names = grailsInstallCombo.getItems(); for (int i = 0; i < names.length; i++) { if (GrailsCoreActivator.getDefault() .getInstallManager() .getGrailsInstall(names[i]) .isDefault()) { grailsInstallCombo.select(i); break; } } grailsInstallCombo.setEnabled(false); grailsHomeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Link link = new Link(installComposite, SWT.NONE); link.setFont(composite.getFont()); link.setText("<A>Configure Grails Installations....</A>"); // $NON-NLS-1$//$NON-NLS-2$ link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END)); link.addSelectionListener( new SelectionListener() { public void widgetSelected(SelectionEvent e) { openPreferences(); } public void widgetDefaultSelected(SelectionEvent e) { openPreferences(); } }); return grailsHomeGroup; }