Bug #287352: Select SEI wizard page doesn't accommodate all scenarios which can result in errors.
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
index ab02c68..5a6d7f8 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSClassConfigWidget.java
@@ -25,6 +25,7 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
@@ -99,6 +100,9 @@
useSEIButton.setSelection(useSEI);
selectSEIButton.setSelection(useSEI);
selectSEIButton.setEnabled(useSEI);
+ if (!useSEI) {
+ selectSEICombo.deselectAll();
+ }
enableSelectSEIControls(useSEI);
extractSEIButton.setSelection(false);
extractSEIButton.setEnabled(useSEI);
@@ -106,6 +110,7 @@
seiInterfaceNameText.setText("");
seiMembersToExtractTableViewer.setAllChecked(false);
NUMBER_OF_CHECKED_METHODS = 0;
+ validateSEISelection();
}
@Override
@@ -144,12 +149,6 @@
gridData.horizontalSpan = 3;
useSEIButton.setLayoutData(gridData);
-// Label infoLabel = Java2WSWidgetFactory.createInformationLabel(composite, startingPointType);
-// gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
-// gridData.horizontalSpan = 3;
-// gridData.widthHint = 100;
-// infoLabel.setLayoutData(gridData);
-
Label paddingLabel = Java2WSWidgetFactory.createPaddingLabel(composite);
gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
gridData.horizontalSpan = 3;
@@ -163,13 +162,12 @@
enableSelectSEIControls(selectSEIButton.getSelection());
enableExtractSEIControls(!selectSEIButton.getSelection());
if (selectSEIButton.getSelection() && selectSEICombo.getText().trim().length() > 0) {
- validateSEISelection();
+ updateSEISelectionStatus();
+ statusListener.handleEvent(null);
}
- updateSEISelectionStatus();
- statusListener.handleEvent(null);
}
-
});
+
selectSEIButton.setSelection(false);
selectSEIButton.setEnabled(false);
gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
@@ -179,7 +177,7 @@
selectSEICombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- validateSEISelection();
+ updateSEISelectionStatus();
statusListener.handleEvent(null);
}
});
@@ -187,7 +185,7 @@
selectSEICombo.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent event) {
- validateSEISelection();
+ updateSEISelectionStatus();
statusListener.handleEvent(null);
}
});
@@ -209,7 +207,7 @@
ElementTreeSelectionDialog selectionDialog = Java2WSWidgetFactory.createElementTreeSelectionDialog(
composite.getShell(), CXFCreationUIMessages.JAVA2WS_SELECT_SEI_DIALOG_TITLE,
CXFCreationUIMessages.JAVA2WS_SELECT_SEI_DIALOG_DESCRIPTION,
- JDTUtils.getJavaProject(model.getProjectName()), true);
+ JDTUtils.getJavaProject(model.getProjectName()), IJavaSearchConstants.INTERFACE);
int returnCode = selectionDialog.open();
if (returnCode == Window.OK) {
@@ -380,14 +378,21 @@
deselectAllButton.setEnabled(false);
if (model.isUseServiceEndpointInterface()) {
- selectSEICombo.add(model.getServiceEndpointInterfaceName());
+ if (selectSEICombo.indexOf(model.getServiceEndpointInterfaceName()) == -1) {
+ selectSEICombo.add(model.getServiceEndpointInterfaceName());
+ }
selectSEICombo.setText(model.getServiceEndpointInterfaceName());
+ model.setFullyQualifiedJavaInterfaceName(model.getServiceEndpointInterfaceName());
}
return this;
}
private void validateSEISelection() {
+ if (!useSEIButton.getSelection()) {
+ SEI_SELECTION_STATUS = Status.OK_STATUS;
+ return;
+ }
IType seiType = JDTUtils.getType(model.getProjectName(), selectSEICombo.getText());
if (seiType != null) {
try {
@@ -487,7 +492,7 @@
SEI_SELECTION_STATUS = new Status(IStatus.ERROR, CXFCreationUIPlugin.PLUGIN_ID,
CXFCreationUIMessages.JAVA2WS_SELECT_SEI_MESSAGE);
} else if (selectSEIButton.getSelection() && selectSEICombo.getText().length() > 0) {
- SEI_SELECTION_STATUS = Status.OK_STATUS;
+ validateSEISelection();
}
if (extractSEIButton.getSelection() && seiInterfaceNameText.getText().trim().length() == 0) {
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
index d8fcebd..7654d1e 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/Java2WSInterfaceConfigWidget.java
@@ -20,6 +20,7 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jface.window.Window;
import org.eclipse.jst.ws.internal.cxf.core.model.Java2WSDataModel;
import org.eclipse.jst.ws.internal.cxf.creation.ui.CXFCreationUIMessages;
@@ -105,7 +106,7 @@
ElementTreeSelectionDialog selectionDialog = Java2WSWidgetFactory.createElementTreeSelectionDialog(
composite.getShell(), CXFCreationUIMessages.JAVA2WS_SELECT_IMPL_DIALOG_TITLE,
CXFCreationUIMessages.JAVA2WS_SELECT_IMPL_DIALOG_DESCRIPTION,
- JDTUtils.getJavaProject(model.getProjectName()), false);
+ JDTUtils.getJavaProject(model.getProjectName()), IJavaSearchConstants.CLASS);
int returnCode = selectionDialog.open();
if (returnCode == Window.OK) {
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/JavaViewerFilter.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/JavaViewerFilter.java
index 8bf6f91..8440008 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/JavaViewerFilter.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/JavaViewerFilter.java
@@ -16,6 +16,7 @@
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.ws.internal.cxf.ui.CXFUIPlugin;
@@ -27,18 +28,21 @@
public class JavaViewerFilter extends ViewerFilter {
private IJavaProject javaProject;
- private boolean filterClasses;
+ private int elementKinds;
/**
- * Constructs an instance of <code>JavaViewerFilter</code> given a <code>IJavaProject</code> to filter and a
- * boolean value that controls what to filter in the project.
+ * Constructs an instance of <code>JavaViewerFilter</code> given a <code>IJavaProject</code> and an
+ * <code>IJavaSearchConstants</code> element kind to search for. All other elements are filtered.
*
* @param javaProject the java project to filter
- * @param filterClasses true to filter all classes. false to filter all interfaces
+ * @param elementKinds a flag defining nature of searched elements; the only valid values are:
+ * <code>IJavaSearchConstants.CLASS</code>
+ * <code>IJavaSearchConstants.INTERFACE</code>
+ * <code>IJavaSearchConstants.CLASS_AND_INTERFACE</code>
*/
- public JavaViewerFilter(IJavaProject javaProject, boolean filterClasses) {
+ public JavaViewerFilter(IJavaProject javaProject, int elementKinds) {
this.javaProject = javaProject;
- this.filterClasses = filterClasses;
+ this.elementKinds = elementKinds;
}
@@ -59,10 +63,13 @@
if (element instanceof ICompilationUnit) {
ICompilationUnit compilationUnit = (ICompilationUnit) element;
IType type = compilationUnit.findPrimaryType();
- if (filterClasses) {
- return type.isInterface() && !type.isAnnotation();
- } else {
+ switch (elementKinds) {
+ case IJavaSearchConstants.CLASS:
return type.isClass();
+ case IJavaSearchConstants.INTERFACE:
+ return type.isInterface() && !type.isAnnotation();
+ case IJavaSearchConstants.CLASS_AND_INTERFACE:
+ return type.isClass() || (type.isInterface() && !type.isAnnotation());
}
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/Java2WSWidgetFactory.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/Java2WSWidgetFactory.java
index 77af3dd..b285248 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/Java2WSWidgetFactory.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/Java2WSWidgetFactory.java
@@ -273,7 +273,7 @@
}
});
- seiCombo.select(-1);
+ seiCombo.deselectAll();
return seiCombo;
}
@@ -365,7 +365,7 @@
}
});
- selectImplementationCombo.select(-1);
+ selectImplementationCombo.deselectAll();
return selectImplementationCombo;
}
@@ -377,11 +377,15 @@
* @param title the dialog title
* @param message the dialog message
* @param javaProject the java project that is filtered
- * @param filterClasses true to filter all classes, false to filter all interfaces
- * @return
+ * @param elementKinds a flag defining nature of searched elements; the only valid values are:
+ * <code>IJavaSearchConstants.CLASS</code>
+ * <code>IJavaSearchConstants.INTERFACE</code>
+ * <code>IJavaSearchConstants.CLASS_AND_INTERFACE</code>
+ *
+ * @return the element tree selection dialog
*/
public static ElementTreeSelectionDialog createElementTreeSelectionDialog(Shell parent, String title,
- String message, IJavaProject javaProject, boolean filterClasses) {
+ String message, IJavaProject javaProject, int elementKinds) {
ElementTreeSelectionDialog selectionDialog = new ElementTreeSelectionDialog(parent,
new JavaElementLabelProvider(), new StandardJavaElementContentProvider());
selectionDialog.setTitle(title);
@@ -389,7 +393,7 @@
selectionDialog.setAllowMultiple(false);
selectionDialog.setInput(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()));
- selectionDialog.addFilter(new JavaViewerFilter(javaProject, filterClasses));
+ selectionDialog.addFilter(new JavaViewerFilter(javaProject, elementKinds));
selectionDialog.setValidator(new ISelectionStatusValidator() {
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/WSDL2JavaWidgetFactory.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/WSDL2JavaWidgetFactory.java
index dfb1cc5..fab1807 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/WSDL2JavaWidgetFactory.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/widgets/WSDL2JavaWidgetFactory.java
@@ -503,7 +503,7 @@
QName qName = service.getQName();
serviceNameCombo.add(qName.getLocalPart());
}
- serviceNameCombo.select(-1);
+ serviceNameCombo.deselectAll();
}
}
}