javax.swing.event.UndoableEditListener Java Examples
The following examples show how to use
javax.swing.event.UndoableEditListener.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ComponentEditorManager.java From PIPE with MIT License | 6 votes |
/** * Creates actions for editing the petri net * * @param controller PIPE application controller */ public ComponentEditorManager(PipeApplicationController controller) { copyAction = new CopyAction(controller); pasteAction = new PasteAction(controller); cutAction = new CutAction(controller); deleteAction = new DeleteAction(controller); undoAction = new UndoAction(controller); redoAction = new RedoAction(controller, undoAction); undoAction.registerRedoAction(redoAction); undoAction.setEnabled(false); redoAction.setEnabled(false); UndoableEditListener listener = new SimpleUndoListener(redoAction, undoAction, controller); deleteAction.addUndoableEditListener(listener); copyAction.addUndoableEditListener(listener); cutAction.addUndoableEditListener(listener); pasteAction.addUndoableEditListener(listener); storeEnabledStatus(); }
Example #2
Source File: TextManager.java From jeveassets with GNU General Public License v2.0 | 6 votes |
public static void installTextComponent(final JTextComponent component) { //Make sure this component does not already have a UndoManager Document document = component.getDocument(); boolean found = false; if (document instanceof AbstractDocument) { AbstractDocument abstractDocument = (AbstractDocument) document; for (UndoableEditListener editListener : abstractDocument.getUndoableEditListeners()) { if (editListener.getClass().equals(CompoundUndoManager.class)) { CompoundUndoManager undoManager = (CompoundUndoManager) editListener; undoManager.reset(); return; } } } if (!found) { new TextManager(component); } }
Example #3
Source File: PipeApplicationController.java From PIPE with MIT License | 6 votes |
/** * Register the tab to the Petri net * @param net Petri net * @param tab tab which houses the graphical petri net components * @param historyObserver listener for stepback/forward events in animation * @param undoListener listener for undo/redo events * @param zoomListener listener for zoom events */ //TODO: THIS IS RATHER UGLY, too many params but better than what was here before public void registerTab(PetriNet net, PetriNetTab tab, Observer historyObserver, UndoableEditListener undoListener, PropertyChangeListener zoomListener) { AnimationHistoryImpl animationHistory = new AnimationHistoryImpl(); animationHistory.addObserver(historyObserver); GUIAnimator animator = new GUIAnimator(new PetriNetAnimator(net), animationHistory, this); CopyPasteManager copyPasteManager = new CopyPasteManager(undoListener, tab, net, this); ZoomController zoomController = new ZoomController(100); tab.addZoomListener(zoomController); PetriNetController petriNetController = new PetriNetController(net, undoListener, animator, copyPasteManager, zoomController, tab); netControllers.put(tab, petriNetController); tab.updatePreferredSize(); PropertyChangeListener changeListener = new PetriNetChangeListener(applicationModel, tab, petriNetController); net.addPropertyChangeListener(changeListener); setActiveTab(tab); initialiseNet(net, changeListener); }
Example #4
Source File: CopyPasteManager.java From PIPE with MIT License | 5 votes |
/** * Constructor * * @param listener undoable event listener, used to register undo events to * @param petriNetTab current Petri net tab * @param net underlying Petri net displayed on the Petri net tab * @param applicationController main application controller */ public CopyPasteManager(UndoableEditListener listener, PetriNetTab petriNetTab, PetriNet net, PipeApplicationController applicationController) { this.petriNetTab = petriNetTab; petriNet = net; this.applicationController = applicationController; addMouseListener(this); addMouseMotionListener(this); addKeyListener(this); this.listener = listener; }
Example #5
Source File: TokenActionManager.java From PIPE with MIT License | 5 votes |
/** * Constructor * @param undoListener undo listener * @param applicationModel PIPE application model * @param applicationController PIPE application controller * @param applicationView PIPE application view */ public TokenActionManager(UndoableEditListener undoListener, PipeApplicationModel applicationModel, PipeApplicationController applicationController, PipeApplicationView applicationView) { tokenAction = new AddTokenAction(applicationModel); deleteTokenAction = new DeleteTokenAction(applicationModel); specifyTokenClasses = new SpecifyTokenAction(applicationController, applicationView); tokenAction.addUndoableEditListener(undoListener); deleteTokenAction.addUndoableEditListener(undoListener); specifyTokenClasses.addUndoableEditListener(undoListener); }
Example #6
Source File: AbbrevDetection.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example #7
Source File: UndoRedoWrappingCooperationTest.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example #8
Source File: BaseDocument.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { super.addUndoableEditListener(listener); if (LOG.isLoggable(Level.FINE)) { UndoableEditListener[] listeners = getUndoableEditListeners(); if (listeners.length > 1) { // Having two UE listeners may be dangerous - for example // having two undo managers attached at once will lead to strange errors // since only one of the UMs will work normally while processing // in the other one will be (typically silently) failing. LOG.log(Level.INFO, "Two or more UndoableEditListeners attached", new Exception()); // NOI18N } } }
Example #9
Source File: BaseDocumentTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testRecursiveUndoableEdits() throws Exception { final BaseDocument doc = new BaseDocument(false, "text/plain"); class UEL implements UndoableEditListener, Runnable { boolean undo; @Override public void undoableEditHappened(UndoableEditEvent e) { //doc.runAtomic(this); doc.render(this); undo = e.getEdit().canUndo(); } @Override public void run() { } } UEL uel = new UEL(); doc.addUndoableEditListener(uel); class Atom implements Runnable { @Override public void run() { try { doc.insertString(0, "Ahoj", null); } catch (BadLocationException ex) { throw new IllegalStateException(ex); } } } doc.runAtomicAsUser(new Atom()); assertTrue("Can undo now", uel.undo); }
Example #10
Source File: CompletionImpl.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example #11
Source File: AbstractModel.java From netbeans with Apache License 2.0 | 5 votes |
@Override public synchronized void addUndoableRefactorListener(UndoableEditListener uel) { // savedUndoableEditListeners = ues.getUndoableEditListeners(); if (savedUndoableEditListeners != null) { for (UndoableEditListener saved : savedUndoableEditListeners) { if (saved instanceof UndoManager) { ((UndoManager)saved).discardAllEdits(); } } } ues = new ModelUndoableEditSupport(); ues.addUndoableEditListener(uel); }
Example #12
Source File: MacroDialogSupport.java From netbeans with Apache License 2.0 | 5 votes |
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); } } }
Example #13
Source File: ComponentCreatorManager.java From PIPE with MIT License | 5 votes |
public ComponentCreatorManager(UndoableEditListener undoListener, PipeApplicationModel applicationModel, PipeApplicationController applicationController) { placeAction = new PlaceAction(applicationModel); transAction = new ImmediateTransitionAction(applicationModel); timedtransAction = new TimedTransitionAction(applicationModel); annotationAction = new AnnotationAction(applicationModel); inhibarcAction = new ArcAction("Inhibitor Arc", "Add an inhibitor arc (alt-h)", KeyEvent.VK_H, InputEvent.ALT_DOWN_MASK, new InhibitorSourceVisitor(), new InhibitorCreator(), applicationModel, applicationController, new InhibitorArcHead()); arcAction = new ArcAction("Arc", "Add an arc (alt-a)", KeyEvent.VK_A, InputEvent.ALT_DOWN_MASK, new NormalArcSourceVisitor(), new NormalCreator(applicationController), applicationModel, applicationController, new NormalHead()); rateParameterAction = new SpecifyRateParameterAction(applicationController); placeAction.addUndoableEditListener(undoListener); transAction.addUndoableEditListener(undoListener); timedtransAction.addUndoableEditListener(undoListener); arcAction.addUndoableEditListener(undoListener); inhibarcAction.addUndoableEditListener(undoListener); annotationAction.addUndoableEditListener(undoListener); rateParameterAction.addUndoableEditListener(undoListener); }
Example #14
Source File: SyntaxDocument.java From visualvm with GNU General Public License v2.0 | 5 votes |
public SyntaxDocument(Lexer lexer) { super(); putProperty(PlainDocument.tabSizeAttribute, 4); this.lexer = lexer; // Listen for undo and redo events addUndoableEditListener(new UndoableEditListener() { @Override public void undoableEditHappened(UndoableEditEvent evt) { if (evt.getEdit().isSignificant()) { undo.addEdit(evt.getEdit()); } } }); }
Example #15
Source File: Test6968363.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #16
Source File: Test6968363.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #17
Source File: Test6968363.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #18
Source File: Test6968363.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #19
Source File: ArrayCellEditor.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public void removeUndoableEditListener( final UndoableEditListener listener ) { backend.removeUndoableEditListener( listener ); }
Example #20
Source File: Test6968363.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #21
Source File: Test6968363.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #22
Source File: Test6968363.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #23
Source File: Test6968363.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #24
Source File: Test6968363.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #25
Source File: Test6968363.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #26
Source File: EditorComponentImpl.java From consulo with Apache License 2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener undoableEditListener) { }
Example #27
Source File: Test6968363.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }
Example #28
Source File: Test6968363.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #29
Source File: Test6968363.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
@Override public void removeUndoableEditListener(UndoableEditListener listener) { this.document.removeUndoableEditListener(listener); }
Example #30
Source File: Test6968363.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void addUndoableEditListener(UndoableEditListener listener) { this.document.addUndoableEditListener(listener); }