mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Simplify API that opens the DebuggerConsole
IDebuggerConsoleManager.showConsoleView() was mimicked on IConsoleManager.showConsoleView() which allows to specify which console in the view should now be shown. This makes sense for the generic platform Console view where extenders could choose to display any kind of console when an event happens (e.g., a build console when the build is started). However, in our Debugger Console case, it complicates things unnecessarily. In our case, we want to be able to open the view, but the console to show is handled by other logic such as a synchronizer service. And if there is a need to change which console should be shown within the Debugger Console view, then IDebuggerConsoleView.display() should be used. I think having it in IConsoleManager.showConsoleView() is a shortcut that is not very useful in our case. Change-Id: Id66ea5c953e8a7ab603cfc23789a814c1ad821d2
This commit is contained in:
parent
b0833f9e0c
commit
d04019eacd
4 changed files with 6 additions and 20 deletions
|
@ -81,29 +81,21 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void showConsoleView(IDebuggerConsole console) {
|
||||
fShowDebuggerConsoleViewJob.setConsole(console);
|
||||
public void showConsoleView() {
|
||||
fShowDebuggerConsoleViewJob.schedule(100);
|
||||
}
|
||||
|
||||
private class ShowDebuggerConsoleViewJob extends WorkbenchJob {
|
||||
private IConsole fConsole;
|
||||
|
||||
ShowDebuggerConsoleViewJob() {
|
||||
super("Show GDB Console View"); //$NON-NLS-1$
|
||||
setSystem(true);
|
||||
setPriority(Job.SHORT);
|
||||
}
|
||||
|
||||
void setConsole(IConsole console) {
|
||||
fConsole = console;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStatus runInUIThread(IProgressMonitor monitor) {
|
||||
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
|
||||
IConsole c = fConsole;
|
||||
if (window != null && c != null) {
|
||||
if (window != null) {
|
||||
IWorkbenchPage page = window.getActivePage();
|
||||
if (page != null) {
|
||||
boolean consoleFound = false;
|
||||
|
@ -114,7 +106,6 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
|
|||
if (consoleVisible) {
|
||||
consoleFound = true;
|
||||
page.bringToTop(consoleView);
|
||||
consoleView.display(c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,14 +116,12 @@ public class DebuggerConsoleManager implements IDebuggerConsoleManager {
|
|||
null,
|
||||
IWorkbenchPage.VIEW_CREATE);
|
||||
page.bringToTop(consoleView);
|
||||
consoleView.display(c);
|
||||
} catch (PartInitException e) {
|
||||
CDebugUIPlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fConsole = null;
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -289,7 +289,7 @@ implements IConsoleView, IDebuggerConsoleView, IConsoleListener, IPropertyChange
|
|||
new PageSwitcher(this) {
|
||||
@Override
|
||||
public void activatePage(Object page) {
|
||||
getConsoleManager().showConsoleView((IDebuggerConsole)page);
|
||||
display((IDebuggerConsole)page);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,11 +52,8 @@ public interface IDebuggerConsoleManager {
|
|||
public IDebuggerConsole[] getConsoles();
|
||||
|
||||
/**
|
||||
* Opens the console view and displays given the console.
|
||||
* Opens the console view.
|
||||
* If the view is already open, it is brought to the front.
|
||||
* Has no effect if the given console is not currently registered.
|
||||
*
|
||||
* @param console console to display
|
||||
*/
|
||||
public void showConsoleView(IDebuggerConsole console);
|
||||
public void showConsoleView();
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class GdbCliConsoleManager implements ILaunchesListener2 {
|
|||
|
||||
addConsole(console);
|
||||
// Make sure the Debugger Console view is visible
|
||||
getDebuggerConsoleManager().showConsoleView(console);
|
||||
getDebuggerConsoleManager().showConsoleView();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue