Changeset 89
- Timestamp:
- 10/10/02 18:43:48 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/j/src/org/armedbear/j/Macro.java
r2 r89 3 3 * 4 4 * Copyright (C) 1998-2002 Peter Graves 5 * $Id: Macro.java,v 1. 1.1.1 2002-09-24 16:07:43piso Exp $5 * $Id: Macro.java,v 1.2 2002-10-10 18:43:48 piso Exp $ 6 6 * 7 7 * This program is free software; you can redistribute it and/or … … 45 45 public synchronized void record(char c) 46 46 { 47 list.add(new Character(c) 47 list.add(new Character(c)); 48 48 } 49 49 50 50 public synchronized void playback() 51 51 { 52 Editor editor = Editor.currentEditor(); 53 CompoundEdit compoundEdit = editor.beginCompoundEdit(); 54 final int size = list.size(); 55 for (int i = 0; i < size; i++) { 56 Object object = list.get(i); 57 if (object instanceof String) 58 editor.executeCommand((String) object); 59 else if (object instanceof Character) 60 editor.insertNormalChar(((Character) object).charValue()); 52 final Editor editor = Editor.currentEditor(); 53 final Buffer buffer = editor.getBuffer(); 54 try { 55 buffer.lockWrite(); 61 56 } 62 editor.getBuffer().endCompoundEdit(compoundEdit); 57 catch (InterruptedException e) { 58 Log.debug(e); 59 return; 60 } 61 try { 62 CompoundEdit compoundEdit = buffer.beginCompoundEdit(); 63 final int size = list.size(); 64 for (int i = 0; i < size; i++) { 65 Object object = list.get(i); 66 if (object instanceof String) 67 editor.executeCommand((String)object); 68 else if (object instanceof Character) 69 editor.insertNormalChar(((Character) object).charValue()); 70 } 71 buffer.endCompoundEdit(compoundEdit); 72 } 73 finally { 74 buffer.unlockWrite(); 75 } 63 76 } 64 77 }
Note: See TracChangeset
for help on using the changeset viewer.