New R Editor Features in Bio7

12.07.2016

Bio7 2.4 has been released for Windows, MacOSX and Linux and this release comes with a plethora of new R editor features.
The editor now supports the dynamic code analysis of R scripts, refactoring methods, improved code completions, more key shortcuts for a faster editing and improved quick fixes which now can be opened and applied directly where the warnings or errors occur.

The video below gives an overview of some new and noteworthy functions:

Bio7 2.4 for Linux Released

04.07.2016

A new Bio7 Linux release is available at http://bio7.org. The general release note for Bio7 2.4 can be found here!

linuxscreen1

Installation:

Bio7 for Linux comes bundled with the latest Java Runtime Environment.

To use R with Bio7 you have to install R for Linux.

In addition you have to install Rserve configured to use ‘cooperative mode’ (shared workspace in Rserve and R mode) which can be downloaded here:

https://bitbucket.org/maustenfeld/bio7-new/downloads

In the R prompt type the following command to install the compiled package (replace with your file path!):

install.packages(“Users/yourName/Downloads/Rserve_1.8-4_Linux_cooperative.tar.gz”, repos=NULL)

You can also compile Rserve by yourself. For an HowTo please consult the Bio7 documentation here.

Miscellaneous:

Added a tiny script to install useful default R packages for Bio7 to use all available GUI functionalities (e.g. rmarkdown, rgdal, spatstat, formatR, knitr, etc.). To install the packages start Rserve and execute the action Scripts->RScripts->Install_R_Packages in the Bio7 main menu. Please note that this only works if all dependencies for the packages are installed for compilation.

Troubleshooting Layout:

Linux comes in different flavours and it might be that you have to correct the Bio7 GTK *.css file for a little improved layout. If you see an artefact like this (‘Maximize’ button) just increase the size of the *.css toolbar variables.

linuxscreen4

The default CSS file can be found here:

/Bio7/plugins/com.eco.bio7.themes_2.0.0.201607050754/css/e4_default_gtk.css

The following changed css attributes will correct the height of the toolbars (changed attributes are bold):

.MPartStack {
……………………………………
color: ‘#org-eclipse-ui-workbench-INACTIVE_TAB_TEXT_COLOR’;
 swt-tab-height: 36.0px;

}

.MPartStack.active {
…………………………………..
swt-shadow-visible: false;
 swt-tab-height: 36.0px;
}

/*Important to set height for the view menus!*/
CTabFolder {
swt-corner-radius: 15.0;
swt-tab-height: 36.0px;
}

Of course you can change other attributes as well, e.g.,  if you want to change a color, etc. If you have good suggestions let me know.

Screenshots:

linuxscreen2

linuxscreen3

Bio7 2.4 for Windows and Mac Released

A new release of Bio7 is available for Windows and MacOSX. The Linux version will be released soon, too. This release comes with a plethora of new functions, especially for the R editor.

Download at: http://bio7.org

Release notes:

General

  • Updated Bio7 to use Eclipse 4.6 (Neon) as RCP basis
  • Updated the embedded Java Runtime Environment to version 1.8.92
  • Updated embedded R for Windows to R 3.3.1
  • Improved the toolbar layout and action alignments (CSS can be edited!)
  • Added a new ImageJ R analysis perspective

rimagejpersp

  • Added a new R debug perspective
  • Added a new and easy to use text preference field to execute Groovy script commands at startup (beside any scripts in the startup folder!) to open, e.g., a custom perspective, or startup R  if enabled.

preferencestartup

  • The Quadgrid, Linechart, Piechart and the Points view are now embedded in a Swt JavaFX panel and can be fullscreened (F1, F2, F3, F4, F5 – F1 key is Windows only!)
  • Added a terminate (Java controlled) and kill R process (OS controlled) action to the main toolbar of Bio7.

terninatetoolbar

  • At R/Rserve startup a new check for a running R instance is executed with an option to kill all running R instances (to avoid a wrong connection to a running instance from an crashed Bio7 R session).
  • Added  many new Bio7 R command key shortcuts
  • Added an install R packages script to install some useful default R packages for Bio7

