1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-05 15:25:49 +02:00

[240991] Avoiding calling SystemBasePluging.getWorkbench()

This commit is contained in:
David McKnight 2008-08-18 20:40:24 +00:00
parent e23792271f
commit 065c58167f

View file

@ -17,6 +17,7 @@
* Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core * Martin Oberhuber (Wind River) - [215820] Move SystemRegistry implementation to Core
* David McKnight (IBM) - [237300] Problem with setDefaultHistory for SystemHistoryCombo. * David McKnight (IBM) - [237300] Problem with setDefaultHistory for SystemHistoryCombo.
* David McKnight (IBM) - [240991] RSE startup creates display on worker thread before workbench. * David McKnight (IBM) - [240991] RSE startup creates display on worker thread before workbench.
* David McKnight (IBM) - [240991] Avoiding calling SystemBasePluging.getWorkbench()
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui; package org.eclipse.rse.ui;
@ -39,6 +40,7 @@ import org.eclipse.rse.core.events.ISystemResourceChangeListener;
import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
/** /**
* A utility class that encapsulates all global preferences for the remote system framework * A utility class that encapsulates all global preferences for the remote system framework
@ -495,14 +497,15 @@ public class SystemPreferencesManager {
// should send events via the IRSEInteractionProvider // should send events via the IRSEInteractionProvider
Job addListenerJob = new Job("Add Listener"){ //$NON-NLS-1$ Job addListenerJob = new Job("Add Listener"){ //$NON-NLS-1$
public IStatus run(IProgressMonitor monitor){ public IStatus run(IProgressMonitor monitor){
IWorkbench wb = RSEUIPlugin.getDefault().getWorkbench(); while (!PlatformUI.isWorkbenchRunning()){
while (wb.getDisplay() == null && !wb.isClosing()) {
try { try {
//Checks in the loop are fast enough so we can poll often //Checks in the loop are fast enough so we can poll often
Thread.sleep(100); Thread.sleep(100);
} }
catch (InterruptedException e){} catch (InterruptedException e){}
} }
IWorkbench wb = PlatformUI.getWorkbench();
if (!wb.isClosing()) { if (!wb.isClosing()) {
fModelChangeListener = new ModelChangeListener(); fModelChangeListener = new ModelChangeListener();
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener); RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);