Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 270013 - Open Include action always displayed in the outline view in the Makefile editor
Summary: Open Include action always displayed in the outline view in the Makefile editor
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-editor (show other bugs)
Version: 5.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 6.0   Edit
Assignee: Anton Leherbauer CLA
QA Contact: Anton Leherbauer CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-25 14:28 EDT by Violaine Batthish CLA
Modified: 2013-05-24 12:37 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Violaine Batthish CLA 2009-03-25 14:28:21 EDT
To Reproduce:
1. Open a file in the Makefile editor
2. Right-click on any item that isn't an include directive.  The Open include direction action appears.

Looking at the code in org.eclipse.cdt.make.internal.ui.editor.OpenIncludeAction, the problem seems to be in canActionBeAdded:
	public boolean canActionBeAdded(ISelection selection) {
		return getIncludeDirective(selection) != null;
	}
Since getIncludeDirective will return an empty array in this scenario, the code should also check for array size:

	public boolean canActionBeAdded(ISelection selection) {
		IInclude[] includes =  getIncludeDirective(selection);
		return includes!=null && includes.length!=0;
	}
Comment 1 Anton Leherbauer CLA 2009-03-26 04:08:12 EDT
Of course you are right. I'll apply the suggested fix.
Comment 2 Anton Leherbauer CLA 2009-03-26 08:06:24 EDT
Fixed in 6.0 > 20090326.
Thanks for the contribution.