當前位置: 首頁>>代碼示例>>Java>>正文


Java UndoableEditListener.undoableEditHappened方法代碼示例

本文整理匯總了Java中javax.swing.event.UndoableEditListener.undoableEditHappened方法的典型用法代碼示例。如果您正苦於以下問題:Java UndoableEditListener.undoableEditHappened方法的具體用法?Java UndoableEditListener.undoableEditHappened怎麽用?Java UndoableEditListener.undoableEditHappened使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.event.UndoableEditListener的用法示例。


在下文中一共展示了UndoableEditListener.undoableEditHappened方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addEdit

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
private void addEdit(UndoableEdit edit) {
	if (compoundEdits.isEmpty()) {
		UndoableEditEvent editEvent = new UndoableEditEvent(getMainList(), edit);
		for (UndoableEditListener l : editListeners) {
			l.undoableEditHappened(editEvent);
		}
	} else {
		compoundEdits.peek().addEdit(edit);
	}
}
 
開發者ID:mgropp,項目名稱:pdfjumbler,代碼行數:11,代碼來源:UndoableList.java

示例2: sendUndoableEdit

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
void sendUndoableEdit(Document d, UndoableEdit ue) {
    if(d instanceof AbstractDocument) {
        UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
        UndoableEditEvent ev = new UndoableEditEvent(d, ue);
        for(UndoableEditListener uel : uels) {
            uel.undoableEditHappened(ev);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:UndoRedoWrappingCooperationTest.java

示例3: sendUndoableEdit

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
static void sendUndoableEdit(Document d, UndoableEdit ue) {
    if(d instanceof AbstractDocument) {
        UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
        UndoableEditEvent ev = new UndoableEditEvent(d, ue);
        for(UndoableEditListener uel : uels) {
            uel.undoableEditHappened(ev);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:CompletionImpl.java

示例4: sendUndoableEdit

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
private static void sendUndoableEdit(Document d, UndoableEdit ue) {
    if(d instanceof AbstractDocument) {
        UndoableEditListener[] uels = ((AbstractDocument)d).getUndoableEditListeners();
        UndoableEditEvent ev = new UndoableEditEvent(d, ue);
        for(UndoableEditListener uel : uels) {
            uel.undoableEditHappened(ev);
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:10,代碼來源:InstantRenamePerformer.java

示例5: execute

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
/**
 * Runs the specified command by this editor's CommandProcessor, which makes
 * the operation reversible.
 * @param command the command to run
 */
public void execute(Command command) {
  UndoableEditEvent event = new UndoableEditEvent(this, command);
  for (UndoableEditListener l : editListeners) {
    l.undoableEditHappened(event);
  }
  // We need to run() after notifying the UndoManager in order to ensure
  // correct menu behaviour
  command.run();
}
 
開發者ID:ligenzatomas,項目名稱:firebird-vizualization-tool,代碼行數:15,代碼來源:DiagramEditor.java

示例6: fireUndoableEditUpdate

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
protected void fireUndoableEditUpdate(final UndoableEditEvent event) {
    lock.setCallingListeners(true);

    try {
        UndoableEditListener[] listeners = getUndoableEditListeners();
        for (UndoableEditListener listener : listeners) {
            listener.undoableEditHappened(event);
        }
    } finally {
        lock.setCallingListeners(false);
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:AbstractDocument.java

示例7: undoableEditHappened

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
@Override
public void undoableEditHappened(UndoableEditEvent e) {
	// Propagate the event
	for(UndoableEditListener l: undoableEditListeners) {
		l.undoableEditHappened(e);
	}
}
 
開發者ID:BastianW,項目名稱:LichtstrahlenSpiel,代碼行數:8,代碼來源:BeamsOfLightPuzzleBoard.java

示例8: InstantRefactoringPerformer

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
public InstantRefactoringPerformer(final JTextComponent target, int caretOffset, InstantRefactoringUI ui) {
    releaseAll();
    this.target = target;
    this.ui = ui;
    doc = target.getDocument();

    MutablePositionRegion mainRegion = null;
    List<MutablePositionRegion> regions = new ArrayList<>(ui.getRegions().size());

    for (MutablePositionRegion current : ui.getRegions()) {
        // TODO: type parameter name is represented as ident -> ignore surrounding <> in rename
        if (isIn(current, caretOffset)) {
            mainRegion = current;
        } else {
            regions.add(current);
        }
    }

    if (mainRegion == null) {
        throw new IllegalArgumentException("No highlight contains the caret.");
    }

    regions.add(0, mainRegion);

    region = new SyncDocumentRegion(doc, regions);

    if (doc instanceof BaseDocument) {
        BaseDocument bdoc = ((BaseDocument) doc);
        bdoc.addPostModificationDocumentListener(this);
        
        UndoableWrapper wrapper = MimeLookup.getLookup("text/x-java").lookup(UndoableWrapper.class);
        if(wrapper != null) {
            wrapper.setActive(true, this);
        }

        UndoableEdit undo = new CancelInstantRenameUndoableEdit(this);
        for (UndoableEditListener l : bdoc.getUndoableEditListeners()) {
            l.undoableEditHappened(new UndoableEditEvent(doc, undo));
        }
    }

    target.addKeyListener(this);

    target.putClientProperty(InstantRefactoringPerformer.class, this);
    target.putClientProperty("NetBeansEditor.navigateBoundaries", mainRegion); // NOI18N
	
    requestRepaint();
    
    target.select(mainRegion.getStartOffset(), mainRegion.getEndOffset());
    
    span = region.getFirstRegionLength();
    compl = new CompletionLayout(this);
    compl.setEditorComponent(target);
    final KeyStroke OKKS = ui.getKeyStroke();
    target.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(OKKS, OKActionKey);
    Action OKAction = new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            if(registry.contains(InstantRefactoringPerformer.this)) {
                doFullRefactoring();
                target.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(OKKS);
                target.getActionMap().remove(OKActionKey);
            } else {
                target.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).remove(OKKS);
                target.getActionMap().remove(OKActionKey);
            }
        }
    };
    target.getActionMap().put(OKActionKey, OKAction);
    final KeyStroke keyStroke = ui.getKeyStroke();
    compl.showCompletion(ui.getOptions(), caretOffset, Bundle.INFO_PressAgain(getKeyStrokeAsText(keyStroke)));
    
    registry.add(this);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:75,代碼來源:InstantRefactoringPerformer.java

示例9: InstantRenamePerformer

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
/** Creates a new instance of InstantRenamePerformer */
private InstantRenamePerformer(JTextComponent target, Set<Token> highlights, int caretOffset) throws BadLocationException {
    this.target = target;
    doc = target.getDocument();

    MutablePositionRegion mainRegion = null;
    List<MutablePositionRegion> regions = new ArrayList<MutablePositionRegion>();

    for (Token h : highlights) {
        // type parameter name is represented as ident -> ignore surrounding <> in rename
        int delta = h.id() == JavadocTokenId.IDENT && h.text().charAt(0) == '<' && h.text().charAt(h.length() - 1) == '>' ? 1 : 0;
        Position start = NbDocument.createPosition(doc, h.offset(null) + delta, Bias.Backward);
        Position end = NbDocument.createPosition(doc, h.offset(null) + h.length() - delta, Bias.Forward);
        MutablePositionRegion current = new MutablePositionRegion(start, end);
        
        if (isIn(current, caretOffset)) {
            mainRegion = current;
        } else {
            regions.add(current);
        }
    }

    if (mainRegion == null) {
        throw new IllegalArgumentException("No highlight contains the caret.");
    }

    regions.add(0, mainRegion);

    region = new SyncDocumentRegion(doc, regions);

    if (doc instanceof BaseDocument) {
        BaseDocument bdoc = ((BaseDocument) doc);
        bdoc.setPostModificationDocumentListener(this);

        UndoableEdit undo = new CancelInstantRenameUndoableEdit(this);
        for (UndoableEditListener l : bdoc.getUndoableEditListeners()) {
            l.undoableEditHappened(new UndoableEditEvent(doc, undo));
        }
    }

    target.addKeyListener(this);

    target.putClientProperty(InstantRenamePerformer.class, this);
    target.putClientProperty("NetBeansEditor.navigateBoundaries", mainRegion); // NOI18N
	
    requestRepaint();
    
    target.select(mainRegion.getStartOffset(), mainRegion.getEndOffset());
    
    span = region.getFirstRegionLength();
    
    registry.add(this);
    sendUndoableEdit(doc, CloneableEditorSupport.BEGIN_COMMIT_GROUP);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:55,代碼來源:InstantRenamePerformer.java

示例10: fireUndoableEditEvent

import javax.swing.event.UndoableEditListener; //導入方法依賴的package包/類
protected void fireUndoableEditEvent(UndoableEditEvent e) {
  for (UndoableEditListener listener : listeners) {
    listener.undoableEditHappened(e);
  }
}
 
開發者ID:Adrodoc55,項目名稱:MPL,代碼行數:6,代碼來源:UndoableBnStyledDocument.java


注:本文中的javax.swing.event.UndoableEditListener.undoableEditHappened方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。