Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
  • 2 commits
  • 3 files changed
  • 0 comments
  • 1 contributor
2  plugins/net.bioclipse.r.business/src/net/bioclipse/r/business/Activator.java
@@ -65,7 +65,7 @@ public IRBusinessManager getJavaRBusinessManager() {
65 65
         IRBusinessManager manager = null;
66 66
         try {
67 67
             manager = (IRBusinessManager)
68  
-                      javaFinderTracker.waitForService(1000*10);
  68
+                      javaFinderTracker.waitForService(1500*10); // 1000*10 is to small.
69 69
         }
70 70
         catch (InterruptedException e) {
71 71
             throw new IllegalStateException(
51  plugins/net.bioclipse.r.business/src/net/bioclipse/r/business/RBusinessManager.java
@@ -50,7 +50,7 @@
50 50
 	public RBusinessManager() throws LoginException, NoSuchElementException {	
51 51
 	    logger.info("Starting R manager");
52 52
 		IWorkspace workspace = ResourcesPlugin.getWorkspace();
53  
-		IWorkspaceRoot root = workspace.getRoot();
  53
+		IWorkspaceRoot root  = workspace.getRoot();
54 54
 		workspacePath = root.getLocation();
55 55
 		logger.debug("Bioclipse workingdirectory: " + workspacePath.toString());
56 56
 	    
@@ -58,15 +58,9 @@ public RBusinessManager() throws LoginException, NoSuchElementException {
58 58
 	    
59 59
 	    logger.debug("R_HOME=" + R_HOME);
60 60
 		try {
61  
-//		TODO integrate checkR_HOME() and checkRPath in one go! or?
62  
-			checkR_HOME();
63  
-			R_HOME = rsmanager.checkRPath(R_HOME);
  61
+			R_HOME = checkR_HOME(R_HOME);
64 62
 			rsmanager.setEmbedded(R_HOME);
65 63
 		}
66  
-		catch (NullPointerException e)  {
67  
-			working = false;
68  
-			status  = e.getMessage();
69  
-		}
70 64
 		catch (FileNotFoundException e) {
71 65
 			working = false;
72 66
 			status = e.getMessage();
@@ -103,11 +97,42 @@ public String getStatus() {
103 97
     public Boolean isWorking() {
104 98
     	return working;
105 99
     }
106  
-    
107  
-    private void checkR_HOME() throws NullPointerException {
108  
-    	if (R_HOME == null)
109  
-			throw new NullPointerException("R_HOME is not set, set path in your system.");
110  
-    }
  100
+        
  101
+//	Check if R_HOME is correctly set and tries to correct simple errors.
  102
+	public String checkR_HOME(String path) throws FileNotFoundException {
  103
+		String OS = System.getProperty("os.name").toString();
  104
+		Boolean trustRPath = false;
  105
+		if (OS.startsWith("Mac")) {
  106
+			if (R_HOME == null)			
  107
+				path = "/Library/Frameworks/R.framework/Resources/";
  108
+			if (!path.endsWith("/"))
  109
+				path += "/";
  110
+			trustRPath = rExist(path + "R");
  111
+		} else if (OS.startsWith("Windows")) {
  112
+			if (R_HOME == null)			
  113
+				path = "C:\\Program Files\\R\\R-2.12.2\\";
  114
+//			TODO check paths for 2.13.xx and 64bit versions.
  115
+			if (!path.endsWith("\\"))
  116
+				path += "\\";
  117
+			trustRPath =rExist(path + "bin\\R.exe"); 
  118
+		} else if (OS.startsWith("Linux")) {
  119
+			if (!path.endsWith("/"))
  120
+				path += "/";
  121
+			trustRPath = rExist(path + "bin/R");
  122
+//			link: /usr/bin/R -> /usr/lib/R/bin/R
  123
+//			no link: /usr/lib/R/R -> /usr/lib/R/bin/R 
  124
+//		    R_HOME is /usr/lib/R
  125
+		}
  126
+		if (!trustRPath)
  127
+			throw new FileNotFoundException("Incorrect R_HOME path: " + path);
  128
+		logger.debug("New path: " + path);
  129
+		return path;
  130
+	}
  131
+
  132
+	private Boolean rExist(String testPath) {
  133
+		File f = new File(testPath);
  134
+		return f.exists();
  135
+	}
111 136
     
112 137
     private void initSession() {
113 138
     	File file = new File(workspacePath.toString()+"/r");
40  plugins/net.bioclipse.r/src/net/bioclipse/r/RServiManager.java
@@ -10,7 +10,6 @@
10 10
 package net.bioclipse.r;
11 11
 
12 12
 import java.io.File;
13  
-import java.io.FileNotFoundException;
14 13
 import java.util.List;
15 14
 import java.util.NoSuchElementException;
16 15
 
@@ -76,48 +75,11 @@ public RServiManager(final String appId) {
76 75
 		
77 76
 //	    RjsComConfig.setProperty("rj.servi.graphicFactory", graphicFactory);
78 77
 	}
79  
-	
80  
-//	Check if R_HOME is correctly set and tries to correct simple errors.
81  
-	public String checkRPath(String path) throws FileNotFoundException {
82  
-		Boolean trustRPath = false;
83  
-		String OS = System.getProperty("os.name").toString();
84  
-		if (OS.startsWith("Mac")) {
85  
-			if (!path.endsWith("/"))
86  
-				path += "/";
87  
-			trustRPath = rExist(path + "R");
88  
-		} else if (OS.startsWith("Windows")) {
89  
-			if (!path.endsWith("\\"))
90  
-				path += "\\";
91  
-			if (rExist(path + "bin\\R.exe"))
92  
-				trustRPath = true;
93  
-			else if (rExist(path + "R.exe"))
94  
-				path = path.substring(0, path.indexOf("bin\\"));
95  
-				logger.info("R_HOME path corrected, removed bin\\ from path.");
96  
-				trustRPath = true;
97  
-		} else if (OS.startsWith("Linux")) {
98  
-			if (!path.endsWith("/"))
99  
-				path += "/";
100  
-			trustRPath = rExist(path + "bin/R");
101  
-//			link: /usr/bin/R -> /usr/lib/R/bin/R
102  
-//			no link: /usr/lib/R/R -> /usr/lib/R/bin/R 
103  
-//		    R_HOME is /usr/lib/R
104  
-		}
105  
-		if (!trustRPath)
106  
-			throw new FileNotFoundException("Incorrect R_HOME path: " + path);
107  
-		logger.debug("New path: " + path);
108  
-		return path;
109  
-	}
110  
-	
111  
-	private Boolean rExist(String testPath) {
112  
-		File f = new File(testPath);
113  
-		return f.exists();
114  
-	}
115  
-	
  78
+			
116 79
 	public ISchedulingRule getSchedulingRule() {
117 80
 		return schedulingRule;
118 81
 	}
119 82
 
120  
-	
121 83
 	public void setEmbedded(final String rHome) throws CoreException {
122 84
 			logger.debug("Using path: " + rHome);
123 85
 			final Config config = new Config();

No commit comments for this range

Something went wrong with that request. Please try again.