mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 22:22:11 +02:00
Terminals: Keep context menu from being disposed if terminal is disposed
Related to Bug 458625.
This commit is contained in:
parent
5f9c9c21a2
commit
0b4533ee5d
3 changed files with 13 additions and 1 deletions
|
@ -54,7 +54,12 @@ public class TabDisposeListener implements DisposeListener {
|
||||||
if (e.getSource() instanceof CTabItem) {
|
if (e.getSource() instanceof CTabItem) {
|
||||||
// Get the terminal control (if any) from the tab item
|
// Get the terminal control (if any) from the tab item
|
||||||
Object candidate = ((CTabItem)e.getSource()).getData();
|
Object candidate = ((CTabItem)e.getSource()).getData();
|
||||||
if (candidate instanceof ITerminalViewControl) ((ITerminalViewControl)candidate).disposeTerminal();
|
if (candidate instanceof ITerminalViewControl) {
|
||||||
|
ITerminalViewControl terminal = (ITerminalViewControl)candidate;
|
||||||
|
// Keep the context menu from being disposed
|
||||||
|
terminal.getControl().setMenu(null);
|
||||||
|
terminal.disposeTerminal();
|
||||||
|
}
|
||||||
// Dispose the command input field handler
|
// Dispose the command input field handler
|
||||||
parentTabFolderManager.disposeTabCommandFieldHandler((CTabItem)e.getSource());
|
parentTabFolderManager.disposeTabCommandFieldHandler((CTabItem)e.getSource());
|
||||||
// Dispose the tab item control
|
// Dispose the tab item control
|
||||||
|
|
|
@ -378,6 +378,9 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
|
||||||
// Remember terminal state
|
// Remember terminal state
|
||||||
TerminalState oldState = terminal.getState();
|
TerminalState oldState = terminal.getState();
|
||||||
|
|
||||||
|
// Keep the context menu from being disposed
|
||||||
|
terminal.getControl().setMenu(null);
|
||||||
|
|
||||||
// change the "parent".
|
// change the "parent".
|
||||||
Assert.isTrue(terminal instanceof ITerminalControl);
|
Assert.isTrue(terminal instanceof ITerminalControl);
|
||||||
((ITerminalControl)terminal).setupTerminal(composite);
|
((ITerminalControl)terminal).setupTerminal(composite);
|
||||||
|
|
|
@ -371,6 +371,10 @@ public class TabFolderMenuHandler extends PlatformObject {
|
||||||
if (MenuManager.class.isAssignableFrom(adapter)) {
|
if (MenuManager.class.isAssignableFrom(adapter)) {
|
||||||
return contextMenuManager;
|
return contextMenuManager;
|
||||||
} else if (Menu.class.isAssignableFrom(adapter)) {
|
} else if (Menu.class.isAssignableFrom(adapter)) {
|
||||||
|
if (contextMenu != null && contextMenu.isDisposed()) {
|
||||||
|
// menu got disposed (should not happen)
|
||||||
|
contextMenu = contextMenuManager.createContextMenu(getTabFolder());
|
||||||
|
}
|
||||||
return contextMenu;
|
return contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue