mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 06:45:43 +02:00
[240991] Avoid adding change listener when Workbench is already closing
This commit is contained in:
parent
5a9c8dc1f4
commit
0e39dbbba8
2 changed files with 46 additions and 37 deletions
|
@ -1617,12 +1617,16 @@ public class SystemRegistry implements ISystemRegistry
|
|||
throw lastException;
|
||||
}
|
||||
IHost host = op.getHost();
|
||||
if (modelListenerManager.hasListeners()) {
|
||||
ISubSystem[] subsystems = op.getSubSystems();
|
||||
FireNewHostEvents fire = new FireNewHostEvents(host, subsystems, sr);
|
||||
if (modelListenerManager.hasListeners())
|
||||
// FIXME bug 240991: With the current workaround, we might miss events
|
||||
// in SystemPreferencesManager. Instead of Display.getDefault(),
|
||||
// we should use the IRSEInteractionProvider here.
|
||||
Display.getDefault().asyncExec(fire);
|
||||
}
|
||||
|
||||
////Listening to FireNewHostEvents now
|
||||
// //SystemPreferencesManager listens itself to FireNewHostEvents now
|
||||
//SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
return host;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.rse.core.RSECorePlugin;
|
|||
import org.eclipse.rse.core.events.ISystemModelChangeEvent;
|
||||
import org.eclipse.rse.core.events.ISystemModelChangeEvents;
|
||||
import org.eclipse.rse.core.events.ISystemModelChangeListener;
|
||||
import org.eclipse.rse.core.events.ISystemRemoteChangeEvents;
|
||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvent;
|
||||
import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
||||
import org.eclipse.rse.core.events.ISystemResourceChangeListener;
|
||||
|
@ -491,17 +490,23 @@ public class SystemPreferencesManager {
|
|||
}
|
||||
|
||||
if (!alreadyListening) {
|
||||
// FIXME bug 240991: With the current workaround, we might miss events
|
||||
// Instead of adding the listener deferred in a job, the SystemRegistry
|
||||
// should send events via the IRSEInteractionProvider
|
||||
Job addListenerJob = new Job("Add Listener"){ //$NON-NLS-1$
|
||||
public IStatus run(IProgressMonitor monitor){
|
||||
IWorkbench wb = RSEUIPlugin.getDefault().getWorkbench();
|
||||
while (wb.getDisplay() == null) {
|
||||
while (wb.getDisplay() == null && !wb.isClosing()) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
//Checks in the loop are fast enough so we can poll often
|
||||
Thread.sleep(100);
|
||||
}
|
||||
catch (InterruptedException e){}
|
||||
}
|
||||
if (!wb.isClosing()) {
|
||||
fModelChangeListener = new ModelChangeListener();
|
||||
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue