Skip to main content
summaryrefslogtreecommitdiffstats
path: root/launch
diff options
context:
space:
mode:
authorKen Ryall2009-09-05 13:08:20 -0400
committerKen Ryall2009-09-05 13:08:20 -0400
commit9e9d52e7dda8dbd9b6b121d679f6952c5aa4cc2e (patch)
tree396eb249df040b8866e43166760b370ac6ae67fe /launch
parentf70f6f0bb71967f95014b82c77254c4f999eed83 (diff)
downloadorg.eclipse.cdt-9e9d52e7dda8dbd9b6b121d679f6952c5aa4cc2e.tar.gz
org.eclipse.cdt-9e9d52e7dda8dbd9b6b121d679f6952c5aa4cc2e.tar.xz
org.eclipse.cdt-9e9d52e7dda8dbd9b6b121d679f6952c5aa4cc2e.zip
Bug 287057. Gets an ICElement from the IFileEditorInput so the context is
supplied correctly.
Diffstat (limited to 'launch')
-rw-r--r--launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
index 721048eb31..6a7732fd2d 100644
--- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
+++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java
@@ -19,6 +19,7 @@ import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin;
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -32,6 +33,7 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IWorkbenchPage;
public abstract class CLaunchConfigurationTab extends AbstractLaunchConfigurationTab {
@@ -109,10 +111,24 @@ public abstract class CLaunchConfigurationTab extends AbstractLaunchConfiguratio
return (ICElement)obj;
}
}
- IEditorPart part = page.getActiveEditor();
- if (part != null) {
- IEditorInput input = part.getEditorInput();
- return (ICElement)input.getAdapter(ICElement.class);
+ if (page != null)
+ {
+ IEditorPart part = page.getActiveEditor();
+ if (part != null) {
+ IEditorInput input = part.getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IFile file = ((IFileEditorInput)input).getFile();
+ if (file != null)
+ {
+ ICElement ce = CoreModel.getDefault().create(file);
+ if (ce == null) {
+ IProject pro = file.getProject();
+ ce = CoreModel.getDefault().create(pro);
+ }
+ return ce;
+ }
+ }
+ }
}
return null;
}

Back to the top