/bundles/plugins-trunk/Console/console/bsh/changeToPvRoot.bsh

# · Unknown · 28 lines · 24 code · 4 blank · 0 comment · 0 complexity · 047d702448aa05bb08f04b3fcaca49dd MD5 · raw file

  1. /**
  2. Beanshell Script to change the current console's directory
  3. to the root of the current ProjectViewer's project.
  4. by ezust
  5. */
  6. changeToPvRoot(view) {
  7. pv = view.getDockableWindowManager().getDockable("projectviewer");
  8. if (pv == null) return;
  9. con = view.getDockableWindowManager().getDockable("console");
  10. if (con == null) return;
  11. view.getDockableWindowManager().showDockableWindow("projectviewer");
  12. view.getDockableWindowManager().showDockableWindow("console");
  13. sysShell = console.Shell.getShell("System");
  14. sstate = con.getShellState(sysShell);
  15. project = pv.getActiveProject(view);
  16. if (project != null) {
  17. path = project.getRootPath();
  18. cmd = "cd \"" + path + "\"";
  19. sysShell.execute(con, null, sstate, null, cmd);
  20. sstate.print(con.getPlainColor(), "\n");
  21. sysShell.printPrompt(con, sstate);
  22. }
  23. }
  24. // changeToPvRoot(view);