mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-13 12:05:21 +02:00
bug 237398: [terminal] Terminal get Invalid Thread Access when the title is set
https://bugs.eclipse.org/bugs/show_bug.cgi?id=237398
This commit is contained in:
parent
71933e44e7
commit
2f4da42db3
1 changed files with 20 additions and 4 deletions
|
@ -176,10 +176,18 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
onTerminalStatus();
|
onTerminalStatus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if(Thread.currentThread()==Display.getDefault().getThread())
|
runInDisplayThread(runnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param runnable run in display thread
|
||||||
|
*/
|
||||||
|
private void runInDisplayThread(Runnable runnable) {
|
||||||
|
if(Display.findDisplay(Thread.currentThread())!=null)
|
||||||
runnable.run();
|
runnable.run();
|
||||||
else
|
else if(PlatformUI.isWorkbenchRunning())
|
||||||
Display.getDefault().syncExec(runnable);
|
PlatformUI.getWorkbench().getDisplay().syncExec(runnable);
|
||||||
|
// else should not happen and we ignore it...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -287,7 +295,15 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalLi
|
||||||
fActionTerminalSettings.setEnabled(bEnabled);
|
fActionTerminalSettings.setEnabled(bEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTerminalTitle(String strTitle) {
|
public void setTerminalTitle(final String strTitle) {
|
||||||
|
runInDisplayThread(new Runnable() {
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
runSetTitle(strTitle);
|
||||||
|
}});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void runSetTitle(String strTitle) {
|
||||||
if (fCtlTerminal.isDisposed())
|
if (fCtlTerminal.isDisposed())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue