1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 303808: DebuggerConsole shall not be automatically brought to top

The DebuggerConsoleView may be interfering with other views while
bringing it to the top. This is not desirable as many users may not need
to access the features of the GDB CLI.

With this change the view will be shown but not automatically brought up
to the top, so users can find it and select it as needed.

Change-Id: I6a26f3a39d43732659d1db4e1aeb77f3c9e399d9
Signed-off-by: Alvaro Sanchez-Leon <alvsan09@gmail.com>
This commit is contained in:
Alvaro Sanchez-Leon 2016-09-22 11:19:43 -04:00 committed by Marc Khouzam
parent d04019eacd
commit cb27913c43
3 changed files with 45 additions and 4 deletions

View file

@ -41,6 +41,7 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
/** A list of listeners registered for notifications of changes to consoles */
private ListenerList<IConsoleListener> fConsoleListeners = new ListenerList<>();
private OpenDebuggerConsoleViewJob fOpenDebuggerConsoleViewJob = new OpenDebuggerConsoleViewJob();
private ShowDebuggerConsoleViewJob fShowDebuggerConsoleViewJob = new ShowDebuggerConsoleViewJob();
@Override
@ -85,6 +86,11 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
fShowDebuggerConsoleViewJob.schedule(100);
}
@Override
public void openConsoleView() {
fOpenDebuggerConsoleViewJob.schedule(100);
}
private class ShowDebuggerConsoleViewJob extends WorkbenchJob {
ShowDebuggerConsoleViewJob() {
super("Show GDB Console View"); //$NON-NLS-1$
@ -125,4 +131,33 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
return Status.OK_STATUS;
}
}
private class OpenDebuggerConsoleViewJob extends WorkbenchJob {
OpenDebuggerConsoleViewJob() {
super("Open GDB Console View"); //$NON-NLS-1$
setSystem(true);
setPriority(Job.SHORT);
}
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
if (page != null) {
IViewPart view = page.findView(DebuggerConsoleView.DEBUGGER_CONSOLE_VIEW_ID);
if (view == null) {
try {
page.showView(DebuggerConsoleView.DEBUGGER_CONSOLE_VIEW_ID,
null,
IWorkbenchPage.VIEW_CREATE);
} catch (PartInitException e) {
CDebugUIPlugin.log(e);
}
}
}
}
return Status.OK_STATUS;
}
}
}

View file

@ -52,8 +52,14 @@ public interface IDebuggerConsoleManager {
public IDebuggerConsole[] getConsoles();
/**
* Opens the console view.
* If the view is already open, it is brought to the front.
* Shows the console view, by opening it if necessary.
* Once open, or if the view was already open, it is brought to the front.
*/
public void showConsoleView();
/**
* Opens the console view but does not bring it to the front.
* Does nothing if the view is already open.
*/
public void openConsoleView();
}

View file

@ -198,8 +198,8 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
}
addConsole(console);
// Make sure the Debugger Console view is visible
getDebuggerConsoleManager().showConsoleView();
// Make sure the Debugger Console view is visible but do not force it to the top
getDebuggerConsoleManager().openConsoleView();
}
}