/plugins/P4Plugin/tags/p4_0_2_0/p4plugin/config/P4GlobalOptionPane.java

# · Java · 75 lines · 31 code · 13 blank · 31 comment · 0 complexity · 3016912edfc84443880935905f5e6530 MD5 · raw file

  1. /*
  2. * :tabSize=4:indentSize=4:noTabs=true:
  3. * :folding=explicit:collapseFolds=1:
  4. *
  5. * (c) 2005 Marcelo Vanzin
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. */
  21. package p4plugin.config;
  22. //{{{ Imports
  23. import javax.swing.JCheckBox;
  24. import javax.swing.JTextField;
  25. import org.gjt.sp.jedit.AbstractOptionPane;
  26. import org.gjt.sp.jedit.jEdit;
  27. //}}}
  28. /**
  29. * The global plugin configuration pane.
  30. *
  31. * @author Marcelo Vanzin
  32. * @version $Id: P4GlobalOptionPane.java 6444 2005-12-12 04:43:01Z vanza $
  33. * @since P4P 0.1
  34. */
  35. public class P4GlobalOptionPane extends AbstractOptionPane {
  36. private P4Config config;
  37. private JCheckBox monitorFiles;
  38. private JTextField p4Path;
  39. private JTextField editorCommand;
  40. public P4GlobalOptionPane() {
  41. super(jEdit.getProperty("p4plugin.config.global_option_pane.name"));
  42. }
  43. //{{{ _init() method
  44. protected void _init() {
  45. P4GlobalConfig config = P4GlobalConfig.getInstance();
  46. p4Path = new JTextField(config.getPerforcePath());
  47. addComponent(jEdit.getProperty("p4plugin.global_cfg.p4_path"), p4Path);
  48. editorCommand = new JTextField(config.getEditor());
  49. addComponent(jEdit.getProperty("p4plugin.global_cfg.editor_cmd"), editorCommand);
  50. monitorFiles = new JCheckBox(jEdit.getProperty("p4plugin.global_cfg.monitor_files"));
  51. monitorFiles.setToolTipText(jEdit.getProperty("p4plugin.global_cfg.monitor_files.tooltip"));
  52. monitorFiles.setSelected(config.getMonitorFiles());
  53. addComponent(monitorFiles);
  54. } //}}}
  55. //{{{ _save() method
  56. protected void _save() {
  57. P4GlobalConfig config = P4GlobalConfig.getInstance();
  58. config.setPerforcePath(p4Path.getText());
  59. config.setEditor(editorCommand.getText());
  60. config.setMonitorFiles(monitorFiles.isSelected());
  61. } //}}}
  62. }