mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
fixed console selection problem
This commit is contained in:
parent
e3d23e3704
commit
59a54c9689
1 changed files with 14 additions and 11 deletions
|
@ -340,38 +340,41 @@ public class BuildConsolePage extends Page
|
||||||
ISelection selection= null;
|
ISelection selection= null;
|
||||||
if (page != null)
|
if (page != null)
|
||||||
selection= page.getSelection();
|
selection= page.getSelection();
|
||||||
if (selection instanceof ITextSelection) {
|
|
||||||
Object part= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
|
if (convertSelectionToProject(selection) == null) {
|
||||||
if (part instanceof IEditorPart) {
|
if (selection instanceof ITextSelection) {
|
||||||
setSelectionFromEditor((IEditorPart)part);
|
Object part= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
|
||||||
return;
|
if (part instanceof IEditorPart) {
|
||||||
|
if (setSelectionFromEditor((IEditorPart)part) == true)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
selection = new StructuredSelection(getConsole().getConsoleManager().getLastBuiltProject());
|
||||||
}
|
}
|
||||||
selectionChanged(null, selection);
|
selectionChanged(null, selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void setSelectionFromEditor(IEditorPart part) {
|
boolean setSelectionFromEditor(IEditorPart part) {
|
||||||
if (part == null)
|
if (part == null)
|
||||||
return;
|
return false;
|
||||||
IWorkbenchPartSite site= part.getSite();
|
IWorkbenchPartSite site= part.getSite();
|
||||||
if (site == null)
|
if (site == null)
|
||||||
return;
|
return false;
|
||||||
ISelectionProvider provider= site.getSelectionProvider();
|
ISelectionProvider provider= site.getSelectionProvider();
|
||||||
if (provider != null ) {
|
if (provider != null ) {
|
||||||
IEditorInput ei= part.getEditorInput();
|
IEditorInput ei= part.getEditorInput();
|
||||||
if (ei instanceof IFileEditorInput) {
|
if (ei instanceof IFileEditorInput) {
|
||||||
IFile file= ((IFileEditorInput)ei).getFile();
|
IFile file= ((IFileEditorInput)ei).getFile();
|
||||||
selectionChanged(part, new StructuredSelection(file));
|
selectionChanged(part, new StructuredSelection(file));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
|
||||||
IProject newProject = convertSelectionToProject(selection);
|
IProject newProject = convertSelectionToProject(selection);
|
||||||
if (newProject == null) {
|
|
||||||
newProject = getConsole().getConsoleManager().getLastBuiltProject();
|
|
||||||
}
|
|
||||||
IProject oldProject = getProject();
|
IProject oldProject = getProject();
|
||||||
if (oldProject == null || (newProject != null && !newProject.equals(oldProject))) {
|
if (oldProject == null || (newProject != null && !newProject.equals(oldProject))) {
|
||||||
setProject(newProject);
|
setProject(newProject);
|
||||||
|
|
Loading…
Add table
Reference in a new issue