/plugins/LogViewer/tags/rel-0-4/src/java/logviewer/WordWrap.java

# · Java · 64 lines · 22 code · 8 blank · 34 comment · 2 complexity · d7420061d408c48c4b9f2731dc1e1755 MD5 · raw file

  1. /*
  2. * Copyright (C) 2003 Don Brown (mrdon@techie.com)
  3. * Copyright (C) 2000, 2001 Greg Merrill (greghmerrill@yahoo.com)
  4. * This file is part of Log Viewer, a plugin for jEdit (http://www.jedit.org).
  5. * It is heavily based off Follow (http://follow.sf.net).
  6. * Log Viewer is free software; you can redistribute it and/or modify
  7. * it under the terms of version 2 of the GNU General Public
  8. * License as published by the Free Software Foundation.
  9. * Log Viewer is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. * You should have received a copy of the GNU General Public License
  14. * along with Log Viewer; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. package logviewer;
  18. import java.awt.Cursor;
  19. import java.awt.event.ActionEvent;
  20. import java.io.IOException;
  21. import javax.swing.JOptionPane;
  22. import javax.swing.AbstractAction;
  23. /**
  24. * Word wraps the content of the currently selected log file
  25. *
  26. * @author <a href="mailto:mrdon@techie.com">Don Brown</a>
  27. * @author <a href="mailto:greghmerrill@yahoo.com">Greg Merrill</a>
  28. */
  29. class WordWrap extends AbstractAction {
  30. LogViewer app;
  31. /**
  32. * Constructor for the WordWrap action
  33. *
  34. * @param app The main class
  35. * @param name The name of the action
  36. */
  37. public WordWrap(LogViewer app, String name) {
  38. super(name);
  39. this.app = app;
  40. }
  41. /**
  42. * Performs the action
  43. *
  44. * @param e The action event
  45. */
  46. public void actionPerformed(ActionEvent e) {
  47. app.setCursor(Cursor.WAIT_CURSOR);
  48. FileFollowingPane fileFollowingPane = app.getSelectedFileFollowingPane();
  49. if (fileFollowingPane == null) {
  50. // TODO: should provide some error message
  51. return;
  52. }
  53. fileFollowingPane.toggleWordWrap();
  54. app.setCursor(Cursor.DEFAULT_CURSOR);
  55. }
  56. }