Index: org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtils.java =================================================================== --- org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtils.java (revision 32289) +++ org.jboss.tools.ws.jaxrs.core/src/org/jboss/tools/ws/jaxrs/core/utils/JdtUtils.java (working copy) @@ -252,12 +252,15 @@ * the progress monitor * @return compilationUnit the DOM CompilationUnit returned by the parse() * method. This operation is expensive and should be performed only - * once for each type. + * once for each type. Returns null if the given member was null. * @throws JavaModelException * in case of exception underneath... */ public static CompilationUnit parse(final IMember member, final IProgressMonitor progressMonitor) throws JavaModelException { + if (member == null) { + return null; + } IType type = null; if (member.getElementType() == IMember.TYPE) { type = (IType) member; Index: org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java =================================================================== --- org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java (revision 32289) +++ org.jboss.tools.ws.jaxrs.ui/src/org/jboss/tools/ws/jaxrs/ui/contentassist/PathParamAnnotationValueCompletionProposalComputer.java (working copy) @@ -21,6 +21,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.IJavaElement; +import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.IType; @@ -40,6 +41,7 @@ import org.eclipse.jface.text.contentassist.IContextInformation; import org.eclipse.jface.viewers.StyledString; import org.eclipse.swt.graphics.Image; +import org.jboss.tools.ws.jaxrs.core.configuration.ProjectNatureUtils; import org.jboss.tools.ws.jaxrs.core.utils.JdtUtils; import org.jboss.tools.ws.jaxrs.ui.JBossJaxrsUIPlugin; import org.jboss.tools.ws.jaxrs.ui.internal.utils.Logger; @@ -78,7 +80,16 @@ final IProgressMonitor monitor) { JavaContentAssistInvocationContext javaContext = (JavaContentAssistInvocationContext) context; try { + + IJavaProject project = javaContext.getProject(); + // skip if the JAX-RS Nature is not configured for this project + if (!ProjectNatureUtils.isProjectNatureInstalled(project.getProject(), ProjectNatureUtils.JAXRS_NATURE_ID)) { + return Collections.emptyList(); + } CompilationUnit compilationUnit = resolveContextualCompilationUnit(monitor, javaContext); + if (compilationUnit == null) { + return Collections.emptyList(); + } IJavaElement invocationElement = javaContext.getCompilationUnit().getElementAt( context.getInvocationOffset()); if (invocationElement.getElementType() == IJavaElement.METHOD) { @@ -222,6 +233,11 @@ * in case of underlying exception */ private IType getEnclosingType(final IJavaElement element) throws JavaModelException { + if (element == null) { + // no enclosing parent. For example, an annotation is set before the + // method itself was written. + return null; + } switch (element.getElementType()) { case IJavaElement.TYPE: return (IType) element;