MacroInstance instance = (MacroInstance) item;
int index = instance.getName().indexOf(LexicalConstants.PERIOD);
if (index > 0) {
// it is from a macro library
String namespace = instance.getName().substring(0, index);
MacroLibrary macroLibrary = ConfigurationManager.getInstance(editor.getProject()).getMacroLibrary(namespace);
if (null != macroLibrary) {
MacroDirective[] macros = macroLibrary.getMacros();
if (null != macros) {
for (MacroDirective macro : macros) {
if (macro.getName().equals(instance.getName())) {
// we have a match
return new IHyperlink[]{new MacroHyperlink(
instance, macroLibrary.getFile(),
macro.getOffset(), macro.getLength())};
}
}
}
}
if (null != macroLibrary)
return new IHyperlink[]{new MacroHyperlink(instance, macroLibrary.getFile(), -1, -1)};
}
else {
List<MacroDirective> macroDefinitions = instance.getItemSet().getMacroDefinitions();
for (Iterator<MacroDirective> i=macroDefinitions.iterator(); i.hasNext(); ) {
MacroDirective macroDefinition = i.next();