@Override protected void doPrepareSrcfile( final String srcfile, final String statetPath, final IProgressMonitor monitor) throws CoreException { final FunctionCall prepare = createFunctionCall("rj:::.statet.prepareSrcfile"); prepare.addChar("filename", srcfile); prepare.addChar("path", statetPath); prepare.evalVoid(monitor); }
private void runApplyRepo( final ISelectedRepos repos, final RService r, final IProgressMonitor monitor) throws CoreException { monitor.subTask("Setting repository configuration..."); try { if (repos.getBioCMirror() != null) { final FunctionCall call = r.createFunctionCall("options"); call.addChar("BioC_mirror", repos.getBioCMirror().getURL()); call.evalVoid(monitor); } { final List<RRepo> selectedRepos = (List<RRepo>) repos.getRepos(); final String[] ids = new String[selectedRepos.size()]; final String[] urls = new String[selectedRepos.size()]; for (int i = 0; i < urls.length; i++) { final RRepo repo = selectedRepos.get(i); ids[i] = repo.getId(); urls[i] = repo.getURL(); } final RVector<RCharacterStore> data = new RVectorImpl<RCharacterStore>( new RCharacterDataImpl(urls), RObject.CLASSNAME_CHARACTER, ids); final FunctionCall call = r.createFunctionCall("options"); call.add("repos", data); call.evalVoid(monitor); } } catch (final CoreException e) { throw new CoreException( new Status( IStatus.ERROR, RCore.PLUGIN_ID, "An error occurred when setting repository configuration in R.", e)); } }
@Override protected void doSubmitCommandL( final String[] lines, final SrcfileData srcfile, final IRSrcref srcref, final IProgressMonitor monitor) throws CoreException { if ((fCurrentPrompt.meta & (IRBasicAdapter.META_PROMPT_DEFAULT | IRBasicAdapter.META_PROMPT_SUSPENDED)) == 0) { super.doSubmitCommandL(lines, srcfile, srcref, monitor); return; } final FunctionCall prepare = createFunctionCall("rj:::.statet.prepareCommand"); prepare.add("lines", fRObjectFactory.createVector(fRObjectFactory.createCharData(lines))); if (srcfile != null && srcref != null) { final List<String> attributeNames = new ArrayList<String>(); final List<RObject> attributeValues = new ArrayList<RObject>(); if (srcfile.getName() != null) { prepare.addChar("filename", srcfile.getName()); } // if (srcfile.workspacePath != null) { // attributeNames.add("statet.Path"); // attributeValues.add(fRObjectFactory.createVector(fRObjectFactory.createCharData( // new String[] { srcfile.workspacePath } ))); // } if (srcfile.getTimestamp() != 0) { attributeNames.add("timestamp"); attributeValues.add( fRObjectFactory.createVector( fRObjectFactory.createNumData(new double[] {srcfile.getTimestamp()}))); } final int[] rjSrcref = RDbg.createRJSrcref(srcref); if (rjSrcref != null) { attributeNames.add("linesSrcref"); attributeValues.add(fRObjectFactory.createVector(fRObjectFactory.createIntData(rjSrcref))); } if (attributeNames.size() > 0) { prepare.add( "srcfileAttributes", fRObjectFactory.createList( attributeValues.toArray(new RObject[attributeValues.size()]), attributeNames.toArray(new String[attributeNames.size()]))); } if (srcref instanceof IRModelSrcref) { // Move to abstract controller or breakpoint adapter? final IRModelSrcref modelSrcref = (IRModelSrcref) srcref; final List<IRLangSourceElement> elements = modelSrcref.getElements(); if (elements.size() > 0) { final List<String> elementIds = new ArrayList<String>(elements.size()); final List<RObject> elementIndexes = new ArrayList<RObject>(elements.size()); for (final IRLangSourceElement element : elements) { if (TAG_ELEMENT_FILTER.include(element)) { final FDef fdef = (FDef) element.getAdapter(FDef.class); if (fdef != null) { final String elementId = RDbg.getElementId(element); final RAstNode cont = fdef.getContChild(); final int[] path = RAst.computeRExpressionIndex(cont, RAst.getRRootNode(cont, modelSrcref)); if (elementId != null && path != null) { final int[] fullPath = new int[path.length + 1]; fullPath[0] = 1; System.arraycopy(path, 0, fullPath, 1, path.length); elementIds.add(elementId); elementIndexes.add( fRObjectFactory.createVector(fRObjectFactory.createIntData(fullPath))); } } } } if (elementIds.size() > 0) { prepare.add( "elementIds", fRObjectFactory.createList( elementIndexes.toArray(new RObject[elementIndexes.size()]), elementIds.toArray(new String[elementIds.size()]))); } } } } prepare.evalVoid(monitor); final boolean addToHistory = (fCurrentPrompt.meta & IRBasicAdapter.META_HISTORY_DONTADD) == 0; fCurrentInput = lines[0]; doBeforeSubmitL(); for (int i = 1; i < lines.length; i++) { setCurrentPromptL(fContinuePromptText, addToHistory); fCurrentInput = lines[i]; doBeforeSubmitL(); } fCurrentInput = "rj:::.statet.evalCommand()"; doSubmitL(monitor); }