Author: snjeza
Date: 2008-12-03 17:42:35 -0500 (Wed, 03 Dec 2008)
New Revision: 12265
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java
Log:
JBIDE-3338 Unhandled event loop exception during blocked modal context is occured when
change Seam version from 2.0 to 2.1 using Project Facets.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java 2008-12-03
19:22:11 UTC (rev 12264)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java 2008-12-03
22:42:35 UTC (rev 12265)
@@ -33,6 +33,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.jface.resource.ImageDescriptor;
@@ -78,6 +79,8 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
import
org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
@@ -165,13 +168,7 @@
seamRuntimeCombo = new Combo(contents, SWT.READ_ONLY);
gd = new GridData(GridData.FILL_HORIZONTAL);
seamRuntimeCombo.setLayoutData(gd);
- final SeamVersion version = SeamVersion.findByString(fv
- .getVersionString());
- String[] runtimeNames = getRuntimeNames(version);
- seamRuntimeCombo.setItems(runtimeNames);
- if (runtimeNames.length > 0) {
- seamRuntimeCombo.select(0);
- }
+ final SeamVersion version = refreshSeamRuntimeCombo();
Button addSeamRuntime = new Button(contents, SWT.PUSH);
addSeamRuntime.setText(Messages.SeamFacetVersionChangeDialog_Add);
@@ -188,7 +185,12 @@
.getRuntimes())), added, versions);
WizardDialog dialog = new WizardDialog(Display.getCurrent()
.getActiveShell(), wiz);
- dialog.open();
+ int ok = dialog.open();
+ if ((ok == Dialog.OK) && (added.size() > 0)) {
+ SeamRuntimeManager.getInstance().addRuntime(added.get(0));
+ refreshSeamRuntimeCombo();
+ }
+ refresh();
}
});
@@ -244,8 +246,13 @@
added.getList().setLayoutData(gd);
added.getList().setFont(mainFont);
added.setLabelProvider(labelProvider);
- SeamVersion newVersion = SeamRuntimeManager.getInstance()
- .findRuntimeByName(seamRuntimeCombo.getText()).getVersion();
+ SeamVersion newVersion = null;
+ if (seamRuntimeCombo.getText().trim().length() > 0) {
+ newVersion = SeamRuntimeManager.getInstance().findRuntimeByName(
+ seamRuntimeCombo.getText()).getVersion();
+ } else {
+ newVersion = SeamVersion.findByString(fv.getVersionString());
+ }
IStructuredContentProvider aContentProvider = new WarFileSetProvider(
isWarConfiguration(), newVersion);
added.setContentProvider(aContentProvider);
@@ -335,6 +342,18 @@
return area;
}
+ private SeamVersion refreshSeamRuntimeCombo() {
+ final SeamVersion version = SeamVersion.findByString(fv
+ .getVersionString());
+ String[] runtimeNames = getRuntimeNames(version);
+ seamRuntimeCombo.setItems(runtimeNames);
+ if (runtimeNames.length > 0 && seamRuntimeCombo.getText().trim().length()
<=0 ) {
+ seamRuntimeCombo.select(0);
+ }
+
+ return version;
+ }
+
private void refresh() {
updateButton();
File seamHomePath = getSeamHomePath();
Show replies by date