if (beanNode == null || text == null || messageText == null || document == null) {
return;
}
if (showErrorMessage) {
IMessage message = new LocalizedMessage(severity, messageText);
message.setOffset(offset);
message.setLength(length);
try {
message.setLineNo(document.getLineOfOffset(offset) + 1);
}
catch (BadLocationException e) {
message.setLineNo(-1);
}
reporter.addMessage(this, message);
}
// TODO: investigate better way to make suggestion works for the last
// position
// messageEmpty does not show up in the editor, it is only
// used for showing quick assist in the last cursor position
IMessage messageEmpty = new LocalizedMessage(IMessage.ALL_MESSAGES, messageText);
messageEmpty.setOffset(emptyMsgOffset);
messageEmpty.setLength(emptyMsgLength);
try {
messageEmpty.setLineNo(document.getLineOfOffset(offset) + 1);
}
catch (BadLocationException e) {
messageEmpty.setLineNo(-1);
}
if (reporter instanceof IncrementalReporter) {
BeanQuickAssistProcessor processor = quickfixFactory.create(offset, length, text, missingEndQuote,
beanNode, this, problemId, problemAttributes);
if (processor != null) {
messageEmpty.setAttribute(IQuickAssistProcessor.class.getName(), processor);
AnnotationInfo info = new QuickfixAnnotationInfo(messageEmpty);
IncrementalReporter incrementalReporter = (IncrementalReporter) reporter;
AnnotationInfo[] existingInfos = incrementalReporter.getAnnotationInfo();
for (AnnotationInfo existingInfo : existingInfos) {
IMessage existingMessage = existingInfo.getMessage();
if (existingMessage.getOffset() != messageEmpty.getOffset()) {
continue;
}
if (!existingMessage.getText().equals(messageEmpty.getText())) {
continue;
}
Object existingProcessor = existingMessage.getAttribute(IQuickAssistProcessor.class.getName());
if (existingProcessor != null && existingProcessor.equals(processor)) {
return;
}
}