forked from facchinm/Arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaretAwareUndoableEdit.java
More file actions
77 lines (60 loc) · 1.64 KB
/
Copy pathCaretAwareUndoableEdit.java
File metadata and controls
77 lines (60 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package processing.app;
import processing.app.syntax.SketchTextArea;
import javax.swing.undo.CannotRedoException;
import javax.swing.undo.CannotUndoException;
import javax.swing.undo.UndoableEdit;
public class CaretAwareUndoableEdit implements UndoableEdit {
private final UndoableEdit undoableEdit;
private final int caretPosition;
public CaretAwareUndoableEdit(UndoableEdit undoableEdit, SketchTextArea textArea) {
this.undoableEdit = undoableEdit;
this.caretPosition = textArea.getCaretPosition();
}
@Override
public void undo() throws CannotUndoException {
undoableEdit.undo();
}
@Override
public boolean canUndo() {
return undoableEdit.canUndo();
}
@Override
public void redo() throws CannotRedoException {
undoableEdit.redo();
}
@Override
public boolean canRedo() {
return undoableEdit.canRedo();
}
@Override
public void die() {
undoableEdit.die();
}
@Override
public boolean addEdit(UndoableEdit undoableEdit) {
return this.undoableEdit.addEdit(undoableEdit);
}
@Override
public boolean replaceEdit(UndoableEdit undoableEdit) {
return this.undoableEdit.replaceEdit(undoableEdit);
}
@Override
public boolean isSignificant() {
return undoableEdit.isSignificant();
}
@Override
public String getPresentationName() {
return undoableEdit.getPresentationName();
}
@Override
public String getUndoPresentationName() {
return undoableEdit.getUndoPresentationName();
}
@Override
public String getRedoPresentationName() {
return undoableEdit.getRedoPresentationName();
}
public int getCaretPosition() {
return caretPosition;
}
}