R editor:

  • The R editor has been transferred to it’s own Github repository and can be updated as a plugin
  • Improved and formatted the display of the error messages
  • Improved massively the speed for parsing and marker creation
  • Added many new R editor key shortcuts to speed up editing
  • Added an action to the context menu to open the plot preferences
  • Added an action to the context menu to open the font preferences
  • Added a RServe formatR action to the context menu
  • Added a Profile script action for the profvis package to the context menu
  • Added a Profile script selection action for the profvis package to the context menu
  • Added a color dialog to the context menu. A selected R,G,B color will be displayed and set in the editor
  • Added an “Reload Package Completion” action to the context menu to load completion help for loaded packages (decrease warnings by known methods, increase available code completion templates – The same action is available in the R-Shell view evaluation textfield).

contextRmenu

  • The Load/Remove packages(s) dialog has a new action to transfer available selected package names to the R editor (as ‘library(package)’)
  • Now warnings and errors are displayed more consistently. If a quick fix is available it will be indicated with a warning/error quick fix icon instead of a default warning/error icon
  • Added new quick fixes to the R editor
  • Quick fixes and warning messages can now be displayed and fixed by hoovering over the underlined editor marker
  • Added the automatic close of {braces}, (parentheses), [brackets], “strings” and ‘strings’. It can be disabled in the preferences
  • Improved the speed of the ‘Mark selected word’ action (scope independant) which can be enabled in the preferences

R editor refactoring

  • Added an ‘Extract Method’ action which parses and extract a method from a selected text if valid

refactordialog

  • Added an ‘Extract Variable’ action which parses and extracts a variable from a selected text if valid
  • Added a ‘Create new File from Clipboard’ action which parses and creates a new file from the clipboard text if valid in the project folder and opens the R file for editing
  • Added an ‘Extract Editor Selection to File’ action which parses and creates a new file from a selection if valid in the project folder and opens the R file for editing

R editor code analysis:

  • Added an analysis function to detect Unused Functions
  • Added an analysis function to detect if a function is available
  • Added an analysis function to detect if a variable is used
  • Added an analysis function to detect if a variable is available
  • Added an analysis function to check for wrong constants (na, true, false, null)
  • Added an analysis function to check for functions if a function (or variable) with that name is already defined
  • Added an analysis function to check for variables if a variable (or function) with that name is already defined
  • Added an analysis function to check if a function call argument is missing
  • Added an analysis function to check if a function call has to many arguments
  • Added an analysis function to check if the name of a variable assignment in a function call is wrong
  • Added an analysis function to check a function call with parameter on a parameterless function
  • Added an analysis function to check variables in function calls and square brackets
  • Added options in the preferences to enable/disable the code analysis functions

warningscodeanalysis

R Outline View

  • Added the display of loop variables to the outline view
  • Added the display of function call variable assignments to the outline view
  • Added the display of S3,S4, References and R6 classes to the outline view (S3 classes are only detected with class(x), References classes and R6 classes functions are not displayed nested!)

classesoutline

R editor code completion

  • The sorting of the code completion dialog has been improved
  • The code completion dialog now displays local defined variables and methods available in the current scope
  • Added a new function in the code completion popup dialog to open the template preferences faster

codecompletionvar

  • If the code completion is opened in a method call the arguments of the function will be displayed in a new table dialog. However if an function or variable is started within the method call the regular code completion is shown (for nested functions or variables call)

codecompletioninfun

  • Added two actions in the hoover help dialog to open the help browser (?) or search in the Rdocumentation website

hooveractions

  • The code completion dialog can now be configured in the preferences to open automatically on key typing  (number of typed chars and chars can be configured, too).

R-Shell view

  • The R text is now validated with the Bio7 default R code parser
  • Added an error marker to the textfield if a parsing error occurs
  • Added code completions to the evaluate expression textfield (Ctrl+Space). Code completion is only available in nested calls after open parentheses

rshellparse

  • A help file browser can now be opened from selected text (e.g., nested function).
  • Native connection commands can now be executed in the evaluate expression textfield

R Markdown

  • Now JavaScript is enabled for the HTML-Browser by default
  • Added a new option to scale the JavaFX browser content if enabled  (handy for R markdown presentations). The JavaFX  browser can be fullscreened (F1,F2,F3 – secondary monitor…..)

