PageRenderTime 83ms CodeModel.GetById 40ms app.highlight 9ms RepoModel.GetById 32ms 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
  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
 23package javainsight;
 24
 25
 26import javax.swing.Box;
 27import javax.swing.JCheckBox;
 28import javax.swing.JComboBox;
 29import javax.swing.JLabel;
 30import javax.swing.JTextField;
 31
 32import org.gjt.sp.jedit.AbstractOptionPane;
 33import org.gjt.sp.jedit.jEdit;
 34
 35
 36/**
 37 * An option panel for the Java Insight plugin.
 38 *
 39 * @author Dirk Moebius
 40 * @version $Id: JavaInsightOptionPane.java 9456 2007-04-18 20:09:54Z dmoebius $
 41 */
 42public class JavaInsightOptionPane extends AbstractOptionPane
 43{
 44
 45    public JavaInsightOptionPane() {
 46        super("javainsight");
 47    }
 48
 49
 50    @Override
 51    public void _init() {
 52        addSeparator("options.javainsight.decompiler");
 53
 54        cStyle = new JComboBox(new String[] { "sun", "gnu", "pascal" });
 55        cStyle.setSelectedItem(jEdit.getProperty("javainsight.jode.style", "sun"));
 56        addComponent("Coding Style:", cStyle);
 57
 58        addComponent(Box.createVerticalStrut(15));
 59
 60        addComponent(cPretty =
 61            new JCheckBox("Use \"pretty\" names for local variables",
 62                jEdit.getBooleanProperty("javainsight.jode.pretty", true)));
 63
 64        addComponent(cOnetime =
 65            new JCheckBox("Remove locals, that are used only one time",
 66                jEdit.getBooleanProperty("javainsight.jode.onetime", false)));
 67
 68        addComponent(cDecrypt =
 69            new JCheckBox("Decrypt encrypted strings",
 70                jEdit.getBooleanProperty("javainsight.jode.decrypt", true)));
 71
 72        addComponent(Box.createVerticalStrut(15));
 73
 74        addComponent(new JLabel("Generate imports..."));
 75
 76        cImportPkgLimit = new JTextField(jEdit.getProperty("javainsight.jode.pkglimit", "0"));
 77        Box b1 = Box.createHorizontalBox();
 78        b1.add(cImportPkgLimit);
 79        b1.add(new JLabel(" classes"));
 80        addComponent("...for packages with more than", b1);
 81
 82        cImportClassLimit = new JTextField(jEdit.getProperty("javainsight.jode.clslimit", "1"));
 83        Box b2 = Box.createHorizontalBox();
 84        b2.add(cImportClassLimit);
 85        b2.add(new JLabel(" times"));
 86        addComponent("...for classes used more than", b2);
 87
 88        addComponent(Box.createVerticalStrut(5));
 89        addComponent(new JLabel("(0 means generate no imports)"));
 90    }
 91
 92
 93    /**
 94     * Called when the options dialog's `OK' button is pressed.
 95     * This saves any properties saved in this option pane.
 96     */
 97    @Override
 98    public void _save() {
 99        jEdit.setProperty("javainsight.jode.style", cStyle.getSelectedItem().toString());
100        jEdit.setBooleanProperty("javainsight.jode.pretty", cPretty.isSelected());
101        jEdit.setBooleanProperty("javainsight.jode.onetime", cOnetime.isSelected());
102        jEdit.setBooleanProperty("javainsight.jode.decrypt", cDecrypt.isSelected());
103        jEdit.setProperty("javainsight.jode.pkglimit", cImportPkgLimit.getText());
104        jEdit.setProperty("javainsight.jode.clslimit", cImportClassLimit.getText());
105    }
106
107
108    private JComboBox cStyle;
109    private JCheckBox cPretty;
110    private JCheckBox cOnetime;
111    private JCheckBox cDecrypt;
112    private JTextField cImportPkgLimit;
113    private JTextField cImportClassLimit;
114
115}