Lines 57-63
Link Here
|
57 |
import javax.swing.text.*; |
57 |
import javax.swing.text.*; |
58 |
import javax.swing.undo.UndoableEdit; |
58 |
import javax.swing.undo.UndoableEdit; |
59 |
import org.netbeans.api.actions.Openable; |
59 |
import org.netbeans.api.actions.Openable; |
60 |
import org.netbeans.modules.openide.text.NbDocumentRefactoringHack; |
|
|
61 |
import org.openide.DialogDisplayer; |
60 |
import org.openide.DialogDisplayer; |
62 |
import org.openide.NotifyDescriptor; |
61 |
import org.openide.NotifyDescriptor; |
63 |
import org.openide.awt.UndoRedo; |
62 |
import org.openide.awt.UndoRedo; |
Lines 534-566
Link Here
|
534 |
((Annotatable) doc).removeAnnotation(annotation); |
533 |
((Annotatable) doc).removeAnnotation(annotation); |
535 |
} |
534 |
} |
536 |
|
535 |
|
537 |
/** |
536 |
/** |
538 |
* TODO: will be removed after API review |
537 |
* Get an edit of given type that would be undone if an undo operation would be invoked |
|
|
538 |
* at this time for an editor cookie. |
539 |
* <br> |
540 |
* The edit to be undone may be composed from instances of various undoable edit types |
541 |
* (see <a href="@TOP@/org/netbeans/spi/editor/document/UndoableEditWrapper.html">UndoableEditWrapper</a>). |
542 |
* |
543 |
* @param <T> type of undoable edit to be retrieved. |
544 |
* @param ec editor cookie providing an undo/redo manager. |
545 |
* @param type class of undoable edit to be retrieved. |
546 |
* @return undoable edit of given type or null if there is no edit to be undone |
547 |
* or an instance of the given type is not contained in the edit to be undone. |
548 |
* @since 6.47 |
539 |
*/ |
549 |
*/ |
540 |
|
550 |
public static <T> T getEditToBeUndoneOfType(EditorCookie ec, Class<T> type) { |
541 |
static { |
|
|
542 |
NbDocumentRefactoringHack.APIAccessor.DEFAULT = new APIAccessorImpl(); |
543 |
} |
544 |
|
545 |
private static class APIAccessorImpl extends NbDocumentRefactoringHack.APIAccessor { |
546 |
|
547 |
@Override |
548 |
public <T> T getEditToBeUndoneOfType(EditorCookie ec, Class<T> type) { |
549 |
return NbDocument.getEditToBeUndoneOfType(ec, type); |
550 |
} |
551 |
|
552 |
@Override |
553 |
public <T> T getEditToBeRedoneOfType(EditorCookie ec, Class<T> type) { |
554 |
return NbDocument.getEditToBeRedoneOfType(ec, type); |
555 |
} |
556 |
|
557 |
} |
558 |
|
559 |
static <T> T getEditToBeUndoneOfType(EditorCookie ec, Class<T> type) { |
560 |
return getEditToBeUndoneRedoneOfType(ec, type, false); |
551 |
return getEditToBeUndoneRedoneOfType(ec, type, false); |
561 |
} |
552 |
} |
562 |
|
553 |
|
563 |
static <T> T getEditToBeRedoneOfType(EditorCookie ec, Class<T> type) { |
554 |
/** |
|
|
555 |
* Get an edit of given type that would be redone if a redo operation would be invoked |
556 |
* at this time for an editor cookie. |
557 |
* <br> |
558 |
* The edit to be undone may be composed from instances of various undoable edit types |
559 |
* (see <a href="@TOP@/org/netbeans/spi/editor/document/UndoableEditWrapper.html">UndoableEditWrapper</a>). |
560 |
* |
561 |
* @param <T> type of undoable edit to be retrieved. |
562 |
* @param ec editor cookie providing an undo/redo manager. |
563 |
* @param type class of undoable edit to be retrieved. |
564 |
* @return undoable edit of given type or null if there is no edit to be redone |
565 |
* or an instance of the given type is not contained in the edit to be redone. |
566 |
* @since 6.47 |
567 |
*/ |
568 |
public static <T> T getEditToBeRedoneOfType(EditorCookie ec, Class<T> type) { |
564 |
return getEditToBeUndoneRedoneOfType(ec, type, true); |
569 |
return getEditToBeUndoneRedoneOfType(ec, type, true); |
565 |
} |
570 |
} |
566 |
|
571 |
|
Lines 588-595
Link Here
|
588 |
return null; |
593 |
return null; |
589 |
} |
594 |
} |
590 |
|
595 |
|
591 |
//End of TODO |
|
|
592 |
|
593 |
/** |
596 |
/** |
594 |
* Get the document associated with a file. |
597 |
* Get the document associated with a file. |
595 |
* |
598 |
* |