Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change R editor commands and menu contributions
so that R code is "parsed"
- Loading branch information
Valentin Georgiev
committed
Apr 27, 2012
1 parent
10d52a4
commit e011213
Showing
6 changed files
with
75 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/handlers/RunLinesCodeHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package net.bioclipse.r.ui.handlers; | ||
|
||
import net.bioclipse.r.ui.util.RunUtil; | ||
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.core.runtime.CoreException; | ||
import org.eclipse.ui.PlatformUI; | ||
|
||
/** | ||
* Handler to execute a Text Selection in R | ||
* | ||
* @authors ola, valyo | ||
* | ||
*/ | ||
public class RunLinesCodeHandler extends AbstractHandler implements IHandler { | ||
|
||
@Override | ||
public Object execute(ExecutionEvent event) throws ExecutionException { | ||
try { | ||
String code = RunUtil.getSelectedCode(event); | ||
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("net.bioclipse.r.ui.views.RConsoleView"); | ||
RConsoleView rView = (RConsoleView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView("net.bioclipse.r.ui.views.RConsoleView"); | ||
String[] codeStr = RunUtil.breakCommand(code); | ||
for (String cs : codeStr) { | ||
rView.execEditorInput(cs); | ||
} | ||
} catch (CoreException e) { | ||
e.printStackTrace(); | ||
} | ||
return null; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters