mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-26 02:15:31 +02:00
[246406] Timeout waiting when loading RSE
This commit is contained in:
parent
1933ad6a5e
commit
b16efec856
4 changed files with 61 additions and 51 deletions
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
<!--
|
<?xml version="1.0" encoding="UTF-8"?>
<!--
|
||||||
Copyright (c) 2005, 2008 IBM Corporation and others.
|
Copyright (c) 2005, 2009 IBM Corporation and others.
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are made available under the terms of the Eclipse Public License v1.0
|
are made available under the terms of the Eclipse Public License v1.0
|
||||||
which accompanies this distribution, and is available at
|
which accompanies this distribution, and is available at
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
<feature
|
<feature
|
||||||
id="org.eclipse.rse.core"
|
id="org.eclipse.rse.core"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="3.1.0.qualifier"
|
version="3.1.1.qualifier"
|
||||||
provider-name="%providerName"
|
provider-name="%providerName"
|
||||||
plugin="org.eclipse.rse.core">
|
plugin="org.eclipse.rse.core">
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.rse.ui;singleton:=true
|
Bundle-SymbolicName: org.eclipse.rse.ui;singleton:=true
|
||||||
Bundle-Version: 3.1.0.qualifier
|
Bundle-Version: 3.1.1.qualifier
|
||||||
Bundle-Activator: org.eclipse.rse.ui.RSEUIPlugin
|
Bundle-Activator: org.eclipse.rse.ui.RSEUIPlugin
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
Require-Bundle: org.eclipse.core.runtime,
|
Require-Bundle: org.eclipse.core.runtime,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
* David McKnight (IBM) - [243263] NPE on expanding a filter
|
* David McKnight (IBM) - [243263] NPE on expanding a filter
|
||||||
* David McKnight (IBM) - [244454] SystemBasePlugin.getWorkBench() incorrectly returns null when called during Eclipse startup
|
* David McKnight (IBM) - [244454] SystemBasePlugin.getWorkBench() incorrectly returns null when called during Eclipse startup
|
||||||
* David McKnight (IBM) [246406] [performance] Timeout waiting when loading SystemPreferencesManager$ModelChangeListener during startup
|
* David McKnight (IBM) [246406] [performance] Timeout waiting when loading SystemPreferencesManager$ModelChangeListener during startup
|
||||||
|
* Martin Oberhuber (Wind River) - [246406] Timeout waiting when loading RSE
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui;
|
package org.eclipse.rse.ui;
|
||||||
|
@ -58,9 +59,13 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
// static variables
|
// static variables
|
||||||
private static SystemBasePlugin baseInst = null;
|
private static SystemBasePlugin baseInst = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logger object for logging messages for servicing purposes.
|
* Logger object for logging messages for servicing purposes.
|
||||||
*/
|
*
|
||||||
|
* @deprecated do not use use this directly, use {@link #getLogger()}
|
||||||
|
* instead for lazy loading of the Logger. We do not guarantee
|
||||||
|
* that this variable is ever initialized.
|
||||||
|
*/
|
||||||
protected static Logger log = null;
|
protected static Logger log = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -343,7 +348,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
boolean ok = false;
|
boolean ok = false;
|
||||||
try {
|
try {
|
||||||
URL url = bundle.getEntry("/"+fileName); //$NON-NLS-1$
|
URL url = bundle.getEntry("/"+fileName); //$NON-NLS-1$
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
mf = SystemUIMessageFile.getMessageFile(fileName, url);
|
mf = SystemUIMessageFile.getMessageFile(fileName, url);
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
@ -459,19 +464,19 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SystemMessage.ERROR:
|
case SystemMessage.ERROR:
|
||||||
log.logError(message.toString(), ex);
|
getBaseDefault().getLogger().logError(message.toString(), ex);
|
||||||
break;
|
break;
|
||||||
case SystemMessage.WARNING:
|
case SystemMessage.WARNING:
|
||||||
log.logWarning(message.toString(), ex);
|
getBaseDefault().getLogger().logWarning(message.toString(), ex);
|
||||||
break;
|
break;
|
||||||
case SystemMessage.INFORMATION:
|
case SystemMessage.INFORMATION:
|
||||||
case SystemMessage.COMPLETION:
|
case SystemMessage.COMPLETION:
|
||||||
log.logInfo(message.toString(), ex);
|
getBaseDefault().getLogger().logInfo(message.toString(), ex);
|
||||||
break;
|
break;
|
||||||
case SystemMessage.INQUIRY:
|
case SystemMessage.INQUIRY:
|
||||||
case SystemMessage.UNEXPECTED:
|
case SystemMessage.UNEXPECTED:
|
||||||
default:
|
default:
|
||||||
log.logInfo(message.toString(), ex);
|
getBaseDefault().getLogger().logInfo(message.toString(), ex);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,7 +493,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public static void logInfo(String message)
|
public static void logInfo(String message)
|
||||||
{
|
{
|
||||||
log.logInfo(message);
|
getBaseDefault().getLogger().logInfo(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------
|
// -----------------
|
||||||
|
@ -508,7 +513,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public static void logWarning(String message)
|
public static void logWarning(String message)
|
||||||
{
|
{
|
||||||
log.logWarning(message);
|
getBaseDefault().getLogger().logWarning(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -523,7 +528,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public static void logError(String message)
|
public static void logError(String message)
|
||||||
{
|
{
|
||||||
log.logError(message, null);
|
getBaseDefault().getLogger().logError(message, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -541,7 +546,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public static void logError(String message, Throwable exception)
|
public static void logError(String message, Throwable exception)
|
||||||
{
|
{
|
||||||
log.logError(message, exception);
|
getBaseDefault().getLogger().logError(message, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -556,7 +561,7 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public static void logDebugMessage(String prefix, String message)
|
public static void logDebugMessage(String prefix, String message)
|
||||||
{
|
{
|
||||||
log.logDebugMessage(prefix, message);
|
getBaseDefault().getLogger().logDebugMessage(prefix, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -609,11 +614,8 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
|
|
||||||
super.start(context);
|
super.start(context);
|
||||||
|
|
||||||
// logger
|
// // bug 246406: initialize the logger lazily
|
||||||
if (log == null) {
|
// getLogger();
|
||||||
log = LoggerFactory.getLogger(this);
|
|
||||||
log.logInfo("Loading " + this.getClass()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
|
|
||||||
addWindowListener();
|
addWindowListener();
|
||||||
}
|
}
|
||||||
|
@ -622,7 +624,9 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
* @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
|
||||||
*/
|
*/
|
||||||
public void stop(BundleContext context) throws Exception {
|
public void stop(BundleContext context) throws Exception {
|
||||||
logDebugMessage(this.getClass().getName(), "SHUTDOWN"); //$NON-NLS-1$
|
if (Logger.DEBUG) {
|
||||||
|
logDebugMessage(this.getClass().getName(), "SHUTDOWN"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
LoggerFactory.freeLogger(this);
|
LoggerFactory.freeLogger(this);
|
||||||
super.stop(context);
|
super.stop(context);
|
||||||
}
|
}
|
||||||
|
@ -739,12 +743,16 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an image descriptor from the base IDE. Looks only in the "icons/full/" directories.
|
* Returns an image descriptor from the base IDE. Looks only in the
|
||||||
|
* "icons/full/" directories.
|
||||||
*
|
*
|
||||||
* @see org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String)
|
* @deprecated use {@link org.eclipse.ui.ISharedImages} via
|
||||||
|
* PlatformUI.getWorkbench().getSharedImages()
|
||||||
*/
|
*/
|
||||||
public ImageDescriptor getImageDescriptorFromIDE(String relativePath)
|
public ImageDescriptor getImageDescriptorFromIDE(String relativePath)
|
||||||
{
|
{
|
||||||
|
// This code is from
|
||||||
|
// org.eclipse.ui.views.navigator.ResourceNavigatorActionGroup#getImageDescriptor(java.lang.String)
|
||||||
Hashtable registry = getImageDescriptorRegistry();
|
Hashtable registry = getImageDescriptorRegistry();
|
||||||
ImageDescriptor descriptor = (ImageDescriptor)registry.get(relativePath);
|
ImageDescriptor descriptor = (ImageDescriptor)registry.get(relativePath);
|
||||||
if (descriptor == null) {
|
if (descriptor == null) {
|
||||||
|
@ -778,6 +786,11 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
*/
|
*/
|
||||||
public Logger getLogger()
|
public Logger getLogger()
|
||||||
{
|
{
|
||||||
|
// logger
|
||||||
|
if (log == null) {
|
||||||
|
log = LoggerFactory.getLogger(this);
|
||||||
|
log.logInfo("Loading " + this.getClass()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
return log;
|
return log;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation. All rights reserved.
|
* Copyright (c) 2000, 2009 IBM Corporation. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* This program and the accompanying materials are made available under the terms
|
||||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -18,17 +18,14 @@
|
||||||
* 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()
|
* David McKnight (IBM) - [240991] Avoiding calling SystemBasePluging.getWorkbench()
|
||||||
|
* Martin Oberhuber (Wind River) - [246406] Timeout waiting when loading RSE
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
package org.eclipse.rse.ui;
|
package org.eclipse.rse.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
|
||||||
import org.eclipse.core.runtime.IStatus;
|
|
||||||
import org.eclipse.core.runtime.Preferences;
|
import org.eclipse.core.runtime.Preferences;
|
||||||
import org.eclipse.core.runtime.Status;
|
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
|
||||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||||
import org.eclipse.rse.core.RSECorePlugin;
|
import org.eclipse.rse.core.RSECorePlugin;
|
||||||
import org.eclipse.rse.core.events.ISystemModelChangeEvent;
|
import org.eclipse.rse.core.events.ISystemModelChangeEvent;
|
||||||
|
@ -39,8 +36,10 @@ import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
|
||||||
import org.eclipse.rse.core.events.ISystemResourceChangeListener;
|
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.osgi.framework.Bundle;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.BundleEvent;
|
||||||
|
import org.osgi.framework.BundleListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -493,28 +492,26 @@ public class SystemPreferencesManager {
|
||||||
|
|
||||||
if (!alreadyListening) {
|
if (!alreadyListening) {
|
||||||
// FIXME bug 240991: With the current workaround, we might miss events
|
// FIXME bug 240991: With the current workaround, we might miss events
|
||||||
// Instead of adding the listener deferred in a job, the SystemRegistry
|
// Instead of adding the listener deferred, the SystemRegistry
|
||||||
// should send events via the IRSEInteractionProvider
|
// should send events via the IRSEInteractionProvider
|
||||||
Job addListenerJob = new Job("Add Listener"){ //$NON-NLS-1$
|
Bundle bnd = RSEUIPlugin.getDefault().getBundle();
|
||||||
public IStatus run(IProgressMonitor monitor){
|
if (bnd.getState() == Bundle.ACTIVE) {
|
||||||
while (!PlatformUI.isWorkbenchRunning()){
|
// addListenerJob.schedule();
|
||||||
try {
|
fModelChangeListener = new ModelChangeListener();
|
||||||
//Checks in the loop are fast enough so we can poll often
|
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
|
||||||
Thread.sleep(100);
|
} else {
|
||||||
|
final BundleContext ctx = bnd.getBundleContext();
|
||||||
|
ctx.addBundleListener(new BundleListener() {
|
||||||
|
public void bundleChanged(BundleEvent event) {
|
||||||
|
if (event.getType() == BundleEvent.STARTED) {
|
||||||
|
// addListenerJob.schedule();
|
||||||
|
fModelChangeListener = new ModelChangeListener();
|
||||||
|
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
|
||||||
|
ctx.removeBundleListener(this);
|
||||||
}
|
}
|
||||||
catch (InterruptedException e){}
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
IWorkbench wb = PlatformUI.getWorkbench();
|
}
|
||||||
if (!wb.isClosing()) {
|
|
||||||
fModelChangeListener = new ModelChangeListener();
|
|
||||||
RSECorePlugin.getTheSystemRegistry().addSystemModelChangeListener(fModelChangeListener);
|
|
||||||
}
|
|
||||||
return Status.OK_STATUS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
addListenerJob.setSystem(true);
|
|
||||||
addListenerJob.schedule();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue