1 22 23 package org.gjt.sp.jedit.options; 24 25 import javax.swing.border.*; 27 import javax.swing.*; 28 import java.awt.event.*; 29 import java.awt.*; 30 import java.io.*; 31 import org.gjt.sp.jedit.*; 32 import org.gjt.sp.util.Log; 33 35 public class MouseOptionPane extends AbstractOptionPane 36 { 37 public MouseOptionPane() 39 { 40 super("mouse"); 41 } 43 protected void _init() 45 { 46 47 dragAndDrop = new JCheckBox(jEdit.getProperty( 48 "options.mouse.dragAndDrop")); 49 dragAndDrop.setSelected(jEdit.getBooleanProperty( 50 "view.dragAndDrop")); 51 addComponent(dragAndDrop); 52 53 54 joinNonWordChars = new JCheckBox(jEdit.getProperty( 55 "options.mouse.joinNonWordChars")); 56 joinNonWordChars.setSelected(jEdit.getBooleanProperty( 57 "view.joinNonWordChars")); 58 addComponent(joinNonWordChars); 59 60 61 middleMousePaste = new JCheckBox(jEdit.getProperty("options.mouse" 62 + ".middleMousePaste")); 63 middleMousePaste.setSelected(jEdit.getBooleanProperty( 64 "view.middleMousePaste")); 65 addComponent(middleMousePaste); 66 67 68 int c = clickActionKeys.length; 69 String [] clickActionNames = new String [c]; 70 for(int i = 0; i < c; i++) 71 { 72 clickActionNames[i] = jEdit.getProperty( 73 "options.mouse.gutter."+clickActionKeys[i]); 74 } 75 76 c = clickModifierKeys.length; 77 String [] clickModifierNames = new String [c]; 78 for(int i = 0; i < c; i++) 79 { 80 clickModifierNames[i] = jEdit.getProperty( 81 "options.mouse.gutter."+clickModifierKeys[i]); 82 } 83 84 gutterClickActions = new JComboBox[c]; 85 86 for(int i = 0; i < c; i++) 87 { 88 JComboBox cb = new JComboBox(clickActionNames); 89 gutterClickActions[i] = cb; 90 91 String val = jEdit.getProperty("view.gutter."+clickModifierKeys[i]); 92 for(int j = 0; j < clickActionKeys.length; j++) 93 { 94 if(val.equals(clickActionKeys[j])) 95 { 96 cb.setSelectedIndex(j); 97 } 98 } 99 100 addComponent(clickModifierNames[i],cb); 101 } 102 } 104 public void _save() 106 { 107 jEdit.setBooleanProperty("view.dragAndDrop",dragAndDrop.isSelected()); 108 jEdit.setBooleanProperty("view.joinNonWordChars",joinNonWordChars.isSelected()); 109 jEdit.setBooleanProperty("view.middleMousePaste", 110 middleMousePaste.isSelected()); 111 112 int c = clickModifierKeys.length; 113 for(int i = 0; i < c; i++) 114 { 115 int idx = gutterClickActions[i].getSelectedIndex(); 116 jEdit.setProperty("view.gutter."+clickModifierKeys[i], 117 clickActionKeys[idx]); 118 } 119 } 121 private JCheckBox dragAndDrop; 123 private JCheckBox middleMousePaste; 124 private JCheckBox joinNonWordChars; 125 126 private JComboBox[] gutterClickActions; 127 128 private static final String [] clickActionKeys = new String [] { 130 "toggle-fold", 131 "toggle-fold-fully" 132 }; 133 134 private static final String [] clickModifierKeys = new String [] { 135 "foldClick", 136 "SfoldClick" 137 }; } 139 | Popular Tags |