Author: snjeza
Date: 2009-10-12 17:57:51 -0400 (Mon, 12 Oct 2009)
New Revision: 18053
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5016 Show experimental sites checkbox
Modified:
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java
===================================================================
---
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2009-10-12
21:53:18 UTC (rev 18052)
+++
trunk/examples/plugins/org.jboss.tools.project.examples/src/org/jboss/tools/project/examples/wizard/NewProjectExamplesWizardPage.java 2009-10-12
21:57:51 UTC (rev 18053)
@@ -88,22 +88,6 @@
button.setText(Messages.ProjectExamplesPreferencePage_Show_experimental_sites);
IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
button.setSelection(store.getBoolean(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES));
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
- store.setValue(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES,
button.getSelection());
- if (siteCombo != null) {
- String[] items = getItems();
- siteCombo.setItems(items);
- if (items.length > 0) {
- siteCombo.select(0);
- }
- }
- }
-
- });
new Label(siteComposite,SWT.NONE).setText(Messages.NewProjectExamplesWizardPage_Site);
siteCombo = new Combo(siteComposite,SWT.READ_ONLY);
@@ -128,11 +112,9 @@
viewer.setLabelProvider(new ProjectLabelProvider());
viewer.setContentProvider(new ProjectContentProvider());
- final AdaptableList input = new AdaptableList(getCategories());
-
+ refresh(viewer);
final SiteFilter siteFilter = new SiteFilter();
viewer.addFilter(siteFilter);
- viewer.setInput(input);
Label descriptionLabel = new Label(composite,SWT.NULL);
descriptionLabel.setText(Messages.NewProjectExamplesWizardPage_Description);
@@ -212,11 +194,39 @@
});
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPreferenceStore store = ProjectExamplesActivator.getDefault().getPreferenceStore();
+ store.setValue(ProjectExamplesActivator.SHOW_EXPERIMENTAL_SITES,
button.getSelection());
+ refresh(viewer);
+ if (siteCombo != null) {
+ String[] items = getItems();
+ int index = siteCombo.getSelectionIndex();
+ siteCombo.setItems(items);
+ if (items.length > 0 && (index < 0 || index > items.length) ) {
+ siteCombo.select(0);
+ } else {
+ siteCombo.select(index);
+ }
+ }
+ siteFilter.setSite(siteCombo.getText());
+ viewer.refresh();
+ }
+
+ });
setPageComplete(false);
setControl(composite);
}
+ private void refresh(final TreeViewer viewer) {
+ AdaptableList input = new AdaptableList(getCategories());
+ viewer.setInput(input);
+ viewer.refresh();
+ }
+
private List<Category> getCategories() {
return ProjectUtil.getProjects();
}