Changeset 14977 in josm for trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java
- Timestamp:
- 2019-04-09T01:32:56+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/widgets/JosmComboBox.java
r14302 r14977 34 34 */ 35 35 public class JosmComboBox<E> extends JComboBox<E> { 36 37 private final ContextMenuHandler handler = new ContextMenuHandler(); 36 38 37 39 /** … … 165 167 166 168 protected final void init(E prototype) { 169 init(prototype, true); 170 } 171 172 protected final void init(E prototype, boolean registerPropertyChangeListener) { 167 173 if (prototype != null) { 168 174 setPrototypeDisplayValue(prototype); … … 186 192 } 187 193 // Handle text contextual menus for editable comboboxes 188 ContextMenuHandler handler = new ContextMenuHandler(); 189 addPropertyChangeListener("editable", handler); 190 addPropertyChangeListener("editor", handler); 194 if (registerPropertyChangeListener) { 195 addPropertyChangeListener("editable", handler); 196 addPropertyChangeListener("editor", handler); 197 } 191 198 } 192 199 … … 232 239 } 233 240 241 private void discardAllUndoableEdits() { 242 if (launcher != null) { 243 launcher.discardAllUndoableEdits(); 244 } 245 } 246 234 247 @Override 235 248 public void mousePressed(MouseEvent e) { … … 250 263 251 264 /** 252 * Reinitializes this {@link JosmComboBox} to the specified values. This may needed if a custom renderer is used.265 * Reinitializes this {@link JosmComboBox} to the specified values. This may be needed if a custom renderer is used. 253 266 * @param values The values displayed in the combo box. 254 267 * @since 5558 255 268 */ 256 269 public final void reinitialize(Collection<E> values) { 257 init(findPrototypeDisplayValue(values)); 270 init(findPrototypeDisplayValue(values), false); 271 discardAllUndoableEdits(); 272 } 273 274 /** 275 * Empties the internal undo manager, if any. 276 * @since 14977 277 */ 278 public final void discardAllUndoableEdits() { 279 handler.discardAllUndoableEdits(); 258 280 } 259 281 }
Note:
See TracChangeset
for help on using the changeset viewer.