Java 8 UndoableEditEvent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 UndoableEditEvent class.

This code example shows how to use the following methods:
     * 
     * @param edit 
     */ 
    protected void registerUndoEvent(UndoableEdit edit) {
        if (listener != null) {
            listener.undoableEditHappened(new UndoableEditEvent(this, edit));
        } 
    } 
 
} 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
		editSupport=new UndoableEditSupport();
		//undoManager=new UndoManager(); 
		editSupport.addUndoableEditListener(this);
	} 
	public void undoableEditHappened(UndoableEditEvent e){
		UndoableEdit edit=e.getEdit();
//		undoManager.addEdit(edit); 
		super.addEdit(edit);
		if (editsModel!=null) editsModel.update();
	} 
 
	public void clear(){ 
//		undoManager.discardAllEdits(); 
		super.discardAllEdits(); 
		nodeMapping.clear();
	} 
 
	public UndoableEditSupport getEditSupport() {
		return editSupport;
	} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
        ActionEvent actionEvent = new ActionEvent(editor, 1, "Redo");
 
        UndoHandler handler = toolBar.new UndoHandler();
 
        UndoableEditEvent event = new UndoableEditEvent(editor, new MockUndoableEdit());
        handler.undoableEditHappened(event);
 
        action.actionPerformed(actionEvent);
    } 
 
    /** 
     * <p>Failure test for method <code>actionPerformed(event)</code>.</p> 
     *  <p>Re-do when it can not re-do.</p> 
     * 
     * @throws Exception to JUnit 
     */ 
    public void testActionPerformedFailure() throws Exception {
        HTMLDocumentationEditorToolBar toolBar = TestHelper.genToolBar(DEFAULT_NS);
        HTMLDocumentationEditor editor = TestHelper.genEditor(DEFAULT_NS);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
        Document doc = getDocument();
 
        // Listen for undo and redo events 
        doc.addUndoableEditListener(new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent evt) {
                undo.addEdit(evt.getEdit());
            } 
        }); 
 
        // Create an undo action and add it to the text component 
        getActionMap().put("Undo",
                new AbstractAction("Undo") {
                    public void actionPerformed(ActionEvent evt) {
                        try { 
                            if (undo.canUndo()) {
                                undo.undo();
                            } 
                        } catch (CannotUndoException ignored) {
                        } 
                    } 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
	 * (non-Javadoc) 
	 *  
	 * @see javax.swing.event.UndoableEditListener#undoableEditHappened(javax.swing.event.UndoableEditEvent) 
	 */ 
	public void undoableEditHappened(UndoableEditEvent arg0) {
		UndoableEdit edit = arg0.getEdit();
		undoManager.addEdit(edit);
	} 
 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
 
        ActionEvent actionEvent = new ActionEvent(editor, 1, "Undo");
 
        UndoHandler handler = toolBar.new UndoHandler();
 
        UndoableEditEvent event = new UndoableEditEvent(editor, new MockUndoableEdit());
        handler.undoableEditHappened(event);
 
        action.actionPerformed(actionEvent);
    } 
 
    /** 
     * <p>Failure test for method <code>actionPerformed(event)</code>.</p> 
     *  <p>Undo when it can not undo.</p> 
     * 
     * @throws Exception to JUnit 
     */ 
    public void testActionPerformedFailure() throws Exception {
        HTMLDocumentationEditorToolBar toolBar = TestHelper.genToolBar(DEFAULT_NS);
        HTMLDocumentationEditor editor = TestHelper.genEditor(DEFAULT_NS);
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
     * javax.swing.event.UndoableEditListener#undoableEditHappened(javax.swing 
     * .event.UndoableEditEvent) 
     */ 
    @Override 
    public void undoableEditHappened(UndoableEditEvent arg0) {
        UndoableEdit edit = arg0.getEdit();
        undoManager.addEdit(edit);
    } 
 
} 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
     */ 
    protected final void registerUndoableEdit(UndoableEdit edit) {
        if (registerMultipleEdits) {
            multipleEdits.add(edit);
        } else { 
            listener.undoableEditHappened(new UndoableEditEvent(this, edit));
        } 
    } 
 
    /** 
     * Any changes made to the Petri net controller will be built up as a 
     * multiple edit. 
     * <p/> 
     * You will need to call finishMultipleEdits() to commit these changes to 
     * the undo listener 
     */ 
    public final void startMultipleEdits() { 
        multipleEdits.clear();
        registerMultipleEdits = true;
    } 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
        Document doc = textcomp.getDocument();
         
        // Listen for undo and redo events 
        doc.addUndoableEditListener(new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent evt) {
                undo.addEdit(evt.getEdit());
            } 
        }); 
         
        // Create an undo action and add it to the text component 
        textcomp.getActionMap().put("Undo",
            new AbstractAction("Undo") {
                private static final long serialVersionUID = -1616574389415095169L;
 
                public void actionPerformed(ActionEvent evt) {
                    try { 
                        if (undo.canUndo()) {
                            undo.undo();
                        } 
                    } catch (CannotUndoException e) {
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getEdit
	 */ 
	@Override 
	public void undoableEditHappened(UndoableEditEvent e) {
		//  Start a new compound edit 
 
		AbstractDocument.DefaultDocumentEvent docEvt = (DefaultDocumentEvent) e.getEdit();
 
		if (compoundEdit == null) {
			compoundEdit = startCompoundEdit(e.getEdit());
			startCombine = false;
			return; 
		} 
 
		int editLine = ((SyntaxDocument)docEvt.getDocument()).getLineNumberAt(docEvt.getOffset());
 
		//  Check for an incremental edit or backspace. 
		//  The Change in Caret position and Document length should both be 
		//  either 1 or -1. 
		if ((startCombine || Math.abs(docEvt.getLength()) == 1) && editLine == lastLine) {
			compoundEdit.addEdit(e.getEdit());

4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 UndoableEditEvent Methods: