[85705] Update logic of WS-I preference
diff --git a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIAPContext.java b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIAPContext.java
index 9214b5f..cfc3791 100644
--- a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIAPContext.java
+++ b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIAPContext.java
@@ -32,7 +32,7 @@
public String getPersistentWSICompliance ()
{
String property = getValueAsString(non_wsi_compliance);
- // default to Warning if no init has been done from ini file
+ // default to Ignore if no init has been done from ini file
if (property == null || property.equals("")) {
setValue( non_wsi_compliance, IGNORE_NON_WSI);
return IGNORE_NON_WSI;
diff --git a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIContext.java b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIContext.java
index c1e2aca..359956e 100644
--- a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIContext.java
+++ b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/PersistentWSIContext.java
@@ -60,10 +60,10 @@
public String getPersistentWSICompliance ()
{
String property = getValueAsString(non_wsi_compliance);
- // default to Warning if no init has been done from ini file
+// default to Ignore if no init has been done from ini file
if (property == null || property.equals("")) {
- setValue( non_wsi_compliance, WARN_NON_WSI);
- return WARN_NON_WSI;
+ setValue( non_wsi_compliance, IGNORE_NON_WSI);
+ return IGNORE_NON_WSI;
}
else
return property;
diff --git a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/WSICompliancePreferencePage.java b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/WSICompliancePreferencePage.java
index 934a005..8593527 100644
--- a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/WSICompliancePreferencePage.java
+++ b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/preferences/WSICompliancePreferencePage.java
@@ -13,6 +13,8 @@
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jst.ws.internal.ui.plugin.WebServiceUIPlugin;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -27,7 +29,9 @@
import org.eclipse.wst.command.env.core.common.MessageUtils;
-public class WSICompliancePreferencePage extends PreferencePage implements IWorkbenchPreferencePage
+
+public class WSICompliancePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, SelectionListener
+
{
private MessageUtils msgUtils_;
@@ -58,6 +62,9 @@
private String INFOPOP_PWSI_AP_COMBO_IGNORE_NON_WSI = WebServiceUIPlugin.ID + ".PWSI0007";
/*CONTEXT_ID PWSI0008 for the WS-I AP type combo box on the WS-I AP Non compliance Preference Page*/
private String INFOPOP_PWSI_AP_COMBO_TYPE = WebServiceUIPlugin.ID + ".PWSI0008";
+
+ private int savedSSBPSetting_ = -1;
+
/**
* Creates preference page controls on demand.
@@ -84,17 +91,6 @@
Composite wsi_Composite = new Composite (parent, SWT.NONE);
wsi_Composite.setLayout(gl);
wsi_Composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
- wsi_ssbp_Label_ = new Label(wsi_Composite, SWT.NONE);
- wsi_ssbp_Label_.setText(msgUtils_.getMessage("LABEL_WSI_SSBP"));
- wsi_ssbp_Label_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_SSBP_LABEL"));
- wsi_ssbp_Types_ = new Combo(wsi_Composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- wsi_ssbp_Types_.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
- wsi_ssbp_Types_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_SSBP_COMBO"));
- WorkbenchHelp.setHelp(wsi_ssbp_Types_, new DialogPageContextComputer(this, INFOPOP_PWSI_SSBP_COMBO_TYPE));
-
- wsi_ssbp_Types_.add(msgUtils_.getMessage("STOP_NON_WSI"));
- wsi_ssbp_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
- wsi_ssbp_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
wsi_ap_Label_ = new Label(wsi_Composite, SWT.NONE);
wsi_ap_Label_.setText(msgUtils_.getMessage("LABEL_WSI_AP"));
@@ -107,6 +103,20 @@
wsi_ap_Types_.add(msgUtils_.getMessage("STOP_NON_WSI"));
wsi_ap_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
wsi_ap_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
+
+ wsi_ap_Types_.addSelectionListener(this);
+
+ wsi_ssbp_Label_ = new Label(wsi_Composite, SWT.NONE);
+ wsi_ssbp_Label_.setText(msgUtils_.getMessage("LABEL_WSI_SSBP"));
+ wsi_ssbp_Label_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_SSBP_LABEL"));
+ wsi_ssbp_Types_ = new Combo(wsi_Composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ wsi_ssbp_Types_.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+ wsi_ssbp_Types_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_SSBP_COMBO"));
+ WorkbenchHelp.setHelp(wsi_ssbp_Types_, new DialogPageContextComputer(this, INFOPOP_PWSI_SSBP_COMBO_TYPE));
+
+ wsi_ssbp_Types_.add(msgUtils_.getMessage("STOP_NON_WSI"));
+ wsi_ssbp_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
+ wsi_ssbp_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
initializeValues();
org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent);
@@ -157,8 +167,12 @@
{
// force WSI compliance by default
- wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(msgUtils_.getMessage("WARN_NON_WSI")));
- wsi_ap_Types_.select(wsi_ap_Types_.indexOf(msgUtils_.getMessage("IGNORE_NON_WSI")));
+ wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(msgUtils_.getMessage("IGNORE_NON_WSI")));
+ int apSelection = wsi_ap_Types_.indexOf(msgUtils_.getMessage("IGNORE_NON_WSI"));
+ wsi_ap_Types_.select(apSelection);
+ savedSSBPSetting_ = -1; // do not restore saved SSBP setting
+ processAPSelection(apSelection);
+
}
/**
@@ -170,8 +184,10 @@
String WSIText = getWSISelection(WebServiceUIPlugin.getInstance().getWSISSBPContext());
wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(WSIText));
- String WSIAPText = getWSISelection(WebServiceUIPlugin.getInstance().getWSIAPContext());
- wsi_ap_Types_.select(wsi_ap_Types_.indexOf(WSIAPText));
+ int apSelection = wsi_ap_Types_.indexOf(getWSISelection(WebServiceUIPlugin.getInstance().getWSIAPContext()));
+ wsi_ap_Types_.select(apSelection);
+ savedSSBPSetting_ = -1; // do not restore saved SSBP setting
+ processAPSelection(apSelection);
}
private String getWSISelection(PersistentWSIContext context)
@@ -213,4 +229,34 @@
}
context.updateWSICompliances(value);
}
+
+ public void widgetSelected(SelectionEvent e)
+ {
+
+ processAPSelection( wsi_ap_Types_.getSelectionIndex() );
+
+ }
+
+ public void processAPSelection(int selection) {
+ if (selection == 2) { // reset SSBP to default if AP is ignore
+ wsi_ssbp_Types_.setEnabled(true);
+ if (savedSSBPSetting_ != -1) {
+ // restore saved SSBP setting, if any
+ wsi_ssbp_Types_.select(savedSSBPSetting_);
+ savedSSBPSetting_ = -1;
+ }
+ } else { // set SSBP to follow AP setting if STOP or WARN chosen
+ if (savedSSBPSetting_ == -1) { // SSBP setting not saved
+ savedSSBPSetting_ = wsi_ssbp_Types_.getSelectionIndex();
+ }
+ wsi_ssbp_Types_.select(selection);
+ wsi_ssbp_Types_.setEnabled(false);
+
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
+
}
diff --git a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/properties/WSICompliancePropertyPage.java b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/properties/WSICompliancePropertyPage.java
index 688de2e..1097190 100644
--- a/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/properties/WSICompliancePropertyPage.java
+++ b/bundles/org.eclipse.jst.ws.ui/src/org/eclipse/jst/ws/internal/ui/wsi/properties/WSICompliancePropertyPage.java
@@ -13,6 +13,8 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.jst.ws.internal.ui.plugin.WebServiceUIPlugin;
import org.eclipse.jst.ws.internal.ui.wsi.preferences.PersistentWSIContext;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -28,7 +30,7 @@
import org.eclipse.wst.command.env.core.common.MessageUtils;
-public class WSICompliancePropertyPage extends PropertyPage
+public class WSICompliancePropertyPage extends PropertyPage implements SelectionListener
{
private MessageUtils msgUtils_;
@@ -65,6 +67,8 @@
/*CONTEXT_ID PWSI0010 for the WS-I follow preference radio button the WS-I AP compliance project property Page*/
private String INFOPOPP_PWSI_RADIO_FOLLOW_WSI_AP_PREFERENCE = WebServiceUIPlugin.ID + ".PWSI0010";
+ private int savedSSBPSetting_ = -1;
+
/**
* Creates preference page controls on demand.
* @param parent the parent for the preference page
@@ -90,6 +94,21 @@
Composite wsi_Composite = new Composite (parent, SWT.NONE);
wsi_Composite.setLayout(gl);
wsi_Composite.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+
+ wsi_ap_Label_ = new Label(wsi_Composite, SWT.NONE);
+ wsi_ap_Label_.setText(msgUtils_.getMessage("LABEL_WSI_AP"));
+ wsi_ap_Label_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_AP_LABEL"));
+ wsi_ap_Types_ = new Combo(wsi_Composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ wsi_ap_Types_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_AP_COMBO"));
+ wsi_ap_Types_.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
+ WorkbenchHelp.setHelp(wsi_ap_Types_, new DialogPageContextComputer(this, INFOPOP_PWSI_AP_COMBO_TYPE));
+
+ wsi_ap_Types_.add(msgUtils_.getMessage("STOP_NON_WSI"));
+ wsi_ap_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
+ wsi_ap_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
+ wsi_ap_Types_.add(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE"));
+
+ wsi_ap_Types_.addSelectionListener(this);
wsi_ssbp_Label_ = new Label(wsi_Composite, SWT.NONE);
wsi_ssbp_Label_.setText(msgUtils_.getMessage("LABEL_WSI_SSBP"));
@@ -103,19 +122,6 @@
wsi_ssbp_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
wsi_ssbp_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
wsi_ssbp_Types_.add(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE"));
-
- wsi_ap_Label_ = new Label(wsi_Composite, SWT.NONE);
- wsi_ap_Label_.setText(msgUtils_.getMessage("LABEL_WSI_AP"));
- wsi_ap_Label_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_AP_LABEL"));
- wsi_ap_Types_ = new Combo(wsi_Composite, SWT.DROP_DOWN | SWT.READ_ONLY);
- wsi_ap_Types_.setToolTipText(msgUtils_.getMessage("TOOLTIP_PWSI_AP_COMBO"));
- wsi_ap_Types_.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
- WorkbenchHelp.setHelp(wsi_ap_Types_, new DialogPageContextComputer(this, INFOPOP_PWSI_AP_COMBO_TYPE));
-
- wsi_ap_Types_.add(msgUtils_.getMessage("STOP_NON_WSI"));
- wsi_ap_Types_.add(msgUtils_.getMessage("WARN_NON_WSI"));
- wsi_ap_Types_.add(msgUtils_.getMessage("IGNORE_NON_WSI"));
- wsi_ap_Types_.add(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE"));
initializeValues();
org.eclipse.jface.dialogs.Dialog.applyDialogFont(superparent);
@@ -170,8 +176,11 @@
*/
private void initializeDefaults()
{
- wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE")));
- wsi_ap_Types_.select(wsi_ap_Types_.indexOf(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE")));
+ wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE")));
+ int apSelection = wsi_ap_Types_.indexOf(msgUtils_.getMessage("FOLLOW_WSI_PREFERENCE"));
+ wsi_ap_Types_.select(apSelection);
+ savedSSBPSetting_ = -1; // do not restore saved SSBP setting
+ processAPSelection(apSelection);
}
/**
@@ -181,8 +190,10 @@
String WSIText = getWSISelection(WebServiceUIPlugin.getInstance().getWSISSBPContext());
wsi_ssbp_Types_.select(wsi_ssbp_Types_.indexOf(WSIText));
- String WSIAPText = getWSISelection(WebServiceUIPlugin.getInstance().getWSIAPContext());
- wsi_ap_Types_.select(wsi_ap_Types_.indexOf(WSIAPText));
+ int apSelection = wsi_ap_Types_.indexOf(getWSISelection(WebServiceUIPlugin.getInstance().getWSIAPContext()));
+ wsi_ap_Types_.select(apSelection);
+ savedSSBPSetting_ = -1; // do not restore saved SSBP setting
+ processAPSelection(apSelection);
}
private String getWSISelection(PersistentWSIContext context)
@@ -232,5 +243,33 @@
context.updateProjectWSICompliances(project, value);
}
+ public void widgetSelected(SelectionEvent e)
+ {
+
+ processAPSelection( wsi_ap_Types_.getSelectionIndex() );
+
+ }
+
+ public void processAPSelection(int selection) {
+ if (selection == 2) { // reset SSBP to default if AP is ignore
+ wsi_ssbp_Types_.setEnabled(true);
+ if (savedSSBPSetting_ != -1) {
+ // restore saved SSBP setting, if any
+ wsi_ssbp_Types_.select(savedSSBPSetting_);
+ savedSSBPSetting_ = -1;
+ }
+ } else { // set SSBP to follow AP setting if STOP or WARN chosen
+ if (savedSSBPSetting_ == -1) { // SSBP setting not saved
+ savedSSBPSetting_ = wsi_ssbp_Types_.getSelectionIndex();
+ }
+ wsi_ssbp_Types_.select(selection);
+ wsi_ssbp_Types_.setEnabled(false);
+
+ }
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+
+ }
}