PageRenderTime 48ms CodeModel.GetById 44ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre4/macros/Text/Color_Picker.bsh

#
Unknown | 52 lines | 44 code | 8 blank | 0 comment | 0 complexity | a7af75ef9c67c1191a4ee26d805ee0bb MD5 | raw file
 1/*
 2 * Color_Picker.bsh - a BeanShell macro script for the
 3 * jEdit text editor - displays color picker, inserts selected color
 4 * Copyright (C) 2001 Slava Pestov
 5 *
 6 * This program is free software; you can redistribute it and/or
 7 * modify it under the terms of the GNU General Public License
 8 * as published by the Free Software Foundation; either version 2
 9 * of the License, or any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with the jEdit application; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 *
20 * $Id: Color_Picker.bsh 3866 2001-11-06 15:04:21Z jgellene $
21 *
22 *
23 * Checked for jEdit 4.0 API
24 *
25 */
26
27selection = textArea.getSelectedText();
28if (selection != null)
29    color = GUIUtilities.parseColor(selection);
30else
31    color = null;
32
33color = JColorChooser.showDialog(view, "Color Picker", color);
34
35if (color != null)
36    textArea.setSelectedText(GUIUtilities.getColorHexString(color));
37
38/*
39	Macro index data (in DocBook format)
40
41<listitem>
42    <para><filename>Color_Picker.bsh</filename></para>
43    <abstract><para>
44        Displays a color picker and inserts the selected color in
45        hexadecimal format, prefixed with a <quote>#</quote>.
46    </para></abstract>
47</listitem>
48
49*/
50
51// end Color_Picker.bsh
52