Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add output printing on R scripts sourcing

The normal R behavior is reproduced.
  • Loading branch information...
commit 16e98b7881ae712369e97b4ce13e22e6e4880469 1 parent bf59949
@valyo valyo authored
View
4 plugins/net.bioclipse.r.business/src/net/bioclipse/r/business/IRBusinessManager.java
@@ -56,9 +56,9 @@
@Recorded
@PublishedMethod(
- methodSummary = "Passes source(filepath) to eval"
+ methodSummary = "Changes the file separator in filepath to /"
)
- public String source(String filepath);
+ public String fixFilepath(String filepath);
@Recorded
@PublishedMethod(
View
6 plugins/net.bioclipse.r.business/src/net/bioclipse/r/business/RBusinessManager.java
@@ -467,9 +467,9 @@ public String evalSnippet(String seltext) {
return cmd;
}
- public String source(String filepath) {
- eval("source(\"" + filepath.replace(fileseparator, "/") + "\")");
- return "";
+ public String fixFilepath(String filepath) {
+ filepath = filepath.replace(fileseparator, "/");
+ return filepath;
}
public String ls() {
View
2  plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/handlers/RunRAllHandler.java
@@ -35,7 +35,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
System.out.println("Editor content: \n" + contents);
RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
- rView.execSnippet(contents);
+ rView.execEditorInpit(contents);
//We are done
return null;
}
View
9 plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/handlers/RunRScriptHandler.java
@@ -3,6 +3,7 @@
import net.bioclipse.r.business.Activator;
import net.bioclipse.r.business.IRBusinessManager;
import net.bioclipse.r.ui.editors.REditor;
+import net.bioclipse.r.ui.views.RConsoleView;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
@@ -31,9 +32,13 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
String filepath = reditor.getFilePath();
System.out.println("File path is: " + filepath);
- //Pass the path to RBusinessManager
+ //Get the file path with correct file separator
IRBusinessManager r = Activator.getDefault().getJavaRBusinessManager();
- r.source(filepath);
+ filepath = r.fixFilepath(filepath);
+
+ //Pass the path to the R console method
+ RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
+ rView.execEditorInpit("source(\"" + filepath + "\")");
//We are done
return null;
View
2  plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/handlers/RunRSnippetHandler.java
@@ -29,7 +29,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
System.out.println("You selected text: \n" + textsel.getText());
RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
- rView.execSnippet(textsel.getText());
+ rView.execEditorInpit(textsel.getText());
//We are done
return null;
}
View
4 plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/views/RConsoleView.java
@@ -30,6 +30,8 @@ public RConsoleView() {
public void createPartControl(Composite parent) {
super.createPartControl(parent);
getRBusinessManager();
+ if (r == null)
+ getRBusinessManager();
if (!r.getRightRVersion()){
getSite().getShell().getDisplay().asyncExec
(new Runnable() {
@@ -41,7 +43,7 @@ public void run() {
}
- public String execSnippet(String command) {
+ public String execEditorInpit(String command) {
return executeCommand(command);
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.