|
From: <caw...@us...> - 2007-08-01 14:38:31
|
Revision: 2910
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2910&view=rev
Author: cawilliams
Date: 2007-08-01 07:38:26 -0700 (Wed, 01 Aug 2007)
Log Message:
-----------
use 'ruby' executable, not 'rubyw' (to avoid popup window). Refactor common code
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-07-31 23:43:32 UTC (rev 2909)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-08-01 14:38:26 UTC (rev 2910)
@@ -205,16 +205,18 @@
}
protected File getCachedIndex() {
- IPath location = RubyPlugin.getDefault().getStateLocation();
- location = location.append("ri.index");
- return location.toFile();
+ return getStateFile("ri.index");
}
protected File getFRIIndexFile() {
- IPath location = RubyPlugin.getDefault().getStateLocation();
- location = location.append(".fastri-index");
+ return getStateFile(".fastri-index");
+ }
+
+ private File getStateFile(String name) {
+ IPath location = RubyPlugin.getDefault().getStateLocation();
+ location = location.append(name);
return location.toFile();
- }
+ }
private synchronized void initSearchList() {
File file = getCachedIndex();
@@ -356,12 +358,17 @@
}
private String execAndReadOutput(String file, List<String> commands) {
if (file == null) return null;
- StringBuffer buffer;
+ StringBuffer buffer = new StringBuffer();
try {
List<String> line = new ArrayList<String>();
IVMInstall vm = RubyRuntime.getDefaultVMInstall();
if (vm == null) return "";
File executable = StandardVMType.findRubyExecutable(vm.getInstallLocation());
+ if (executable.getName().contains("rubyw")) {
+ String name = executable.getName();
+ name = name.replace("rubyw", "ruby");
+ executable = new File(executable.getParent() + File.separator + name);
+ }
line.add(executable.getAbsolutePath());
line.add(file);
for (String command : commands) {
@@ -372,8 +379,7 @@
cmdLine = line.toArray(cmdLine);
Process p = DebugPlugin.exec(cmdLine, workingDirectory);
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
- String liner = null;
- buffer = new StringBuffer();
+ String liner = null;
while ((liner = reader.readLine()) != null) {
buffer.append(liner);
buffer.append("\n");
@@ -381,13 +387,16 @@
Thread.yield();
}
}
+ p.waitFor();
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return "";
} catch (IOException e) {
AptanaRDTPlugin.log(e);
return "";
- }
+ } catch (InterruptedException e) {
+ AptanaRDTPlugin.log(e);
+ }
buffer.deleteCharAt(buffer.length() - 1); // remove last \n
return buffer.toString();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|