/bundles/plugins-trunk/Console/console/bsh/changeToPvRoot.bsh
Unknown | 28 lines | 24 code | 4 blank | 0 comment | 0 complexity | 047d702448aa05bb08f04b3fcaca49dd MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /**
- Beanshell Script to change the current console's directory
- to the root of the current ProjectViewer's project.
-
- by ezust
-
- */
- changeToPvRoot(view) {
- pv = view.getDockableWindowManager().getDockable("projectviewer");
- if (pv == null) return;
- con = view.getDockableWindowManager().getDockable("console");
- if (con == null) return;
- view.getDockableWindowManager().showDockableWindow("projectviewer");
- view.getDockableWindowManager().showDockableWindow("console");
- sysShell = console.Shell.getShell("System");
- sstate = con.getShellState(sysShell);
- project = pv.getActiveProject(view);
- if (project != null) {
- path = project.getRootPath();
- cmd = "cd \"" + path + "\"";
- sysShell.execute(con, null, sstate, null, cmd);
- sstate.print(con.getPlainColor(), "\n");
- sysShell.printPrompt(con, sstate);
- }
- }
- // changeToPvRoot(view);