true);
for (int i = 0; i < values.length; i++) {
context.put(values[i].name, values[i].objClass);
}
Item directive = directiveSet.getSelectedItem(offset);
if (null != directive) {
return directive.getCompletionProposals(offset, context);
} else {
// we might be starting something
Item item = editor.getItemSet().getPreviousItem(offset);
int topOffset = 0;
if (null != item)
topOffset = item.getRegion().getOffset()
+ item.getRegion().getLength();
// check for directives and macro calls
try {
for (int i = offset - 1; i >= topOffset; i--) {
char c = editor.getDocument().getChar(i);
if (c == LexicalConstants.RIGHT_ANGLE_BRACKET || c == LexicalConstants.RIGHT_SQUARE_BRACKET)
break;
if (c == LexicalConstants.LEFT_ANGLE_BRACKET || c == LexicalConstants.LEFT_SQUARE_BRACKET) {
if (editor.getDocument().getLength() > i) {
char c2 = editor.getDocument().getChar(i + 1);
if (c2 == LexicalConstants.HASH) {
CompletionDirective completionDirective = new CompletionDirective(
editor.getItemSet(), i, offset - i,
(ISourceViewer) viewer,
(IResource) editor.getFile());
return completionDirective
.getCompletionProposals(offset,
context);
} else if (c2 == LexicalConstants.AT) {
CompletionMacroInstance completionMacroInstance = new CompletionMacroInstance(
editor.getItemSet(), editor
.getDocument().get(i,
offset - i), i,
editor.getFile());
return completionMacroInstance
.getCompletionProposals(offset,
context);
} else if (c2 == LexicalConstants.SLASH) {
if (editor.getDocument().getLength() < i + 3
|| editor.getDocument().getChar(
i + 2) == LexicalConstants.SPACE
|| editor.getDocument().getChar(
i + 2) == LexicalConstants.CR
|| editor.getDocument().getChar(
i + 2) == LexicalConstants.LF) {
Item stackItem = editor.getItemSet()
.getPreviousStartItem(offset);
StringBuilder value = new StringBuilder();
if (null != stackItem
&& stackItem instanceof MacroInstance)
value.append(LexicalConstants.AT);
else
value.append(LexicalConstants.HASH);
String name = null;
if (null != stackItem)
name = stackItem.getFirstToken();
if (null != name)
value.append(name);
if (c == LexicalConstants.LEFT_ANGLE_BRACKET)
value.append(LexicalConstants.RIGHT_ANGLE_BRACKET);
else