PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/JavaInsight/javainsight/JavaInsightOptionPane.java

#
Java | 115 lines | 60 code | 24 blank | 31 comment | 0 complexity | 9c9ebbadb1483a70a72276ffd75f5bc5 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
  1. /*
  2. * JavaInsightOptionPane.java - options panel for JavaInsight
  3. * Copyright (C) 2001 Dirk Moebius
  4. *
  5. * jEdit edit mode settings:
  6. * :mode=java:tabSize=4:indentSize=4:noTabs=true:maxLineLen=0:
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package javainsight;
  23. import javax.swing.Box;
  24. import javax.swing.JCheckBox;
  25. import javax.swing.JComboBox;
  26. import javax.swing.JLabel;
  27. import javax.swing.JTextField;
  28. import org.gjt.sp.jedit.AbstractOptionPane;
  29. import org.gjt.sp.jedit.jEdit;
  30. /**
  31. * An option panel for the Java Insight plugin.
  32. *
  33. * @author Dirk Moebius
  34. * @version $Id: JavaInsightOptionPane.java 9456 2007-04-18 20:09:54Z dmoebius $
  35. */
  36. public class JavaInsightOptionPane extends AbstractOptionPane
  37. {
  38. public JavaInsightOptionPane() {
  39. super("javainsight");
  40. }
  41. @Override
  42. public void _init() {
  43. addSeparator("options.javainsight.decompiler");
  44. cStyle = new JComboBox(new String[] { "sun", "gnu", "pascal" });
  45. cStyle.setSelectedItem(jEdit.getProperty("javainsight.jode.style", "sun"));
  46. addComponent("Coding Style:", cStyle);
  47. addComponent(Box.createVerticalStrut(15));
  48. addComponent(cPretty =
  49. new JCheckBox("Use \"pretty\" names for local variables",
  50. jEdit.getBooleanProperty("javainsight.jode.pretty", true)));
  51. addComponent(cOnetime =
  52. new JCheckBox("Remove locals, that are used only one time",
  53. jEdit.getBooleanProperty("javainsight.jode.onetime", false)));
  54. addComponent(cDecrypt =
  55. new JCheckBox("Decrypt encrypted strings",
  56. jEdit.getBooleanProperty("javainsight.jode.decrypt", true)));
  57. addComponent(Box.createVerticalStrut(15));
  58. addComponent(new JLabel("Generate imports..."));
  59. cImportPkgLimit = new JTextField(jEdit.getProperty("javainsight.jode.pkglimit", "0"));
  60. Box b1 = Box.createHorizontalBox();
  61. b1.add(cImportPkgLimit);
  62. b1.add(new JLabel(" classes"));
  63. addComponent("...for packages with more than", b1);
  64. cImportClassLimit = new JTextField(jEdit.getProperty("javainsight.jode.clslimit", "1"));
  65. Box b2 = Box.createHorizontalBox();
  66. b2.add(cImportClassLimit);
  67. b2.add(new JLabel(" times"));
  68. addComponent("...for classes used more than", b2);
  69. addComponent(Box.createVerticalStrut(5));
  70. addComponent(new JLabel("(0 means generate no imports)"));
  71. }
  72. /**
  73. * Called when the options dialog's `OK' button is pressed.
  74. * This saves any properties saved in this option pane.
  75. */
  76. @Override
  77. public void _save() {
  78. jEdit.setProperty("javainsight.jode.style", cStyle.getSelectedItem().toString());
  79. jEdit.setBooleanProperty("javainsight.jode.pretty", cPretty.isSelected());
  80. jEdit.setBooleanProperty("javainsight.jode.onetime", cOnetime.isSelected());
  81. jEdit.setBooleanProperty("javainsight.jode.decrypt", cDecrypt.isSelected());
  82. jEdit.setProperty("javainsight.jode.pkglimit", cImportPkgLimit.getText());
  83. jEdit.setProperty("javainsight.jode.clslimit", cImportClassLimit.getText());
  84. }
  85. private JComboBox cStyle;
  86. private JCheckBox cPretty;
  87. private JCheckBox cOnetime;
  88. private JCheckBox cDecrypt;
  89. private JTextField cImportPkgLimit;
  90. private JTextField cImportClassLimit;
  91. }