# HG changeset patch # User wpaul # Date 1244483487 18000 # Node ID b00fe900425287175148648bb0b7b626c47d2fdd # Parent 7357eeb2874f880d0401ba2c90bccc860ce091fa fixed bug #9228. diff -r 7357eeb2874f -r b00fe9004252 cdt/cdt_5_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java --- a/cdt/cdt_5_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java Fri Jun 05 16:58:02 2009 -0500 +++ b/cdt/cdt_5_0_x/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/executables/ExecutablesManager.java Mon Jun 08 12:51:27 2009 -0500 @@ -191,14 +191,29 @@ /** * Gets the list of executables in the workspace. + * @param wait whether or not to wait if the list is being refreshed when this + * method is called. when true, this call will not return until the list is + * complete. when false, it will return with the last known list. if calling + * from any UI, you should not block the UI waiting for this to return, but rather + * register as an {@link IExecutablesChangeListener} to get notifications when the + * list changes. * @return the list of executables which may be empty */ - public Collection getExecutables() { + public Collection getExecutables(boolean wait) { trace("getExecutables called at " + getStringFromTimestamp(System.currentTimeMillis())); List executables = new ArrayList(); + if (wait && refreshJob.getState() != Job.NONE) { + trace("waiting for refresh job to finish at " + getStringFromTimestamp(System.currentTimeMillis())); + try { + refreshJob.join(); + } catch (InterruptedException e) { + } + trace("refresh job finished at " + getStringFromTimestamp(System.currentTimeMillis())); + } + synchronized (executablesMap) { for (List exes : executablesMap.values()) { for (Executable exe : exes) { @@ -215,6 +230,15 @@ } /** + * Gets the list of executables in the workspace. Equivalent to {@link ExecutablesManager}{@link #getExecutables(false)}. + * Just kept for older API compatibility. + * @return the list of executables which may be empty + */ + public Collection getExecutables() { + return getExecutables(false); + } + + /** * Gets the collection of executables for the given project * @param project the project * @return collection of executables which may be empty