Skip to content
Snippets Groups Projects
Commit af331514 authored by Simon Barner's avatar Simon Barner
Browse files

Ensure that UI is updated from the right thread

parent cdf53ac2
No related branches found
No related tags found
No related merge requests found
ApplicationActionBarAdvisor.java 3e7c0fd992586e6ca7724b871eb0b2cf59244028 GREEN
ApplicationWorkbenchAdvisor.java ef25d5783a4f75e88334fd679834a6e0421f8c2f GREEN
ApplicationWorkbenchWindowAdvisor.java da5cb38300b384579532c678fbc9faa961c2ca6b GREEN
CurrentObjectiveContributionItem.java 52e739907bdca86536efc963bd476fe238bb2f14 RED
UpcomingObjectiveContributionItem.java 5721c93ac6ea39842af09703ebc2b0f841bc9ed5 RED
ApplicationActionBarAdvisor.java 3e7c0fd992586e6ca7724b871eb0b2cf59244028 GREEN
ApplicationWorkbenchAdvisor.java ef25d5783a4f75e88334fd679834a6e0421f8c2f GREEN
ApplicationWorkbenchWindowAdvisor.java da5cb38300b384579532c678fbc9faa961c2ca6b GREEN
CurrentObjectiveContributionItem.java f5d2504cc9fd548037440da32405a28d77f40283 RED
UpcomingObjectiveContributionItem.java 5721c93ac6ea39842af09703ebc2b0f841bc9ed5 RED
......@@ -44,6 +44,7 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.ISelectionService;
......@@ -410,22 +411,25 @@ class CurrentObjectiveContributionItem extends WorkbenchWindowControlContributio
/** {@inheritDoc} */
@Override
public void resourceChanged(IResourceChangeEvent event) {
Display display = Display.getCurrent();
if(event.getType() == IResourceChangeEvent.POST_CHANGE &&
currentDevelopmentProcess != null) {
generateScoresAndUpdateUI(currentDevelopmentProcess);
EList<ConstraintConfiguration> configurations =
currentDevelopmentProcess.getConfigurations();
List<String> configNames =
configurations.stream().map(c -> c.getName()).collect(toList());
String[] configNamesArray = new String[configNames.size()];
configNames.toArray(configNamesArray);
currentObjectiveCombo.removeAll();
for(String comboString : configNamesArray) {
currentObjectiveCombo.add(comboString);
}
currentObjectiveCombo
.setText(currentDevelopmentProcess.getCurrentObjective().getName());
currentDevelopmentProcess != null && display != null) {
display.syncExec(() -> {
generateScoresAndUpdateUI(currentDevelopmentProcess);
EList<ConstraintConfiguration> configurations =
currentDevelopmentProcess.getConfigurations();
List<String> configNames =
configurations.stream().map(c -> c.getName()).collect(toList());
String[] configNamesArray = new String[configNames.size()];
configNames.toArray(configNamesArray);
currentObjectiveCombo.removeAll();
for(String comboString : configNamesArray) {
currentObjectiveCombo.add(comboString);
}
currentObjectiveCombo
.setText(currentDevelopmentProcess.getCurrentObjective().getName());
});
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment