Skip to content

Commit

Permalink
R output from running snippets printed in the R console
Browse files Browse the repository at this point in the history
When running snippets or the whole R editor content, the output
shows up in the R console view
  • Loading branch information
Valentin Georgiev committed Dec 19, 2011
1 parent 9441372 commit 3fd6919
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Expand Up @@ -3,13 +3,15 @@
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;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;

/**
Expand All @@ -34,7 +36,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException {

IRBusinessManager r = Activator.getDefault().getJavaRBusinessManager();
r.evalSnippet(contents);

RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
rView.execSnippet(contents);
//We are done
return null;
}
Expand Down
Expand Up @@ -2,13 +2,15 @@

import net.bioclipse.r.business.Activator;
import net.bioclipse.r.business.IRBusinessManager;
import net.bioclipse.r.ui.views.RConsoleView;

import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.commands.IHandler;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.HandlerUtil;

/**
Expand All @@ -30,7 +32,8 @@ public Object execute(ExecutionEvent event) throws ExecutionException {

IRBusinessManager r = Activator.getDefault().getJavaRBusinessManager();
r.evalSnippet(textsel.getText());

RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
rView.execSnippet(textsel.getText());
//We are done
return null;
}
Expand Down
Expand Up @@ -31,6 +31,9 @@ public void createPartControl(Composite parent) {
getRBusinessManager();
}

public String execSnippet(String command) {
return executeCommand(command);
}
/*
* Execute the R command - First check if r manager is available.
*/
Expand Down

0 comments on commit 3fd6919

Please sign in to comment.