[332361] Wrong Service Endpoint Interface with CXF Runtime
[341039] Annotations view not seeing ILocalVariable annotations correctly after editing
[341041] NUL default values cause text fields to expand vertically in AnnotationArrayCellEditor
[339834] Annotation view filters selection lost on part closed
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/JAXWSAnnotateJavaCommand.java b/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/JAXWSAnnotateJavaCommand.java
index e2a186f..1aa4bb9 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/JAXWSAnnotateJavaCommand.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/JAXWSAnnotateJavaCommand.java
@@ -89,6 +89,7 @@
MultiTextEdit multiTextEdit = new MultiTextEdit();
textFileChange.setEdit(multiTextEdit);
+ CXFModelUtils.getImportsChange(javaInterfaceType.getCompilationUnit(), model, textFileChange, false);
CXFModelUtils.getWebServiceAnnotationChange(javaInterfaceType, model, textFileChange);
IMethod[] typeMethods = JDTUtils.getPublicMethods(javaInterfaceType);
@@ -119,9 +120,6 @@
}
}
- CXFModelUtils.getImportsChange(javaInterfaceType.getCompilationUnit(), model,
- textFileChange, false);
-
executeChange(monitor, textFileChange);
}
@@ -135,6 +133,7 @@
MultiTextEdit multiTextEdit = new MultiTextEdit();
textFileChange.setEdit(multiTextEdit);
+ CXFModelUtils.getImportsChange(javaClassType.getCompilationUnit(), model, textFileChange, false);
CXFModelUtils.getWebServiceAnnotationChange(javaClassType, model, textFileChange);
IMethod[] typeMethods = JDTUtils.getPublicMethods(javaClassType);
@@ -165,9 +164,6 @@
}
}
- CXFModelUtils.getImportsChange(javaClassType.getCompilationUnit(), model,
- textFileChange, false);
-
executeChange(monitor, textFileChange);
}
@@ -181,11 +177,9 @@
MultiTextEdit multiTextEdit = new MultiTextEdit();
textFileChange.setEdit(multiTextEdit);
+ CXFModelUtils.getImportsChange(javaClassType.getCompilationUnit(), model, textFileChange, true);
CXFModelUtils.getWebServiceAnnotationChange(javaClassType, model, textFileChange);
- CXFModelUtils.getImportsChange(javaClassType.getCompilationUnit(), model,
- textFileChange, true);
-
executeChange(monitor, textFileChange);
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/JAXWSAnnotateJavaWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/JAXWSAnnotateJavaWidget.java
index 6fc9f65..ea548b4 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/JAXWSAnnotateJavaWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/JAXWSAnnotateJavaWidget.java
@@ -27,7 +27,6 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer;
import org.eclipse.jdt.internal.ui.text.SimpleJavaSourceViewerConfiguration;
@@ -55,13 +54,14 @@
import org.eclipse.jface.viewers.TreeSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
-import org.eclipse.jst.ws.internal.cxf.core.model.Java2WSDataModel;
import org.eclipse.jst.ws.annotations.core.utils.AnnotationUtils;
+import org.eclipse.jst.ws.internal.cxf.core.model.Java2WSDataModel;
import org.eclipse.jst.ws.internal.cxf.core.utils.CXFModelUtils;
import org.eclipse.jst.ws.internal.cxf.creation.ui.CXFCreationUIMessages;
import org.eclipse.jst.ws.internal.cxf.creation.ui.CXFCreationUIPlugin;
import org.eclipse.jst.ws.internal.cxf.creation.ui.viewers.AnnotationColumnLabelProvider;
import org.eclipse.jst.ws.jaxws.core.utils.JDTUtils;
+import org.eclipse.ltk.core.refactoring.TextFileChange;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.graphics.Font;
@@ -201,7 +201,7 @@
IDocument document = annotationPreviewViewer.getDocument();
FindReplaceDocumentAdapter findReplaceDocumentAdapter =
- new FindReplaceDocumentAdapter(document);
+ new FindReplaceDocumentAdapter(document);
try {
if (firstElement instanceof IType) {
IType sourceType = (IType) firstElement;
@@ -240,23 +240,23 @@
regex.append(typeName);
regex.append("\\s*?");
regex.append(paramterNames[i]);
- if (i < parameterTypes.length - 1) {
- regex.append("\\s*?,\\s*?.*?");
- }
- }
+ if (i < parameterTypes.length - 1) {
+ regex.append("\\s*?,\\s*?.*?");
+ }
+ }
regex.append("\\s*?\\)");
- IRegion region = findReplaceDocumentAdapter.find(0, regex.toString(), true, true,
- false, true);
+ IRegion region = findReplaceDocumentAdapter.find(0, regex.toString(), true, true,
+ false, true);
if (region != null) {
IRegion elementNameRegion = findReplaceDocumentAdapter.find(
- region.getOffset(), elementName, true, true, true, false);
+ region.getOffset(), elementName, true, true, true, false);
if (elementNameRegion != null) {
- annotationPreviewViewer.setSelectedRange(elementNameRegion.getOffset(),
- elementNameRegion.getLength());
+ annotationPreviewViewer.setSelectedRange(elementNameRegion.getOffset(),
+ elementNameRegion.getLength());
annotationPreviewViewer.revealRange(elementNameRegion.getOffset(),
- elementNameRegion.getLength());
+ elementNameRegion.getLength());
}
}
}
@@ -264,7 +264,7 @@
CXFCreationUIPlugin.log(ble);
} catch (JavaModelException jme) {
CXFCreationUIPlugin.log(jme);
- }
+ }
}
}
});
@@ -408,6 +408,7 @@
textFileChange.setEdit(multiTextEdit);
textFileChange.setKeepPreviewEdits(true);
+ CXFModelUtils.getImportsChange(compilationUnit, model, textFileChange, false);
CXFModelUtils.getWebServiceAnnotationChange(type, model, textFileChange);
IMethod[] typeMethods = JDTUtils.getPublicMethods(type);
@@ -424,15 +425,14 @@
CXFModelUtils.getResponseWrapperAnnotationChange(type, method, textFileChange);
}
if (methodAnnotationMap.get(CXFModelUtils.WEB_PARAM)) {
- List<SingleVariableDeclaration> parameters = AnnotationUtils.getSingleVariableDeclarations(method);
- for (SingleVariableDeclaration parameter : parameters) {
- CXFModelUtils.getWebParamAnnotationChange(type, method,
- (ILocalVariable) parameter.resolveBinding().getJavaElement(), textFileChange);
- }
+ List<SingleVariableDeclaration> parameters = AnnotationUtils.getSingleVariableDeclarations(method);
+ for (SingleVariableDeclaration parameter : parameters) {
+ CXFModelUtils.getWebParamAnnotationChange(type, method,
+ (ILocalVariable) parameter.resolveBinding().getJavaElement(), textFileChange);
+ }
}
}
- CXFModelUtils.getImportsChange(compilationUnit, model, textFileChange, false);
annotationPreviewViewer.getDocument().set(textFileChange.getPreviewContent(monitor));
annotationPreviewViewer.setRedraw(true);
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/actions/AnnotationsViewFilterAction.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/actions/AnnotationsViewFilterAction.java
index 6b8f334..9bd745b 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/actions/AnnotationsViewFilterAction.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/actions/AnnotationsViewFilterAction.java
@@ -1,4 +1,4 @@
- /*******************************************************************************
+/*******************************************************************************
* Copyright (c) 2009 Shane Clarke.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -25,13 +25,12 @@
import org.eclipse.jst.ws.internal.jaxws.ui.views.AnnotationsView;
import org.eclipse.jst.ws.internal.jaxws.ui.views.AnnotationsViewCategoryFilter;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IMemento;
import org.eclipse.ui.dialogs.ListSelectionDialog;
public class AnnotationsViewFilterAction extends Action {
private StructuredViewer viewer;
private AnnotationsViewCategoryFilter categoryFilter;
-
+
public AnnotationsViewFilterAction(AnnotationsView annotationsView, StructuredViewer viewer, String text) {
super(text);
this.viewer = viewer;
@@ -43,31 +42,32 @@
public void run() {
ListSelectionDialog listSelectionDialog = new ListSelectionDialog(viewer.getControl().getShell(),
AnnotationsManager.getAnnotationCategories(), new AnnotationsCategoryDialogContentProvider(),
- new AnnotationsCategoryDialogLabelProvider(),
+ new AnnotationsCategoryDialogLabelProvider(),
JAXWSUIMessages.ANNOTATIONS_VIEW_FILTER_ACTION_SELECT_CATEGORIES_MESSAGE);
-
+
listSelectionDialog.setInitialElementSelections(categoryFilter.getCategories());
-
+
int returnValue = listSelectionDialog.open();
if (returnValue == Window.OK) {
Object[] result = listSelectionDialog.getResult();
categoryFilter.filterAnnotations(Arrays.asList(result));
}
}
-
- public void init(IMemento memento) {
- categoryFilter.init(memento);
+
+ public void init() {
+ categoryFilter.init();
}
-
- public void saveState(IMemento memento) {
- categoryFilter.saveState(memento);
+
+ public void saveState() {
+ categoryFilter.saveState();
}
-
+
+
private static class AnnotationsCategoryDialogContentProvider implements IStructuredContentProvider {
public Object[] getElements(Object inputElement) {
if (inputElement instanceof List) {
- return ((List<String>)inputElement).toArray();
+ return ((List<?>)inputElement).toArray();
}
return new Object[] {};
}
@@ -77,14 +77,16 @@
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
-
+
}
-
+
private static class AnnotationsCategoryDialogLabelProvider extends LabelProvider {
+ @Override
public String getText(Object element) {
return element.toString();
}
+ @Override
public Image getImage(Object element) {
return null;
}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationArrayCellEditor.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationArrayCellEditor.java
index dd241c4..e3dff5c 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationArrayCellEditor.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationArrayCellEditor.java
@@ -16,8 +16,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.IMemberValuePair;
@@ -427,7 +427,7 @@
String[] values = (String[]) defaultValue;
text.setText(values[0]);
} else {
- text.setText(defaultValue.toString());
+ text.setText(defaultValue.toString().trim());
}
}
controls.put(method.getName(), text);
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsValuesEditingSupport.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsValuesEditingSupport.java
index 2f7cb59..36931eb 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsValuesEditingSupport.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsValuesEditingSupport.java
@@ -16,8 +16,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
@@ -27,7 +27,9 @@
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.ILocalVariable;
import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTNode;
@@ -174,6 +176,12 @@
}
private Object getValueForClass(Class<?> aClass, IAnnotatable annotatedElement) {
+ if (annotatedElement instanceof ILocalVariable) {
+ ILocalVariable localVariable = getLocalVariable(annotatedElement);
+ if (localVariable != null) {
+ annotatedElement = localVariable;
+ }
+ }
try {
IAnnotation[] annotations = annotatedElement.getAnnotations();
for (IAnnotation annotation : annotations) {
@@ -203,6 +211,12 @@
}
private Object getValueForMethod(Method method, IAnnotatable annotatedElement) throws JavaModelException {
+ if (annotatedElement instanceof ILocalVariable) {
+ ILocalVariable localVariable = getLocalVariable(annotatedElement);
+ if (localVariable != null) {
+ annotatedElement = localVariable;
+ }
+ }
Class<?> returnType = method.getReturnType();
IAnnotation[] annotations = annotatedElement.getAnnotations();
for (IAnnotation annotation : annotations) {
@@ -277,6 +291,18 @@
return null;
}
+ private ILocalVariable getLocalVariable(IAnnotatable annotatedElement) {
+ ILocalVariable localVariable = (ILocalVariable) annotatedElement;
+ if (localVariable.getParent() instanceof IMethod) {
+ IMethod parent = (IMethod) localVariable.getParent();
+ localVariable = AnnotationUtils.getLocalVariable(parent, localVariable.getElementName());
+ if (localVariable != null) {
+ return localVariable;
+ }
+ }
+ return null;
+ }
+
@Override
protected void setValue(Object element, Object value) {
if (value == null) {
@@ -361,8 +387,8 @@
|| javaElement.getElementType() == IJavaElement.FIELD
|| javaElement.getElementType() == IJavaElement.METHOD
|| javaElement.getElementType() == IJavaElement.LOCAL_VARIABLE) {
- change.addEdit(AnnotationUtils.createAddAnnotationTextEdit(javaElement, annotation));
change.addEdit(AnnotationUtils.createAddImportTextEdit(javaElement, annotationClass.getCanonicalName()));
+ change.addEdit(AnnotationUtils.createAddAnnotationTextEdit(javaElement, annotation));
}
} else {
if (javaElement.getElementType() == IJavaElement.PACKAGE_DECLARATION
@@ -370,8 +396,8 @@
|| javaElement.getElementType() == IJavaElement.FIELD
|| javaElement.getElementType() == IJavaElement.METHOD
|| javaElement.getElementType() == IJavaElement.LOCAL_VARIABLE) {
- change.addEdit(AnnotationUtils.createRemoveAnnotationTextEdit(javaElement, annotation));
change.addEdit(AnnotationUtils.createRemoveImportTextEdit(javaElement, annotationClass.getCanonicalName()));
+ change.addEdit(AnnotationUtils.createRemoveAnnotationTextEdit(javaElement, annotation));
}
}
executeChange(new NullProgressMonitor(), change);
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsView.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsView.java
index 37559de..15b867c 100755
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsView.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsView.java
@@ -57,10 +57,8 @@
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMemento;
import org.eclipse.ui.INullSelectionListener;
import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchPartReference;
@@ -73,6 +71,8 @@
import org.eclipse.ui.texteditor.ITextEditor;
public class AnnotationsView extends ViewPart implements INullSelectionListener, IPartListener2 {
+ private static final String VIEW_ID = "org.eclipse.jst.ws.jaxws.ui.views.AnnotationsView";
+
private PageBook pageBook;
private Tree annotationTree;
@@ -81,8 +81,6 @@
private TreeViewer annotationTreeViewer;
- private IMemento memento;
-
private AnnotationsViewFilterAction annotationsViewFilterAction;
public AnnotationsView() {
@@ -338,6 +336,9 @@
}
public void partOpened(IWorkbenchPartReference partRef) {
+ if (partRef.getId().equals(VIEW_ID)) {
+ annotationsViewFilterAction.init();
+ }
}
public void partClosed(IWorkbenchPartReference partRef) {
@@ -362,6 +363,8 @@
}
}
}
+ } else if (partRef.getId().equals(VIEW_ID)) {
+ annotationsViewFilterAction.saveState();
}
}
@@ -413,18 +416,6 @@
getViewSite().getWorkbenchWindow().getPartService().removePartListener(this);
}
- @Override
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- this.memento = memento;
- }
-
- @Override
- public void saveState(IMemento memento) {
- super.saveState(memento);
- annotationsViewFilterAction.saveState(memento);
- }
-
private void contributeToActionBars() {
IActionBars bars = getViewSite().getActionBars();
fillLocalPullDown(bars.getMenuManager());
@@ -433,9 +424,6 @@
private void fillLocalPullDown(IMenuManager manager) {
annotationsViewFilterAction = new AnnotationsViewFilterAction(this, annotationTreeViewer,
JAXWSUIMessages.ANNOTATIONS_VIEW_FILTER_ACTION_NAME);
- if (memento != null) {
- annotationsViewFilterAction.init(memento);
- }
manager.add(annotationsViewFilterAction);
}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsViewCategoryFilter.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsViewCategoryFilter.java
index dc6af12..7ac866e 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsViewCategoryFilter.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/views/AnnotationsViewCategoryFilter.java
@@ -14,15 +14,15 @@
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.ws.annotations.core.AnnotationDefinition;
import org.eclipse.jst.ws.annotations.core.AnnotationsManager;
-import org.eclipse.ui.IMemento;
+import org.eclipse.jst.ws.internal.jaxws.ui.JAXWSUIPlugin;
public class AnnotationsViewCategoryFilter extends ViewerFilter {
- private static final String TAG_CATEGORY = "AnnotationCategoryFilterInfo"; //$NON-NLS-1$
private static final String TAG_CATEGORY_NAME = "categoryName"; //$NON-NLS-1$
private AnnotationsView annotationsView;
@@ -40,7 +40,7 @@
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof Class && ((Class<?>) element).isAnnotation()) {
AnnotationDefinition annotationDefinition = AnnotationsManager.
- getAnnotationDefinitionForClass((Class<? extends Annotation>)element);
+ getAnnotationDefinitionForClass((Class<? extends Annotation>) element);
if (annotationDefinition != null) {
return !categories.contains(annotationDefinition.getCategory());
}
@@ -62,29 +62,19 @@
return categories;
}
- public void init(IMemento memento) {
- IMemento catMemento = memento.getChild(TAG_CATEGORY);
- if (catMemento == null) {
- return;
- }
- for (int i = 0; i < AnnotationsManager.getAnnotationCategories().size(); i++) {
- String category = catMemento.getString(TAG_CATEGORY_NAME + i);
- if (category != null) {
+ public void init() {
+ IDialogSettings settings = JAXWSUIPlugin.getDefault().getDialogSettings();
+ String[] cat = settings.getArray(TAG_CATEGORY_NAME);
+ if (cat != null) {
+ for (String category : cat) {
categories.add(category);
}
}
filterAnnotations(categories);
}
- public void saveState(IMemento memento) {
- if (categories == null || categories.size() == 0) {
- return;
- }
- IMemento catMemento = memento.createChild(TAG_CATEGORY);
- int i = 0;
- for (Object category : categories) {
- catMemento.putString(TAG_CATEGORY_NAME + i, category.toString());
- i++;
- }
+ public void saveState() {
+ IDialogSettings settings = JAXWSUIPlugin.getDefault().getDialogSettings();
+ settings.put(TAG_CATEGORY_NAME, categories.toArray(new String[categories.size()]));
}
}