Source:
<code>private SelectionListener createButtonListener() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<LayoutOption> layoutOptionOverrides = new ArrayList<>(); Map<String, CustomLayoutAlgorithm> layoutProviderRegistry = DiagramUIPlugin.getPlugin().getLayoutAlgorithms(); CustomLayoutConfiguration layout = (CustomLayoutConfiguration) eObject; CustomLayoutAlgorithm genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getId()); Map<String, LayoutOption> layoutOptions = genericLayoutProviderSupplier.getLayoutOptions(); for (LayoutOption layoutOption : layoutOptions.values()) { if (!layout.getLayoutOptions().stream().anyMatch(option -> option.getId().equals(layoutOption.getId()))) { LayoutOption copy = EcoreUtil.copy(layoutOption); if (copy instanceof EnumOption) { ((EnumOption) copy).getChoices().clear(); } copy.setDescription(""); layoutOptionOverrides.add(copy); } } OptionOverrideEditorDialog dialog = new OptionOverrideEditorDialog(composite.getShell(), (CustomLayoutConfiguration) eObject, Messages.AddOptionOverridePropertySection_dialogTitle, layoutOptionOverrides); dialog.open(); Set<LayoutOption> overrriddenOptions = dialog.getResult(); EditingDomain editingDomain = propertySheetPage.getEditor().getEditingDomain(); editingDomain.getCommandStack().execute(new AddCommand(editingDomain, layout, DescriptionPackage.eINSTANCE.getCustomLayoutConfiguration_LayoutOptions(), overrriddenOptions)); <START> if (propertySheetPage.getCurrentTab() != null) { <END> Display.getCurrent().asyncExec(() -> propertySheetPage.refresh()); } } }; }</code><technical_language>test runnable, condition changed time runnable get executed</technical_language>

Target:
private SelectionListener createButtonListener() { return new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<LayoutOption> layoutOptionOverrides = new ArrayList<>(); Map<String, CustomLayoutAlgorithm> layoutProviderRegistry = DiagramUIPlugin.getPlugin().getLayoutAlgorithms(); CustomLayoutConfiguration layout = (CustomLayoutConfiguration) eObject; CustomLayoutAlgorithm genericLayoutProviderSupplier = layoutProviderRegistry.get(layout.getId()); Map<String, LayoutOption> layoutOptions = genericLayoutProviderSupplier.getLayoutOptions(); for (LayoutOption layoutOption : layoutOptions.values()) { if (!layout.getLayoutOptions().stream().anyMatch(option -> option.getId().equals(layoutOption.getId()))) { LayoutOption copy = EcoreUtil.copy(layoutOption); if (copy instanceof EnumOption) { ((EnumOption) copy).getChoices().clear(); } copy.setDescription(""); layoutOptionOverrides.add(copy); } } OptionOverrideEditorDialog dialog = new OptionOverrideEditorDialog(composite.getShell(), (CustomLayoutConfiguration) eObject, Messages.AddOptionOverridePropertySection_dialogTitle, layoutOptionOverrides); dialog.open(); Set<LayoutOption> overrriddenOptions = dialog.getResult(); EditingDomain editingDomain = propertySheetPage.getEditor().getEditingDomain(); editingDomain.getCommandStack().execute(new AddCommand(editingDomain, layout, DescriptionPackage.eINSTANCE.getCustomLayoutConfiguration_LayoutOptions(), overrriddenOptions)); Display.getCurrent().asyncExec(() -> { if (propertySheetPage != null && propertySheetPage.getCurrentTab() != null) { propertySheetPage.refresh(); } }); } }; }