Table view

  • Improved massively the speed of the close operation of a table sheet
  • Improved the CSV importer with more options to import data with a dynamic preview
  • The CSV importer now accepts clipboard data if selected
  • The preview table is now updated dynamically if changes occur

csvimportdialog

ImageJ

  • Updated ImageJ to version 1.51d
  • Added a subset of ImageJ2 libraries in a new ImageJ2 Eclipse plugin
  • Improved the ROI image pixel data transfer methods. Now selected ROI’s pixels are transferred. If no selection is available all ROI‘s will be transferred!
  • The ROI transfer methods now also accept points and lines (please note that line pixels are interpolated in the ImageJ results table by default)
  • The Bio7 ImageJ plugin can now be updated or installed individually
  • ImageJ panels can now be opened in a JavaFX panel embedded in SWT (experimental) if enabled in the preferences

Other

  • Updated all Java libraries
  • Update the JavaFX SceneBuilder to version 2.2
  • The JavaFX SceneBuilder controller class created variables and methods are now ‘public’ by default.
  • Added support for LibreOffice 5. Now the Bio7 LibreOffice functions work again with LibreOffice 5.

Eclipse Neon features

Installation:

Windows:

Just download the *.zip distribution file from http://bio7.org and unzip it in your preferred location. Bio7 comes bundled with the latest Java Runtime Environment, R and Rserve distribution and works out of the box.

MacOSX:

Just download and execute the *.dmg installation file from http://bio7.org.

To use R and Rserve you have to install R for MacOSX.

In addition you have to install Rserve configured to use ‘cooperative mode’ (shared workspace in Rserve and R mode) which can be downloaded here:

https://bitbucket.org/maustenfeld/bio7-new/downloads

In the R prompt type the following command to install the compiled package (replace with your file path!):

install.packages(“Users/yourName/Downloads/Rserve_1.8-4_Mac_cooperative.tgz”, repos=NULL)

You can also compile Rserve by yourself. For an HowTo please consult the Bio7 documentation here.

Miscellaneous:

Added a tiny script to install useful default R packages for Bio7 to use all available GUI functionalities (e.g. rmarkdown, rgdal, spatstat, formatR, knitr, etc.). To install the scripts start Rserve and execute the action Scripts->RScripts->Install_R_Packages.

The script will install the R packages.

For MacOSX it could be that you have to select a mirror in the Bio7 Console (shell). Type in a number (1- …) and press return to start the installation if no shell message is displayed. The R installation script can be edited in /plugins/com.eco.bio7_2.4.0/r_scripts. Suggestions for improvements are welcome.

 

 

R editor improvements for the next release of Bio7

20.04.2016

For the upcoming release of Bio7 I worked hard to improve the R editor features. So I added some new features and improvements to assist in the creation of R scripts in Bio7.
One of the highlights is the newly integrated dynamic code analysis when writing an R script.

Here a short overview of some new R editor features I integrated so far:

  • Detect and display unused variables and functions

missingFunc

  • Detect missing functions and variables
  • Added a new code assist list when triggered in function calls

codeComplParenth

  • Check of function arguments

missingPara

  • Check of wrong function argument

errorFuncCall

  • Available help for mistyped functions (% similarity)

similar

  • Improved Code Completion in general
  • Added a toolbar with two HTML help actions to the context help dialog (if you hover over a method)

codeComplTollbar

  • Improved Code Completion to list local scope self defined variables and functions

codeCompl

  • Added  an refactor action to extract variables
  • Added an refactor action to extract functions

refactorMeth

  • Added more Quickfixes
  • Quickfixes can now be opened by hovering over a problem or error marker
  • Added an automatic close action of parentheses, brackets, braces and strings in the editor
  • Improved the general parsing speed
  • Added new key shortcuts to faster perform R editor actions
  • New action and key shortcut to open the plot preferences faster
  • Added new on/off preferences for the new features
  • Improved the display of the Outline view for variables and functions

There is of course some room for improvements and there are some rough edges in the implementation of the dynamic code analysis since the R language is a highly dynamic language. However I hope that this features will be a help in the creation of correct R scripts in the R editor of the next Bio7 release.