mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 08:45:44 +02:00
[244454] SystemBasePlugin.getWorkBench() incorrectly returns null when called during Eclipse startup
This commit is contained in:
parent
584b6cdccf
commit
e23792271f
1 changed files with 14 additions and 28 deletions
|
@ -14,6 +14,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
* Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
|
||||||
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
* Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
|
||||||
* 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
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.ui;
|
package org.eclipse.rse.ui;
|
||||||
|
@ -62,8 +63,6 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
|
|
||||||
// instance variables
|
// instance variables
|
||||||
private Hashtable imageDescriptorRegistry = null;
|
private Hashtable imageDescriptorRegistry = null;
|
||||||
private boolean headless;
|
|
||||||
private boolean headlessSet;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the singleton object representing the base plugin.
|
* Returns the singleton object representing the base plugin.
|
||||||
|
@ -496,9 +495,6 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
if (baseInst == null) {
|
if (baseInst == null) {
|
||||||
baseInst = this;
|
baseInst = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
headless = false;
|
|
||||||
headlessSet = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ------------------------
|
// ------------------------
|
||||||
|
@ -571,31 +567,13 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
public IWorkbench getWorkbench()
|
public IWorkbench getWorkbench()
|
||||||
{
|
{
|
||||||
IWorkbench wb = null;
|
IWorkbench wb = null;
|
||||||
if (headlessSet && headless) // already been here?
|
|
||||||
return wb;
|
|
||||||
try {
|
try {
|
||||||
wb = PlatformUI.getWorkbench();
|
wb = PlatformUI.getWorkbench();
|
||||||
|
|
||||||
//wb = super.getWorkbench();
|
|
||||||
headless = false;
|
|
||||||
}
|
}
|
||||||
catch (Exception exc)
|
catch (Exception exc)
|
||||||
{
|
{
|
||||||
/*
|
// workbench not created yet
|
||||||
IDEWorkbenchAdvisor advisor = new IDEWorkbenchAdvisor();
|
|
||||||
PlatformUI.createAndRunWorkbench(Display.getDefault(), advisor);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
wb = super.getWorkbench();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
headless = true;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
headless = true;
|
|
||||||
}
|
|
||||||
headlessSet = true;
|
|
||||||
return wb;
|
return wb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,11 +711,19 @@ public abstract class SystemBasePlugin extends AbstractUIPlugin
|
||||||
/**
|
/**
|
||||||
* Return true if we are running in a headless environment. We equate this
|
* Return true if we are running in a headless environment. We equate this
|
||||||
* to mean that the workbench is not running.
|
* to mean that the workbench is not running.
|
||||||
|
*
|
||||||
|
* @deprecated this method is useless right now because SystemBasePlugin is part of
|
||||||
|
* the rse.ui plugin which depends on workbench and therefore we can never load this
|
||||||
|
* class while actually being in headless mode. Normally this should return false
|
||||||
|
* however, because the javadoc says we "equate this to mean that the workbench is not running",
|
||||||
|
* it's possible early on that the method may return true if the workbench has not
|
||||||
|
* yet been instantiated - although it will later return false.
|
||||||
*/
|
*/
|
||||||
public boolean isHeadless()
|
public boolean isHeadless()
|
||||||
{
|
{
|
||||||
if (!headlessSet)
|
if (getWorkbench() == null){
|
||||||
getWorkbench();
|
return true;
|
||||||
return headless;
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue