Issue 140 - Fix Open Workspace command for non-Mac platforms (requires Java 6)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1372 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
9c6097a065
commit
bc6f05f41b
@ -1,5 +1,6 @@
|
|||||||
package com.google.refine.commands;
|
package com.google.refine.commands;
|
||||||
|
|
||||||
|
import java.awt.Desktop;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -21,12 +22,17 @@ public class OpenWorkspaceDirCommand extends Command {
|
|||||||
respond(response, "{ \"code\" : \"error\", \"message\" : \"Workspace directory can only be opened on the local machine where Google Refine is run.\" }");
|
respond(response, "{ \"code\" : \"error\", \"message\" : \"Workspace directory can only be opened on the local machine where Google Refine is run.\" }");
|
||||||
} else if (ProjectManager.singleton instanceof FileProjectManager) {
|
} else if (ProjectManager.singleton instanceof FileProjectManager) {
|
||||||
File dir = ((FileProjectManager) ProjectManager.singleton).getWorkspaceDir();
|
File dir = ((FileProjectManager) ProjectManager.singleton).getWorkspaceDir();
|
||||||
|
|
||||||
Runtime.getRuntime().exec(
|
if (Desktop.isDesktopSupported()) {
|
||||||
"open .",
|
Desktop desktop = Desktop.getDesktop();
|
||||||
new String[] {},
|
desktop.open(dir);
|
||||||
dir
|
} else /* if Mac */ {
|
||||||
);
|
Process p = Runtime.getRuntime().exec(
|
||||||
|
"open .",
|
||||||
|
new String[] {},
|
||||||
|
dir
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
respond(response, "{ \"code\" : \"ok\" }");
|
respond(response, "{ \"code\" : \"ok\" }");
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user