Skip to content

Commit

Permalink
Makes sure the search for display views happens in the right thread
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Feb 28, 2022
1 parent bfab2b5 commit dfbb06b
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ummisco.gama.ui.shared/src/ummisco/gama/ui/utils/ViewsHelper.java
@@ -1,12 +1,12 @@
/*******************************************************************************************************
*
* ViewsHelper.java, in ummisco.gama.ui.shared, is part of the source code of the
* GAMA modeling and simulation platform (v.1.8.2).
* ViewsHelper.java, in ummisco.gama.ui.shared, is part of the source code of the GAMA modeling and simulation platform
* (v.1.8.2).
*
* (c) 2007-2022 UMI 209 UMMISCO IRD/SU & Partners (IRIT, MIAT, TLU, CTU)
*
* Visit https://github.com/gama-platform/gama for license information and contacts.
*
*
********************************************************************************************************/
package ummisco.gama.ui.utils;

Expand Down Expand Up @@ -166,11 +166,13 @@ public static List<IDisplaySurface> allDisplaySurfaces() {
* @return the i display surface
*/
public static IDisplaySurface frontmostDisplaySurface() {
IViewPart view = findFrontmostGamaViewUnderMouse();
if (view instanceof IGamaView.Display) return ((IGamaView.Display) view).getDisplaySurface();
List<IDisplaySurface> surfaces = allDisplaySurfaces();
if (surfaces.size() == 0) return null;
return surfaces.get(0);
return WorkbenchHelper.run(() -> {
IViewPart view = findFrontmostGamaViewUnderMouse();
if (view instanceof IGamaView.Display) return ((IGamaView.Display) view).getDisplaySurface();
List<IDisplaySurface> surfaces = allDisplaySurfaces();
if (surfaces.size() == 0) return null;
return surfaces.get(0);
});
}

/**
Expand Down

0 comments on commit dfbb06b

Please sign in to comment.