Esempio n. 1
0
  @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());
    }
  }
Esempio n. 2
0
 @Override
 protected SourceEditorViewerConfigurator createConfigurator(final SourceViewer sourceViewer) {
   final RSourceViewerConfigurator viewerConfigurator =
       new RSourceViewerConfigurator(
           RCore.getWorkbenchAccess(),
           new RSourceViewerConfiguration(null, SharedUIResources.getColors()));
   return viewerConfigurator;
 }
Esempio n. 3
0
 public ISourceUnitModelInfo getModelInfo(
     final String type, final int syncLevel, final IProgressMonitor monitor) {
   if (type == null || type.equals(RModel.TYPE_ID)) {
     if (syncLevel > IModelManager.NONE) {
       RCore.getRModelManager().reconcile(this, syncLevel, false, monitor);
     }
     return fModelInfo;
   }
   return null;
 }
Esempio n. 4
0
 public AstInfo<? extends IAstNode> getAstInfo(
     final String type, final boolean ensureSync, final IProgressMonitor monitor) {
   if (type == null || type.equals(RModel.TYPE_ID)) {
     if (ensureSync) {
       RCore.getRModelManager().reconcile(this, IModelManager.AST, false, monitor);
     }
     return fAst;
   }
   return null;
 }
Esempio n. 5
0
 @Override
 protected IModelManager getModelManager() {
   return RCore.getRModelManager();
 }
Esempio n. 6
0
 public void reconcileRModel(final int reconcileLevel, final IProgressMonitor monitor) {
   RCore.getRModelManager().reconcile(this, reconcileLevel, true, monitor);
 }
Esempio n. 7
0
 @Override
 protected void unregister() {
   super.unregister();
   RCore.getRModelManager().deregisterDependentUnit(this);
 }
Esempio n. 8
0
 public IRCoreAccess getRCoreAccess() {
   return RCore.getWorkbenchAccess();
 }