1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Fix for PR 81007

This commit is contained in:
Alain Magloire 2004-12-14 22:29:22 +00:00
parent b5b9cb7f7d
commit ed57ae9e44

View file

@ -54,31 +54,33 @@ public class MakefileTextHover implements ITextHover {
if (fEditor != null && len > -1) { if (fEditor != null && len > -1) {
IWorkingCopyManager fManager = MakeUIPlugin.getDefault().getWorkingCopyManager(); IWorkingCopyManager fManager = MakeUIPlugin.getDefault().getWorkingCopyManager();
IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput()); IMakefile makefile = fManager.getWorkingCopy(fEditor.getEditorInput());
WordPartDetector wordPart = new WordPartDetector(textViewer, offset); if (makefile != null) {
String name = wordPart.toString(); WordPartDetector wordPart = new WordPartDetector(textViewer, offset);
IMacroDefinition[] statements = null; String name = wordPart.toString();
if (WordPartDetector.inMacro(textViewer, offset)) { IMacroDefinition[] statements = null;
statements = makefile.getMacroDefinitions(name); if (WordPartDetector.inMacro(textViewer, offset)) {
if (statements == null || statements.length == 0) { statements = makefile.getMacroDefinitions(name);
statements = makefile.getBuiltinMacroDefinitions(name); if (statements == null || statements.length == 0) {
statements = makefile.getBuiltinMacroDefinitions(name);
}
} }
}
if (statements == null) {
if (statements == null) { statements = new IMacroDefinition[0];
statements = new IMacroDefinition[0];
}
// iterate over all the different categories
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < statements.length; i++) {
if (i > 0) {
buffer.append("\n"); //$NON-NLS-1$
} }
String infoString = statements[i].getValue().toString(); // iterate over all the different categories
buffer.append(name); StringBuffer buffer = new StringBuffer();
buffer.append(" - "); //$NON-NLS-1$ for (int i = 0; i < statements.length; i++) {
buffer.append(infoString); if (i > 0) {
buffer.append("\n"); //$NON-NLS-1$
}
String infoString = statements[i].getValue().toString();
buffer.append(name);
buffer.append(" - "); //$NON-NLS-1$
buffer.append(infoString);
}
return buffer.toString();
} }
return buffer.toString();
} }
} catch (BadLocationException e) { } catch (BadLocationException e) {
} }