Browse files

Wait until Manager is ready

  • Loading branch information...
1 parent 975c11a commit ee080ad3deceece7e9a47ed1f5cfe00eea9f44f6 @cande cande committed Jun 30, 2011
Showing with 14 additions and 6 deletions.
  1. +14 −6 plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/views/RConsoleView.java
View
20 plugins/net.bioclipse.r.ui/src/net/bioclipse/r/ui/views/RConsoleView.java
@@ -19,6 +19,7 @@
final Logger logger = LoggerFactory.getLogger(RConsoleView.class);
private IRBusinessManager r;
+ private boolean working = false;
public RConsoleView() {
logger.info("Starting R console UI");
@@ -28,19 +29,26 @@ public RConsoleView() {
protected String executeCommand( String command ) {
String returnVal = "";
if (r == null)
- getRBusinessManager();
+ working = getRBusinessManager();
echoCommand(command);
- if (r.isWorking()) {
+/* if (working && r.isWorking()) {
returnVal = r.eval(command);
} else
returnVal = "R console is inactivated: " + r.getStatus();
- printMessage(returnVal);
+*/ printMessage(returnVal);
return returnVal;
}
- private void getRBusinessManager() {
- r = Activator.getDefault().getJavaRBusinessManager();
- printMessage(r.getStatus());
+ private boolean getRBusinessManager() {
+ try {
+ r = Activator.getDefault().getJavaRBusinessManager();
+ printMessage(r.getStatus());
+ }
+ catch (IllegalStateException e) {
+ printMessage("Waiting for JavaRBusinessManager.");
+ return false;
+ }
+ return true;
}
protected void waitUntilCommandFinished() {

0 comments on commit ee080ad

Please sign in to comment.