else {
filter = new FlagsMethodFilter(FlagsMethodFilter.NOT_VOID
| FlagsMethodFilter.NOT_INTERFACE | FlagsMethodFilter.NOT_CONSTRUCTOR);
}
IContentAssistCalculator calculator = new MethodContentAssistCalculator(filter) {
@Override
public void computeProposals(IContentAssistContext context,
IContentAssistProposalRecorder recorder) {
super.computeProposals(context, recorder);
IType type = calculateType(context);
try {
// Add special valueOf methods for Enum types
if (type != null && type.isEnum()) {
IFile contextFile = context.getFile();
if (contextFile != null && contextFile.exists()) {
IType enumType = JdtUtils.getJavaType(context.getFile().getProject(), Enum.class.getName());
Set<String> proposedMethods = new HashSet<String>();
for (IMethod method : Introspector.findAllMethods(enumType, context
.getMatchString(), filter)) {
if (!proposedMethods.contains(method.getElementName())) {
proposedMethods.add(method.getElementName());
createMethodProposal(recorder, method);
}
}
}
}
}
catch (JavaModelException e) {
}
}
@Override
protected IType calculateType(IContentAssistContext context) {
if (file != null && file.exists()) {
return JdtUtils.getJavaType(file.getProject(), factoryClassName);
}
return null;
}
};
calculator.computeProposals(context, recorder);
}