Code Cleanup.
diff --git a/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/AnnotationsCore.java b/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/AnnotationsCore.java
index a285358..72fe309 100644
--- a/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/AnnotationsCore.java
+++ b/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/AnnotationsCore.java
@@ -236,11 +236,11 @@
public static TypeLiteral createTypeLiteral(AST ast, String value) {
TypeLiteral typeLiteral = ast.newTypeLiteral();
- if (value.toString().indexOf(".") == -1) { //$NON-NLS-1$
- typeLiteral.setType(ast.newSimpleType(ast.newSimpleName(value.toString())));
+ if (value.indexOf(".") == -1) { //$NON-NLS-1$
+ typeLiteral.setType(ast.newSimpleType(ast.newSimpleName(value)));
} else {
- String qualifier = value.toString().substring(0, value.toString().lastIndexOf(".")); //$NON-NLS-1$
- String identifier = value.toString().substring(value.toString().lastIndexOf(".") + 1); //$NON-NLS-1$
+ String qualifier = value.substring(0, value.lastIndexOf(".")); //$NON-NLS-1$
+ String identifier = value.substring(value.lastIndexOf(".") + 1); //$NON-NLS-1$
if (qualifier.equals("java.lang")) { //$NON-NLS-1$
typeLiteral.setType(ast.newSimpleType(ast.newSimpleName(identifier)));
} else {
diff --git a/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java b/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
index 1e5b145..c1eba8f 100644
--- a/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
+++ b/bundles/org.eclipse.jst.ws.annotations.core/src/org/eclipse/jst/ws/annotations/core/utils/AnnotationUtils.java
@@ -857,8 +857,7 @@
List<SingleVariableDeclaration> methodDeclarationParameters = methodDeclaration.parameters();
if (parametetNames.length == methodDeclarationParameters.size()) {
for (int i = 0; i < parametetNames.length; i++) {
- String simpleName1 = Signature.getSimpleName(Signature.toString(Signature
- .getTypeErasure(parametetNames[i])));
+ String simpleName1 = Signature.toString(parametetNames[i]);
String simpleName2 = methodDeclarationParameters.get(i).getType().toString();
if (!simpleName1.equals(simpleName2)) {
return false;
@@ -998,10 +997,9 @@
private static boolean isAnnotationPresent(CompilationUnit compilationUnit, IJavaElement javaElement,
String annotationName) {
-
List<IExtendedModifier> modifiers = getExtendedModifiers(compilationUnit, javaElement);
for (IExtendedModifier extendedModifier : modifiers) {
- if (extendedModifier instanceof Annotation) {
+ if (extendedModifier.isAnnotation()) {
Annotation existingAnnotation = (Annotation) extendedModifier;
if (AnnotationUtils.getAnnotationName(existingAnnotation).equals(annotationName)) {
return true;
@@ -1030,7 +1028,7 @@
}
if (javaElement.getElementType() == IJavaElement.FIELD) {
bodyDeclaration = getFieldDeclaration(bodyDeclarations, (IField) javaElement);
- }
+ }
return bodyDeclaration != null ? bodyDeclaration.modifiers() : Collections.emptyList();
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/CXFConsumptionUIPlugin.java b/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/CXFConsumptionUIPlugin.java
index 4e73b58..9009837 100644
--- a/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/CXFConsumptionUIPlugin.java
+++ b/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/CXFConsumptionUIPlugin.java
@@ -42,7 +42,7 @@
@Override
public void start(BundleContext context) throws Exception {
super.start(context);
- CXFConsumptionUIPlugin.plugin = this;
+ plugin = this;
}
/*
@@ -52,7 +52,7 @@
*/
@Override
public void stop(BundleContext context) throws Exception {
- CXFConsumptionUIPlugin.plugin = null;
+ plugin = null;
super.stop(context);
}
@@ -62,7 +62,7 @@
* @return the shared instance
*/
public static CXFConsumptionUIPlugin getDefault() {
- return CXFConsumptionUIPlugin.plugin;
+ return plugin;
}
public static void logMessage(int severity, String message) {
diff --git a/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/widgets/WSDL2JavaClientConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/widgets/WSDL2JavaClientConfigWidget.java
index 5aad658..5670049 100644
--- a/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/widgets/WSDL2JavaClientConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.consumption.ui/src/org/eclipse/jst/ws/internal/cxf/consumption/ui/widgets/WSDL2JavaClientConfigWidget.java
@@ -210,8 +210,33 @@
TableViewerColumn packageNameViewerColumn = WSDL2JavaWidgetFactory.createPackageNameColumn(
packageNameTableViewer, model);
+ TextCellEditor textCellEditor = new TextCellEditor(packageNameTableViewer.getTable());
+ textCellEditor.addListener( new ICellEditorListener() {
+
+ public void editorValueChanged(boolean oldValidState, boolean newValidState) {
+ statusListener.handleEvent(null);
+ }
+
+ public void cancelEditor() {
+ }
+
+ public void applyEditorValue() {
+ }
+ });
+
+ textCellEditor.setValidator(new ICellEditorValidator() {
+
+ public String isValid(Object packageName) {
+ status = JDTUtils.validatePackageName(model.getProjectName(), packageName.toString());
+ if (status.getSeverity() == IStatus.OK) {
+ return null;
+ }
+ return status.getMessage();
+ }
+ });
+
packageNameViewerColumn.setEditingSupport(new PackageNameEditingSupport(packageNameTableViewer,
- new PackageNameTextCellEditor(packageNameTableViewer.getTable()), model));
+ textCellEditor, model));
columnWeightData = new ColumnWeightData(100, 100, true);
tableLayout.addColumnData(columnWeightData);
@@ -251,33 +276,4 @@
return status;
}
- private class PackageNameTextCellEditor extends TextCellEditor implements ICellEditorListener,
- ICellEditorValidator {
-
- public PackageNameTextCellEditor(Composite parent) {
- super(parent);
- addListener(this);
- setValidator(this);
- }
-
- public void applyEditorValue() {
- }
-
- public void cancelEditor() {
- }
-
- public void editorValueChanged(boolean oldValidState, boolean newValidState) {
- statusListener.handleEvent(null);
- }
-
- public String isValid(Object packageName) {
- status = JDTUtils.validatePackageName(model.getProjectName(), packageName.toString());
- if (status.getSeverity() == IStatus.OK) {
- return null;
- }
- return status.getMessage();
- }
- }
-
-
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/CXFClasspathContainer.java b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/CXFClasspathContainer.java
index f96047f..00f174b 100644
--- a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/CXFClasspathContainer.java
+++ b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/CXFClasspathContainer.java
@@ -44,7 +44,7 @@
}
public IClasspathEntry[] getClasspathEntries() {
- if (cxfLibraryVersion != getCxfRuntimeVersion()) {
+ if (!cxfLibraryVersion.equals(getCxfRuntimeVersion())) {
classpathEntries = new ArrayList<IClasspathEntry>();
cxfLibraryLocation = getCxfRuntimeLocation();
cxfLibraryVersion = getCxfRuntimeVersion();
diff --git a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/FileUtils.java b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/FileUtils.java
index 2fa22b3..33f0aa3 100644
--- a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/FileUtils.java
+++ b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/FileUtils.java
@@ -12,6 +12,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -67,11 +68,7 @@
if (file.isDirectory()) {
copyFolder(source, destination, files[i]);
} else {
- try {
- copyFile(source, destination, files[i]);
- } catch (IOException ioe) {
- CXFCorePlugin.log(ioe);
- }
+ copyFile(source, destination, files[i]);
}
}
}
@@ -84,23 +81,40 @@
copyFolder(sourceFolder + File.separator + name, targetFolder + File.separator + name);
}
- public static void copyFile(String sourceFolder, String targetFolder, String fileName)
- throws IOException {
+ public static void copyFile(String sourceFolder, String targetFolder, String fileName) {
File sourceFile = new File(sourceFolder + File.separator + fileName);
File targetFile = new File(targetFolder + File.separator + fileName);
if (!targetFile.exists()) {
- InputStream inputStream = new FileInputStream(sourceFile);
- OutputStream outputStream = new FileOutputStream(targetFile);
- byte[] buffer = new byte[102400];
- while (true) {
- int numberOfBytes = inputStream.read(buffer);
- if (numberOfBytes < 0) {
- break;
+ InputStream inputStream = null;
+ OutputStream outputStream = null;
+ try {
+ inputStream = new FileInputStream(sourceFile);
+ outputStream = new FileOutputStream(targetFile);
+ byte[] buffer = new byte[102400];
+ while (true) {
+ int numberOfBytes = inputStream.read(buffer);
+ if (numberOfBytes < 0) {
+ break;
+ }
+ outputStream.write(buffer, 0, numberOfBytes);
}
- outputStream.write(buffer, 0, numberOfBytes);
- }
- inputStream.close();
- outputStream.close();
+
+ } catch (FileNotFoundException fnfe) {
+ CXFCorePlugin.log(fnfe);
+ } catch (IOException ioe) {
+ CXFCorePlugin.log(ioe);
+ } finally {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ } catch(IOException ioe) {
+ CXFCorePlugin.log(ioe);
+ }
+ }
} else {
if (sourceFile.getName().indexOf(".java") != -1) { //$NON-NLS-1$
MergeUtils.merge(sourceFile, targetFile);
@@ -108,39 +122,6 @@
}
}
- public static IStatus copyFiles(IPath fromDiretoryPath, IPath toDirectPath, String fileExtension)
- throws IOException {
- IStatus status = Status.OK_STATUS;
-
- File fromDirectory = new File(fromDiretoryPath.toOSString());
- if (fromDirectory.exists() && fromDirectory.isDirectory()) {
- String[] files = fromDirectory.list();
- for (int i = 0; i < files.length; i++) {
- File file = new File(fromDirectory.getPath() + File.separator + files[i]);
- String fileName = file.getName();
- InputStream fileInputStream = new FileInputStream(file);
-
- if (fileName.indexOf(".") != -1
- && fileName.substring(fileName.lastIndexOf("."), fileName.length()).equals(
- fileExtension)) {
- try {
- IFolder toFolder = ResourcesPlugin.getWorkspace().getRoot().getFolder(toDirectPath);
- IFile fileCopy = toFolder.getFile(fileName);
- if (!fileCopy.exists()) {
- fileCopy.create(fileInputStream, true, new NullProgressMonitor());
- }
- } catch (CoreException ce) {
- status = ce.getStatus();
- CXFCorePlugin.log(status);
- } finally {
- fileInputStream.close();
- }
- }
- }
- }
- return status;
- }
-
public static String getTmpFolderName() {
return TMP_FOLDER_NAME;
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/MergeUtils.java b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/MergeUtils.java
index fa7fcce..75a3040 100644
--- a/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/MergeUtils.java
+++ b/bundles/org.eclipse.jst.ws.cxf.core/src/org/eclipse/jst/ws/internal/cxf/core/utils/MergeUtils.java
@@ -12,6 +12,7 @@
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
@@ -46,37 +47,50 @@
return jmerger;
}
- public static void merge(File sourceFile, File targetFile) throws IOException {
+ public static void merge(File sourceFile, File targetFile) {
JMerger merger = getJMerger();
- // set source
- FileInputStream sourceInputStream = new FileInputStream(sourceFile);
- JCompilationUnit inputCompilationUnit = merger
- .createCompilationUnitForInputStream(sourceInputStream);
- merger.setSourceCompilationUnit(inputCompilationUnit);
+ FileInputStream sourceInputStream = null;
+ FileInputStream targetInputStream = null;
+ OutputStream targetOutputStream = null;
+ try {
+ // set source
+ sourceInputStream = new FileInputStream(sourceFile);
+ JCompilationUnit inputCompilationUnit = merger
+ .createCompilationUnitForInputStream(sourceInputStream);
+ merger.setSourceCompilationUnit(inputCompilationUnit);
- // set target
- FileInputStream targetInputStream = new FileInputStream(targetFile);
- JCompilationUnit targetCompilationUnit = merger
- .createCompilationUnitForInputStream(targetInputStream);
- merger.setTargetCompilationUnit(targetCompilationUnit);
+ // set target
+ targetInputStream = new FileInputStream(targetFile);
+ JCompilationUnit targetCompilationUnit = merger
+ .createCompilationUnitForInputStream(targetInputStream);
+ merger.setTargetCompilationUnit(targetCompilationUnit);
- // merge source and target
- merger.merge();
+ // merge source and target
+ merger.merge();
- // extract merged contents
- // InputStream mergedContents = new ByteArrayInputStream(
- // merger.getTargetCompilationUnit().getContents().getBytes());
-
- OutputStream targetOutputStream = new FileOutputStream(targetFile);
- byte[] bytes = merger.getTargetCompilationUnit().getContents().getBytes();
- targetOutputStream.write(bytes, 0, bytes.length);
-
- // overwrite the target with the merged contents
- // targetFile.setContents(mergedContents, true, false, new
- // NullProgressMonitor());
- sourceInputStream.close();
- targetInputStream.close();
- targetOutputStream.close();
+ // write merged contents
+ targetOutputStream = new FileOutputStream(targetFile);
+ byte[] bytes = merger.getTargetCompilationUnit().getContents().getBytes();
+ targetOutputStream.write(bytes, 0, bytes.length);
+ } catch (FileNotFoundException fnfe) {
+ CXFCorePlugin.log(fnfe);
+ } catch (IOException ioe) {
+ CXFCorePlugin.log(ioe);
+ } finally {
+ try {
+ if (sourceInputStream != null) {
+ sourceInputStream.close();
+ }
+ if (targetInputStream != null) {
+ targetInputStream.close();
+ }
+ if (targetOutputStream != null) {
+ targetOutputStream.close();
+ }
+ } catch (IOException ioe) {
+ CXFCorePlugin.log(ioe);
+ }
+ }
}
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/Java2WSSelectSEICommand.java b/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/Java2WSSelectSEICommand.java
index 6513cb8..3313c50 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/Java2WSSelectSEICommand.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.core/src/org/eclipse/jst/ws/internal/cxf/creation/core/commands/Java2WSSelectSEICommand.java
@@ -39,7 +39,6 @@
import org.eclipse.ltk.core.refactoring.RefactoringCore;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
-import org.eclipse.ltk.ui.refactoring.RefactoringUI;
import org.eclipse.ui.PlatformUI;
import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation;
@@ -142,8 +141,7 @@
IStatus status = Status.OK_STATUS;
if (undoExtractInterfaceChange != null) {
try {
- PerformChangeOperation changeOperation = RefactoringUI
- .createUIAwareChangeOperation(undoExtractInterfaceChange);
+ PerformChangeOperation changeOperation = new PerformChangeOperation(undoExtractInterfaceChange);
WorkbenchRunnableAdapter adapter= new WorkbenchRunnableAdapter(changeOperation);
PlatformUI.getWorkbench().getProgressService().runInUI(
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/viewers/AnnotationColumnLabelProvider.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/viewers/AnnotationColumnLabelProvider.java
index e2826b4..a1846a8 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/viewers/AnnotationColumnLabelProvider.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/viewers/AnnotationColumnLabelProvider.java
@@ -62,7 +62,7 @@
IMethod method = (SourceMethod) element;
- if (annotationKey == CXFModelUtils.WEB_PARAM) {
+ if (annotationKey.equals(CXFModelUtils.WEB_PARAM)) {
List<SingleVariableDeclaration> parameters = AnnotationUtils.getMethodParameters(type,
method);
diff --git a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/WSDL2JavaConfigWidget.java b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/WSDL2JavaConfigWidget.java
index 734f6cc..3df308e 100644
--- a/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/WSDL2JavaConfigWidget.java
+++ b/bundles/org.eclipse.jst.ws.cxf.creation.ui/src/org/eclipse/jst/ws/internal/cxf/creation/ui/widgets/WSDL2JavaConfigWidget.java
@@ -256,9 +256,34 @@
TableViewerColumn packageNameViewerColumn = WSDL2JavaWidgetFactory.createPackageNameColumn(
packageNameTableViewer, model);
+
+ TextCellEditor textCellEditor = new TextCellEditor(packageNameTableViewer.getTable());
+ textCellEditor.addListener( new ICellEditorListener() {
+
+ public void editorValueChanged(boolean oldValidState, boolean newValidState) {
+ statusListener.handleEvent(null);
+ }
+
+ public void cancelEditor() {
+ }
+
+ public void applyEditorValue() {
+ }
+ });
+
+ textCellEditor.setValidator(new ICellEditorValidator() {
+
+ public String isValid(Object packageName) {
+ status = JDTUtils.validatePackageName(model.getProjectName(), packageName.toString());
+ if (status.getSeverity() == IStatus.OK) {
+ return null;
+ }
+ return status.getMessage();
+ }
+ });
packageNameViewerColumn.setEditingSupport(new PackageNameEditingSupport(packageNameTableViewer,
- new PackageNameTextCellEditor(packageNameTableViewer.getTable()), model));
+ textCellEditor, model));
columnWeightData = new ColumnWeightData(100, 100, true);
tableLayout.addColumnData(columnWeightData);
@@ -280,32 +305,4 @@
public IStatus getStatus() {
return status;
}
-
- private class PackageNameTextCellEditor extends TextCellEditor implements ICellEditorListener,
- ICellEditorValidator {
-
- public PackageNameTextCellEditor(Composite parent) {
- super(parent);
- addListener(this);
- setValidator(this);
- }
-
- public void applyEditorValue() {
- }
-
- public void cancelEditor() {
- }
-
- public void editorValueChanged(boolean oldValidState, boolean newValidState) {
- statusListener.handleEvent(null);
- }
-
- public String isValid(Object packageName) {
- status = JDTUtils.validatePackageName(model.getProjectName(), packageName.toString());
- if (status.getSeverity() == IStatus.OK) {
- return null;
- }
- return status.getMessage();
- }
- }
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameColumnLabelProvider.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameColumnLabelProvider.java
index 98d34b5..a02d54a 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameColumnLabelProvider.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameColumnLabelProvider.java
@@ -28,8 +28,8 @@
@Override
public String getText(Object element) {
- if (includedNamespaces.containsKey(element)) {
- return includedNamespaces.get(element);
+ if (includedNamespaces.containsKey(element.toString())) {
+ return includedNamespaces.get(element.toString());
}
return WSDLUtils.getPackageNameFromNamespace(element.toString());
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameEditingSupport.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameEditingSupport.java
index 5922c61..423f07d 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameEditingSupport.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameEditingSupport.java
@@ -52,8 +52,8 @@
@Override
protected Object getValue(Object element) {
- if (includedNamespaces.containsKey(element)) {
- return includedNamespaces.get(element);
+ if (includedNamespaces.containsKey(element.toString())) {
+ return includedNamespaces.get(element.toString());
}
return WSDLUtils.getPackageNameFromNamespace(element.toString());
}
diff --git a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameTableContentProvider.java b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameTableContentProvider.java
index bdfb63d..d070109 100644
--- a/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameTableContentProvider.java
+++ b/bundles/org.eclipse.jst.ws.cxf.ui/src/org/eclipse/jst/ws/internal/cxf/ui/viewers/PackageNameTableContentProvider.java
@@ -12,21 +12,22 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.List;
import java.util.Map;
import javax.wsdl.Definition;
-import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
/**
* @author sclarke
*/
-public class PackageNameTableContentProvider extends ArrayContentProvider {
+public class PackageNameTableContentProvider implements IStructuredContentProvider {
- @Override
@SuppressWarnings("unchecked")
public Object[] getElements(Object inputElement) {
- java.util.List<Object> elements = new ArrayList<Object>();
+ List<Object> elements = new ArrayList<Object>();
if (inputElement instanceof Definition) {
Definition definition = (Definition) inputElement;
Map namespaces = definition.getNamespaces();
@@ -41,4 +42,10 @@
return elements.toArray(new Object[elements.size()]);
}
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
}
diff --git a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/initialization/WebParamAttributeInitializer.java b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/initialization/WebParamAttributeInitializer.java
index 85ce82d..168e9ff 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/initialization/WebParamAttributeInitializer.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.core/src/org/eclipse/jst/ws/internal/jaxws/core/annotations/initialization/WebParamAttributeInitializer.java
@@ -22,6 +22,7 @@
import org.eclipse.jst.ws.annotations.core.AnnotationsCore;
import org.eclipse.jst.ws.annotations.core.initialization.AnnotationAttributeInitializer;
import org.eclipse.jst.ws.annotations.core.utils.AnnotationUtils;
+
/**
*
* @author sclarke
@@ -36,26 +37,30 @@
@Override
public List<MemberValuePair> getMemberValuePairs(ASTNode astNode, AST ast,
Class<? extends Annotation> annotationClass) {
-
List<MemberValuePair> memberValuePairs = new ArrayList<MemberValuePair>();
- MemberValuePair nameValuePair = AnnotationsCore.createStringMemberValuePair(ast, NAME,
+
+ if (astNode instanceof SingleVariableDeclaration) {
+ MemberValuePair nameValuePair = AnnotationsCore.createStringMemberValuePair(ast, NAME,
getName((SingleVariableDeclaration)astNode));
- memberValuePairs.add(nameValuePair);
-
+ memberValuePairs.add(nameValuePair);
+ }
return memberValuePairs;
}
public List<ICompletionProposal> getCompletionProposalsForMemberValuePair(ASTNode astNode,
MemberValuePair memberValuePair) {
+
List<ICompletionProposal> completionProposals = new ArrayList<ICompletionProposal>();
- String memberValuePairName = memberValuePair.getName().getIdentifier();
+ if (astNode instanceof SingleVariableDeclaration) {
+ String memberValuePairName = memberValuePair.getName().getIdentifier();
- if (memberValuePairName.equals(NAME)) {
- completionProposals.add(AnnotationUtils.createCompletionProposal(
+ if (memberValuePairName.equals(NAME)) {
+ completionProposals.add(AnnotationUtils.createCompletionProposal(
getName((SingleVariableDeclaration)astNode), memberValuePair.getValue()));
- }
- return completionProposals;
+ }
+ }
+ return completionProposals;
}
private String getName(SingleVariableDeclaration parameter) {
diff --git a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/annotations/contentassist/AnnotationCompletionProposalComputer.java b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/annotations/contentassist/AnnotationCompletionProposalComputer.java
index 5caaf87..bd38608 100644
--- a/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/annotations/contentassist/AnnotationCompletionProposalComputer.java
+++ b/bundles/org.eclipse.jst.ws.jaxws.ui/src/org/eclipse/jst/ws/internal/jaxws/ui/annotations/contentassist/AnnotationCompletionProposalComputer.java
@@ -60,7 +60,7 @@
@SuppressWarnings("unchecked")
private List<ICompletionProposal> computeCompletionProposals(JavaContentAssistInvocationContext context) {
CompletionContext completionContext = context.getCoreContext();
- int tokenStart = completionContext.getTokenStart();
+ int tokenStart = completionContext.getOffset();
ICompilationUnit source = context.getCompilationUnit();
try {
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 c2043d0..f1ea156 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
@@ -321,7 +321,7 @@
arrayValuesTableViewer.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
- if (element instanceof List) {
+ if (element instanceof List<?>) {
String annotationName = method.getReturnType().getComponentType().getSimpleName();
annotationName += "("; //$NON-NLS-1$
List<Map<String, Object>> valuesList = (List<Map<String, Object>>)element;
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 371137f..7b4f860 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
@@ -317,10 +317,11 @@
QualifiedName enumValue = (QualifiedName) memberValuePair
.getValue();
SimpleName literal = enumValue.getName();
+
Object[] enumConstants = method.getReturnType()
.getEnumConstants();
for (int i = 0; i < enumConstants.length; i++) {
- if (enumConstants[i].toString().equals(literal)) {
+ if (enumConstants[i].toString().equals(literal.getIdentifier())) {
return i;
}
}
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 a1d4066..ba965bf 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
@@ -140,7 +140,7 @@
annotationTreeViewer.setComparator(new ViewerComparator() {
@Override
public int compare(Viewer viewer, Object obj1, Object obj2) {
- if (obj1 instanceof Class) {
+ if (obj1 instanceof Class<?>) {
return AnnotationsManager.getAnnotationDefinitionForClass(obj1).getAnnotationClassName().
compareTo(AnnotationsManager.getAnnotationDefinitionForClass(obj2).
getAnnotationClassName());