diff options
author | Ken Ryall | 2009-09-07 14:09:24 +0000 |
---|---|---|
committer | Ken Ryall | 2009-09-07 14:09:24 +0000 |
commit | ed41e9784a9be8b1f30cc1ad92e505815f4e87d1 (patch) | |
tree | f1d5cb7fafe0c2816211a850c2cd2e816c6add5b /launch/org.eclipse.cdt.launch | |
parent | 4c0e343b27b79f02247d7b3cb5d6c95a7993947f (diff) | |
download | org.eclipse.cdt-ed41e9784a9be8b1f30cc1ad92e505815f4e87d1.tar.gz org.eclipse.cdt-ed41e9784a9be8b1f30cc1ad92e505815f4e87d1.tar.xz org.eclipse.cdt-ed41e9784a9be8b1f30cc1ad92e505815f4e87d1.zip |
Bug 287057. Gets an ICElement from the selected IFileEditorInput
Diffstat (limited to 'launch/org.eclipse.cdt.launch')
-rw-r--r-- | launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CLaunchConfigurationTab.java | 24 |
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 721048eb316..6a7732fd2d4 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; } |