PageRenderTime 98ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/XML/sidekick/html/HtmlOptionPane.java

#
Java | 122 lines | 70 code | 22 blank | 30 comment | 0 complexity | 61726d50b6a0fb75921acb629a0c0eae 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. Copyright (c) 2006, Dale Anson
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without modification,
  5. are permitted provided that the following conditions are met:
  6. * Redistributions of source code must retain the above copyright notice,
  7. this list of conditions and the following disclaimer.
  8. * Redistributions in binary form must reproduce the above copyright notice,
  9. this list of conditions and the following disclaimer in the documentation
  10. and/or other materials provided with the distribution.
  11. * Neither the name of the <ORGANIZATION> nor the names of its contributors
  12. may be used to endorse or promote products derived from this software without
  13. specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. package sidekick.html;
  26. import java.awt.*;
  27. import java.awt.event.*;
  28. import javax.swing.*;
  29. import javax.swing.border.*;
  30. import org.gjt.sp.jedit.*;
  31. public class HtmlOptionPane extends AbstractOptionPane /*implements ActionListener*/ {
  32. JCheckBox showTagAttributes;
  33. JCheckBox showCoreAttributes;
  34. JCheckBox showLangAttributes;
  35. JCheckBox showScriptAttributes;
  36. JCheckBox showBrackets;
  37. JRadioButton showAllElements;
  38. JRadioButton showBlockElements;
  39. JCheckBox showJspElements;
  40. public HtmlOptionPane() {
  41. super("sidekick.html");
  42. }
  43. public void _init() {
  44. JTextPane info = new JTextPane();
  45. info.setEditorKit(info.createEditorKitForContentType("text/html"));
  46. info.setOpaque(false);
  47. String text = jEdit.getProperty("options.sidekick.general.info");
  48. info.setText(text);
  49. info.setEditable(false);
  50. addComponent(jEdit.getProperty("options.note", "NOTE: "), info);
  51. setBorder(new TitledBorder(new CompoundBorder(new LineBorder(Color.BLACK), new EmptyBorder(6, 6, 6, 6)), jEdit.getProperty("options.sidekick.html.panel_label")));
  52. // attribute display
  53. JLabel attributes_label = new JLabel(jEdit.getProperty("options.sidekick.html.showAttributes.label"));
  54. addComponent(attributes_label);
  55. showTagAttributes = new JCheckBox(jEdit.getProperty("options.sidekick.html.showTagAttributes.label"));
  56. showTagAttributes.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showTagAttributes", true));
  57. addComponent(showTagAttributes);
  58. showCoreAttributes = new JCheckBox(jEdit.getProperty("options.sidekick.html.showCoreAttributes.label"));
  59. showCoreAttributes.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showCoreAttributes", true));
  60. addComponent(showCoreAttributes);
  61. showLangAttributes = new JCheckBox(jEdit.getProperty("options.sidekick.html.showLangAttributes.label"));
  62. showLangAttributes.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showLangAttributes", true));
  63. addComponent(showLangAttributes);
  64. showScriptAttributes = new JCheckBox(jEdit.getProperty("options.sidekick.html.showScriptAttributes.label"));
  65. showScriptAttributes.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showScriptAttributes", true));
  66. addComponent(showScriptAttributes);
  67. addSeparator();
  68. // bracket display
  69. showBrackets = new JCheckBox(jEdit.getProperty("options.sidekick.html.showBrackets.label"));
  70. showBrackets.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showBrackets", true));
  71. addComponent(showBrackets);
  72. addSeparator();
  73. // element display
  74. showAllElements = new JRadioButton(jEdit.getProperty("options.sidekick.html.showAllElements.label"));
  75. showAllElements.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showAllElements", true));
  76. addComponent(showAllElements);
  77. showBlockElements = new JRadioButton(jEdit.getProperty("options.sidekick.html.showBlockElements.label"));
  78. showBlockElements.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showBlockElements", false));
  79. addComponent(showBlockElements);
  80. ButtonGroup bg = new ButtonGroup();
  81. bg.add(showAllElements);
  82. bg.add(showBlockElements);
  83. showJspElements = new JCheckBox(jEdit.getProperty("options.sidekick.html.showJspElements.label"));
  84. showJspElements.setSelected(jEdit.getBooleanProperty("options.sidekick.html.showJspElements", true));
  85. addComponent(showJspElements);
  86. }
  87. public void _save() {
  88. jEdit.setBooleanProperty("options.sidekick.html.showTagAttributes", showTagAttributes.isSelected());
  89. jEdit.setBooleanProperty("options.sidekick.html.showCoreAttributes", showCoreAttributes.isSelected());
  90. jEdit.setBooleanProperty("options.sidekick.html.showLangAttributes", showLangAttributes.isSelected());
  91. jEdit.setBooleanProperty("options.sidekick.html.showScriptAttributes", showScriptAttributes.isSelected());
  92. jEdit.setBooleanProperty("options.sidekick.html.showBrackets", showBrackets.isSelected());
  93. jEdit.setBooleanProperty("options.sidekick.html.showAllElements", showAllElements.isSelected());
  94. jEdit.setBooleanProperty("options.sidekick.html.showBlockElements", showBlockElements.isSelected());
  95. jEdit.setBooleanProperty("options.sidekick.html.showJspElements", showJspElements.isSelected());
  96. }
  97. }