Revision: 621
http://cishell.svn.sourceforge.net/cishell/?rev=621&view=rev
Author: mwlinnem
Date: 2008-02-08 12:54:14 -0800 (Fri, 08 Feb 2008)
Log Message:
-----------
Scheduler now waits (for up to 1.5 seconds) to let the menu manager add the tools menu. Fixes race condition bug.
Modified Paths:
--------------
trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/Activator.java
Modified: trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/Activator.java
===================================================================
--- trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/Activator.java 2008-02-07 21:46:52 UTC (rev 620)
+++ trunk/clients/gui/org.cishell.reference.gui.scheduler/src/org/cishell/reference/gui/scheduler/Activator.java 2008-02-08 20:54:14 UTC (rev 621)
@@ -27,6 +27,9 @@
private static BundleContext context;
private boolean waitForBundleContext;
+ private static final int ATTEMPTS_TO_FIND_TOOLBAR = 15;
+ private static final int SLEEP_TIME = 100;
+
public Activator() {
plugin = this;
}
@@ -81,6 +84,17 @@
public void run() {
Action scheduler = new SchedulerAction();
IMenuManager manager = CIShellApplication.getMenuManager();
+
+ IMenuManager newManager = null;
+ for (int i = 0; i < ATTEMPTS_TO_FIND_TOOLBAR && newManager == null; i++) {
+ try {
+ Thread.sleep(SLEEP_TIME);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ newManager = manager.findMenuUsingPath("tools");
+ }
+
manager = manager.findMenuUsingPath("tools");
manager.appendToGroup("start", scheduler);
SchedulerView view = SchedulerView.getDefault();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|