本文整理汇总了Java中org.openide.actions.UndoAction类的典型用法代码示例。如果您正苦于以下问题:Java UndoAction类的具体用法?Java UndoAction怎么用?Java UndoAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UndoAction类属于org.openide.actions包,在下文中一共展示了UndoAction类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: undo
import org.openide.actions.UndoAction; //导入依赖的package包/类
private void undo() throws Exception {
final UndoAction ua = SystemAction.get(UndoAction.class);
assertNotNull("Cannot obtain UndoAction", ua);
while (ua.isEnabled()) {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
ua.performAction();
}
});
}
}
示例2: updateActions
import org.openide.actions.UndoAction; //导入依赖的package包/类
protected @Override void updateActions() {
addSystemActionMapping(cutAction, javax.swing.text.DefaultEditorKit.cutAction);
addSystemActionMapping(copyAction, javax.swing.text.DefaultEditorKit.copyAction);
addSystemActionMapping(pasteAction, org.openide.actions.PasteAction.class);
// #69077 - DeleteAction now delegates to deleteNextCharAction
addSystemActionMapping(deleteNextCharAction, "delete");
addSystemActionMapping(showPopupMenuAction, org.openide.actions.PopupAction.class);
addSystemActionMapping(gotoAction, org.openide.actions.GotoAction.class);
addSystemActionMapping(undoAction, org.openide.actions.UndoAction.class);
addSystemActionMapping(redoAction, org.openide.actions.RedoAction.class);
}
示例3: actionPerformed
import org.openide.actions.UndoAction; //导入依赖的package包/类
public @Override void actionPerformed(ActionEvent evt, JTextComponent target) {
Document doc = target.getDocument();
if (doc.getProperty(BaseDocument.UNDO_MANAGER_PROP) != null ||
doc.getProperty(UndoManager.class) != null )
{ // Basic way of undo
super.actionPerformed(evt, target);
} else { // Deleagte to system undo action
// Delegate to system undo action
UndoAction ua = (UndoAction)SystemAction.get(UndoAction.class);
if (ua != null && ua.isEnabled()) {
ua.actionPerformed(evt);
}
}
}
示例4: registerEditorActions
import org.openide.actions.UndoAction; //导入依赖的package包/类
private void registerEditorActions() {
registerAction(SystemAction.get(UndoAction.class), "control Z");
registerAction(SystemAction.get(RedoAction.class), "control R");
registerAction(SystemAction.get(org.openide.actions.SaveAction.class), "control S");
registerAction(new TogleCommentAction(editor), "control /");
}