@Override public IStatus run(final IProgressMonitor monitor) throws OperationCanceledException { synchronized (this) { if (this.result == null) { this.result = new RHelpSearchResult(this); } this.result.init(this.query.getREnv()); } final IRHelpSearchRequestor requestor = new IRHelpSearchRequestor() { @Override public int maxFragments() { return PreferencesUtil.getInstancePrefs() .getPreferenceValue(RHelpPreferences.SEARCH_PREVIEW_FRAGMENTS_MAX_PREF); } @Override public void matchFound(final IRHelpSearchMatch match) { RHelpSearchUIQuery.this.result.addMatch(new RHelpSearchMatch(match)); } }; try { RCore.getRHelpManager().search(this.query, requestor, monitor); return Status.OK_STATUS; } catch (final CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { throw new OperationCanceledException(); } return new Status( IStatus.ERROR, RUI.PLUGIN_ID, "An error occurred when performing R help search: " + getSearchLabel()); } }