Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add the "Save R Session" button via extension point "org.eclipse.ui.m…
…enus"
  • Loading branch information
Valentin Georgiev committed Mar 21, 2012
1 parent 3be35bf commit 257c872
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
15 changes: 15 additions & 0 deletions plugins/net.bioclipse.r.ui/plugin.xml
Expand Up @@ -54,6 +54,11 @@
id="net.bioclipse.r.ui.runRScript"
defaultHandler="net.bioclipse.r.ui.handlers.RunRScriptHandler"
name="Run R Script"/>
<command
defaultHandler="net.bioclipse.r.ui.handlers.saveRSessionHandler"
id="net.bioclipse.r.ui.saveRSession"
name="Save R session">
</command>
</extension>

<extension
Expand Down Expand Up @@ -103,6 +108,16 @@
</toolbar>

</menuContribution>
<menuContribution
allPopups="false"
locationURI="toolbar:net.bioclipse.r.ui.views.RConsoleView">
<command
commandId="net.bioclipse.r.ui.saveRSession"
icon="icons/r_icon.gif"
label="Save R Session"
style="push">
</command>
</menuContribution>

</extension>

Expand Down
@@ -0,0 +1,26 @@
package net.bioclipse.r.ui.handlers;

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.ui.PlatformUI;

/**
* Handler for saving a R session
*
* @authors valyo
*
*/
public class saveRSessionHandler extends AbstractHandler implements IHandler {

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView");
rView.execEditorInput("save.image(\".RData\")");
return null;
}

}

0 comments on commit 257c872

Please sign in to comment.