public void run() throws Exception { provider.restoreState(memento); }
@Override public void restoreState(final IMemento aMemento) { super.restoreState(aMemento); // Need to run this async to avoid being reentered when processing a selection change viewer.getControl().getShell().getDisplay().asyncExec(() -> { boolean showWorkingSets = true; if (aMemento != null) { Integer showWorkingSetsInt = aMemento .getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); initWorkingSetFilter(lastWorkingSetName); } else { showWorkingSets = false; extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); } }); }
private void initialize(String id, CommonActionProvider anActionProvider) { if (anActionProvider != null && anActionProvider != SkeletonActionProvider.INSTANCE) { ICommonActionExtensionSite configuration = new CommonActionExtensionSite(id, commonViewerSite, contentService, structuredViewer); anActionProvider.init(configuration); anActionProvider.restoreState(memento); anActionProvider.setContext(new ActionContext(StructuredSelection.EMPTY)); if (commonViewerSite instanceof ICommonViewerWorkbenchSite) { anActionProvider.fillActionBars(((ICommonViewerWorkbenchSite) commonViewerSite).getActionBars()); } } } }