Skip to content

Commit e9ad7c2

Browse files
committed
fix: call ui updates after state updates
1 parent d04f2fe commit e9ad7c2

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

  • plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers

plugin/src/main/java/io/snyk/eclipse/plugin/views/snyktoolview/handlers/BaseHandler.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,19 @@ public class BaseHandler extends AbstractHandler implements IElementUpdater {
2424
public Object execute(ExecutionEvent event) throws ExecutionException {
2525
String commandId = event.getCommand().getId();
2626

27-
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
28-
if (commandService != null) {
29-
commandService.refreshElements(commandId, null);
30-
}
31-
27+
// Update the application state for the preference.
3228
Preferences.getInstance().store(preferenceKey,
3329
Boolean.valueOf(!Preferences.getInstance().getBooleanPref(preferenceKey)).toString());
3430

31+
// Update the Snyk Language Server configuration.
3532
new LsConfigurationUpdater().configurationChanged();
3633

34+
// Lastly update the UI.
35+
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
36+
if (commandService != null) {
37+
commandService.refreshElements(commandId, null);
38+
}
39+
3740
return null;
3841
}
3942

0 commit comments

Comments
 (0)