1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Terminals: Keep context menu from being disposed if terminal is disposed

Related to Bug 458625.
This commit is contained in:
Anton Leherbauer 2015-02-24 17:02:09 +01:00
parent 5f9c9c21a2
commit 0b4533ee5d
3 changed files with 13 additions and 1 deletions

View file

@ -54,7 +54,12 @@ public class TabDisposeListener implements DisposeListener {
if (e.getSource() instanceof CTabItem) {
// Get the terminal control (if any) from the tab item
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
parentTabFolderManager.disposeTabCommandFieldHandler((CTabItem)e.getSource());
// Dispose the tab item control

View file

@ -378,6 +378,9 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
// Remember terminal state
TerminalState oldState = terminal.getState();
// Keep the context menu from being disposed
terminal.getControl().setMenu(null);
// change the "parent".
Assert.isTrue(terminal instanceof ITerminalControl);
((ITerminalControl)terminal).setupTerminal(composite);

View file

@ -371,6 +371,10 @@ public class TabFolderMenuHandler extends PlatformObject {
if (MenuManager.class.isAssignableFrom(adapter)) {
return contextMenuManager;
} else if (Menu.class.isAssignableFrom(adapter)) {
if (contextMenu != null && contextMenu.isDisposed()) {
// menu got disposed (should not happen)
contextMenu = contextMenuManager.createContextMenu(getTabFolder());
}
return contextMenu;
}