Java 8 CompoundEdit - 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 CompoundEdit class.

This code example shows how to use the following methods:addEdit, end
 
		//  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());
			startCombine = false;
			return; 
		} 
 
		//  Not incremental edit, end previous edit and start a new one 
		lastLine = editLine;
 
		compoundEdit.end();
		compoundEdit = startCompoundEdit(e.getEdit());
	} 
 
	/* 
	 **  Each CompoundEdit will store a group of related incremental edits 
	 **  (ie. each character typed or backspaced is an incremental edit) 
5
CodeRank
This code example shows how to use the following methods:addEdit, end
        ||  viewportHeightSpinner.intValue() != map.getViewportHeight();
         
        if(!viewportDimensionsChanged)
            return propertyEdit;
 
        CompoundEdit ce = new CompoundEdit();
        if(propertyEdit != null)
            ce.addEdit(propertyEdit);
         
        ce.addEdit(new MapViewportSettingsEdit(map));
        map.setViewportWidth(viewportWidthSpinner.intValue());
        map.setViewportHeight(viewportHeightSpinner.intValue());
         
        ce.end();
         
        return ce;
    } 
} 
4
CodeRank
This code example shows how to use the following methods:addEdit, end
         
        // if nothing changed, here, simply return what the superclass changed 
        if(!miscLayerSettingsChanged)
            return propertyEdit;
         
        CompoundEdit ce = new CompoundEdit();
        if(propertyEdit != null)
            ce.addEdit(propertyEdit);
         
        try { 
            // determine changes 
            boolean layerResized =
                layerHeight.intValue() != layer.getHeight()
            ||  layerWidth.intValue() != layer.getWidth()
            ; 
 
            boolean layerSettingsChanged = 
                !layer.getName().equals(layerName.getText())
            ||  layer.getTileWidth() != layerTileWidth.intValue()
            ||  layer.getTileHeight() != layerTileHeight.intValue()

4
CodeRank
This code example shows how to use the following methods:
     */ 
    public void testAddEdit_2() { 
        CompoundUndoableAction action = new CompoundUndoableAction("action");
 
        try { 
            action.addEdit(new CompoundEdit());
            fail("IllegalArgumentException is expected.");
        } catch (IllegalArgumentException e) {
            // Ok. 
        } 
    } 
 
    /** 
     * Test method <code>boolean replaceEdit(UndoableEdit edit) </code>. 
     * 
     * <p> 
     * IllegalArgumentException if the passed parameter is not an instance of UndoableAction or is null 
     * </p> 
     */ 
    public void testReplaceEdit_1() { 
4
CodeRank
This code example shows how to use the following methods:end
		@Override 
		public void undo() throws CannotUndoException {
			//  End the edit so future edits don't get absorbed by this edit 
 
			if (compoundEdit != null) {
				compoundEdit.end();
			} 
 
			super.undo(); 
 
			//  Always start a new compound edit after an undo 
 
			compoundEdit = null;
		} 
	} 
 
	/** 
	 * Start to combine the next operations together.  Only the next operation is combined. 
	 * The flag is then automatically reset. 
	 */ 
3
CodeRank
This code example shows how to use the following methods:
     * <p> 
     * Verify that UndoableAbstractAction.addEdit(UndoableEdit) is correct and it always returns false. 
     * </p> 
     */ 
    public void testAddEdit() { 
        assertFalse("The addEdit method should return false.", action.addEdit(new CompoundEdit()));
    } 
 
    /** 
     * <p> 
     * Tests method for 'addEdit(UndoableEdit)' for accuracy. 
     * </p> 
     * 
     * <p> 
     * It tests the case that the UndoableEdit is null and verify that UndoableAbstractAction.addEdit(UndoableEdit) 
     * is correct and it always returns false. 
     * </p> 
     */ 
    public void testAddEditWithNullUndoableEdit() { 
        assertFalse("The addEdit method should return false.", action.addEdit(null));
3
CodeRank
This code example shows how to use the following methods:end
			return false; 
		} 
 
		public void undo() throws CannotUndoException {
			if (compoundEdit != null)
				compoundEdit.end();
			super.undo(); 
			compoundEdit = null;
		} 
	} 
 
	public CompoundUndoManager(JTextComponent editor) {
		this.editor = editor;
		editor.getDocument().addUndoableEditListener(this);
	} 
 
	public void undo() { 
		editor.getDocument().addDocumentListener(this);
		super.undo(); 
		editor.getDocument().removeDocumentListener(this);
3
CodeRank
See Code Examples for Java 8 CompoundEdit Methods: