Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2013-07-04 19:50:35 +0000
committerAndrew Gvozdev2013-07-04 19:50:35 +0000
commitd1e966b06e3dfb9e0579c58f380735b7c295e7e4 (patch)
treed9cd27e0b50d2b555f2ecd40dc08600a77db569d /build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor
parent54665cdb60b6de1a9159532e8b5891f62dbae69d (diff)
downloadorg.eclipse.cdt-d1e966b06e3dfb9e0579c58f380735b7c295e7e4.tar.gz
org.eclipse.cdt-d1e966b06e3dfb9e0579c58f380735b7c295e7e4.tar.xz
org.eclipse.cdt-d1e966b06e3dfb9e0579c58f380735b7c295e7e4.zip
Bug 412250: Makefile Editor won't open include with F3
Diffstat (limited to 'build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor')
-rw-r--r--build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
index 8d783d2adc1..439aae3b886 100644
--- a/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
+++ b/build/org.eclipse.cdt.make.ui/src/org/eclipse/cdt/make/internal/ui/editor/OpenDeclarationAction.java
@@ -10,8 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.make.internal.ui.editor;
+import java.net.URI;
+import java.util.Arrays;
+
import org.eclipse.cdt.make.core.makefile.IDirective;
import org.eclipse.cdt.make.core.makefile.IMakefile;
+import org.eclipse.cdt.make.core.makefile.gnu.IInclude;
import org.eclipse.cdt.make.internal.ui.MakeUIPlugin;
import org.eclipse.cdt.make.internal.ui.text.WordPartDetector;
import org.eclipse.cdt.make.ui.IWorkingCopyManager;
@@ -50,13 +54,36 @@ public class OpenDeclarationAction extends TextEditorAction {
try {
ITextSelection textSelection = (ITextSelection) provider.getSelection();
int offset = textSelection.getOffset();
- WordPartDetector wordPart = new WordPartDetector(doc, textSelection.getOffset());
+ WordPartDetector wordPart = new WordPartDetector(doc, offset);
String name = wordPart.toString();
if (WordPartDetector.inMacro(doc, offset)) {
directives = makefile.getMacroDefinitions(name);
if (directives.length == 0) {
directives = makefile.getBuiltinMacroDefinitions(name);
}
+ } else if (wordPart.isIncludeDirective()) {
+ String incFile = wordPart.getIncludedFile();
+ incFile = makefile.expandString(incFile, true);
+ for (IDirective dir : makefile.getDirectives()) {
+ if (dir instanceof IInclude) {
+ IInclude includeDirective = (IInclude) dir;
+ if (Arrays.asList(((IInclude) dir).getFilenames()).contains(incFile)) {
+ IDirective[] includedMakefiles = includeDirective.getDirectives();
+ for (IDirective includedMakefileDir : includedMakefiles) {
+ if (includedMakefileDir instanceof IMakefile) {
+ IMakefile includedMakefile = (IMakefile) includedMakefileDir;
+ URI uri = includedMakefile.getFileURI();
+ // endsWith() is potentially inaccurate but IInclude does not provide better way
+ if (uri != null && uri.toString().endsWith(incFile)) {
+ directives = new IDirective[1];
+ directives[0] = includedMakefileDir;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
} else {
directives = makefile.getTargetRules(name);
}

Back to the top