mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
uses builder api to get include paths
This commit is contained in:
parent
5374d486e7
commit
2b119fa9e9
1 changed files with 19 additions and 36 deletions
|
@ -27,13 +27,14 @@ import org.eclipse.ui.IEditorDescriptor;
|
||||||
import org.eclipse.ui.IEditorRegistry;
|
import org.eclipse.ui.IEditorRegistry;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.core.CommonMkInfo;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.internal.ui.dialogs.ElementListSelectionDialog;
|
import org.eclipse.cdt.internal.ui.dialogs.ElementListSelectionDialog;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.internal.ui.CPlugin;
|
import org.eclipse.cdt.internal.ui.CPlugin;
|
||||||
import org.eclipse.cdt.internal.ui.CPluginImages;
|
import org.eclipse.cdt.internal.ui.CPluginImages;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.builder.ICBuilder;
|
||||||
import org.eclipse.cdt.core.model.CModelException;
|
import org.eclipse.cdt.core.model.CModelException;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
|
||||||
|
@ -83,25 +84,14 @@ public class OpenIncludeAction extends Action {
|
||||||
|
|
||||||
if (fileToOpen != null) {
|
if (fileToOpen != null) {
|
||||||
EditorUtility.openInEditor(fileToOpen);
|
EditorUtility.openInEditor(fileToOpen);
|
||||||
//IWorkbenchWindow window= CPlugin.getActiveWorkbenchWindow();
|
|
||||||
//if (window != null) {
|
|
||||||
// IWorkbenchPage p= window.getActivePage();
|
|
||||||
// if (p != null) {
|
|
||||||
// p.openEditor(fileToOpen);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
} else { // Try to get via the include path.
|
} else { // Try to get via the include path.
|
||||||
|
|
||||||
|
ICBuilder[] builders = CCorePlugin.getDefault().getBuilders(res.getProject());
|
||||||
CommonMkInfo mk = null;
|
|
||||||
if (res != null)
|
|
||||||
mk = new CommonMkInfo(res.getProject().getLocation());
|
|
||||||
else
|
|
||||||
mk = new CommonMkInfo();
|
|
||||||
IPath[] paths = mk.getIncludePaths();
|
|
||||||
|
|
||||||
|
|
||||||
IPath includePath = null;
|
IPath includePath = null;
|
||||||
|
for( int j = 0; includePath == null && j < builders.length; j++ ) {
|
||||||
|
IPath[] paths = builders[j].getIncludePaths();
|
||||||
|
|
||||||
for (int i = 0; i < paths.length; i++) {
|
for (int i = 0; i < paths.length; i++) {
|
||||||
if (res != null) {
|
if (res != null) {
|
||||||
// We've already scan the project.
|
// We've already scan the project.
|
||||||
|
@ -114,17 +104,10 @@ public class OpenIncludeAction extends Action {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (includePath != null) {
|
if (includePath != null) {
|
||||||
EditorUtility.openInEditor(includePath);
|
EditorUtility.openInEditor(includePath);
|
||||||
//IStorage s = new FileStorage(includePath);
|
|
||||||
//IEditorInput ei = new ExternalEditorInput(s);
|
|
||||||
//IWorkbenchWindow window= CPlugin.getActiveWorkbenchWindow();
|
|
||||||
//if (window != null) {
|
|
||||||
// IWorkbenchPage p = window.getActivePage();
|
|
||||||
// if (p != null) {
|
|
||||||
// p.openEditor(ei, getEditorID(include.getName()));
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (CModelException e) {
|
} catch (CModelException e) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue