Merge "Issue #1522 - disable Spring during installs and uninstalls" into development

Former-commit-id: de2829de069a3f3280b25fd8a8b7b831377aaebc
This commit is contained in:
Steve Harris 2013-01-25 16:02:47 -06:00 committed by Gerrit Code Review
commit ffb536cd46

View file

@ -16,6 +16,7 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.eclipse.core.runtime.Platform;
/**
*
@ -30,6 +31,8 @@ import org.osgi.framework.Constants;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 12, 2010 mschenke Initial creation
* Jan 24, 2013 1522 bkowal Halt initialization if a p2 installation
* has been started
*
* </pre>
*
@ -62,6 +65,9 @@ public class Activator implements BundleActivator {
* org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
if (this.isInstallOperation()) {
return;
}
plugin = this;
Map<String, OSGIXmlApplicationContext> contextMap = new HashMap<String, OSGIXmlApplicationContext>();
@ -167,4 +173,30 @@ public class Activator implements BundleActivator {
public static Activator getDefault() {
return plugin;
}
/**
* Based on the command line arguments, determine whether or not an Eclipse
* p2 repository will be installed
*
* @return true if an Eclipse p2 repository is going to be installed, false
* otherwise
*/
private boolean isInstallOperation() {
final String P2_DIRECTOR = "org.eclipse.equinox.p2.director";
/**
* We look at the command line arguments instead of the program
* arguments (com.raytheon.uf.viz.application.ProgramArguments) because
* the command line arguments include almost everything that was passed
* as an argument to the Eclipse executable instead of just what CAVE is
* interested in.
*/
for (String argument : Platform.getCommandLineArgs()) {
if (P2_DIRECTOR.equals(argument)) {
return Boolean.TRUE;
}
}
return Boolean.FALSE;
}
}