javax.swing.undo.CannotUndoException Java Examples
The following examples show how to use
javax.swing.undo.CannotUndoException.
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: ExperimentalMarkerSetNode.java From opensim-gui with Apache License 2.0 | 6 votes |
void setColorUI(final Color color, boolean allowUndo) { final Color oldColor = getColor(); if (allowUndo){ AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){ @Override public void undo() throws CannotUndoException { super.undo(); setColorUI(oldColor, false); } @Override public void redo() throws CannotRedoException { super.redo(); setColorUI(color, true); } }; ExplorerTopComponent.addUndoableEdit(auEdit); } motionDisplayer.setDefaultExperimentalMarkerColor(color); refreshNode(); }
Example #2
Source File: ExperimentalForceSetNode.java From opensim-gui with Apache License 2.0 | 6 votes |
void setColorUI(final Color color, boolean allowUndo) { final Color oldColor = getColor(); if (allowUndo){ AbstractUndoableEdit auEdit = new AbstractUndoableEdit(){ @Override public void undo() throws CannotUndoException { super.undo(); setColorUI(oldColor, false); } @Override public void redo() throws CannotRedoException { super.redo(); setColorUI(color, true); } }; ExplorerTopComponent.addUndoableEdit(auEdit); } motionDisplayer.setDefaultForceColor(color); refreshNode(); }
Example #3
Source File: VectorDataFigureEditor.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override public void deleteFigures(boolean performDelete, Figure... figures) { Debug.trace("VectorDataFigureEditor.deleteFigures " + performDelete + ", " + figures.length); if (vectorDataNode != null) { List<SimpleFeature> simpleFeatures = toSimpleFeatureList(figures); vectorDataNode.getFeatureCollection().removeAll(simpleFeatures); getUndoContext().postEdit(new FigureDeleteEdit(this, performDelete, figures) { @Override public void undo() throws CannotUndoException { super.undo(); vectorDataNode.getFeatureCollection().addAll(simpleFeatures); } @Override public void redo() throws CannotRedoException { super.redo(); vectorDataNode.getFeatureCollection().removeAll(simpleFeatures); } }); } else { // warn super.deleteFigures(performDelete, figures); } }
Example #4
Source File: DiagramScene.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public void undo() throws CannotUndoException { super.undo(); boolean b = scene.getUndoRedoEnabled(); scene.setUndoRedoEnabled(false); scene.getModel().getViewChangedEvent().addListener(this); scene.getModel().setData(oldModel); scene.getModel().getViewChangedEvent().removeListener(this); SwingUtilities.invokeLater(new Runnable() { public void run() { scene.setScrollPosition(oldScrollPosition); } }); scene.setUndoRedoEnabled(b); }
Example #5
Source File: UndoEditBlob.java From energy2d with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void undo() throws CannotUndoException { super.undo(); int n = blob.getPointCount(); for (int i = 0; i < n; i++) { Point2D.Float pi = blob.getPoint(i); newPoints.add(new Point2D.Float(pi.x, pi.y)); } blob.setPoints(oldPoints); view.getModel().refreshPowerArray(); view.getModel().refreshTemperatureBoundaryArray(); view.getModel().refreshMaterialPropertyArrays(); if (view.isViewFactorLinesOn()) view.getModel().generateViewFactorMesh(); view.setSelectedManipulable(selectedManipulable); view.repaint(); }
Example #6
Source File: UndoEditPolygon.java From energy2d with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void undo() throws CannotUndoException { super.undo(); int n = polygon.getVertexCount(); for (int i = 0; i < n; i++) { Point2D.Float pi = polygon.getVertex(i); newPoints.add(new Point2D.Float(pi.x, pi.y)); } polygon.setVertices(oldPoints); view.getModel().refreshPowerArray(); view.getModel().refreshTemperatureBoundaryArray(); view.getModel().refreshMaterialPropertyArrays(); if (view.isViewFactorLinesOn()) view.getModel().generateViewFactorMesh(); view.setSelectedManipulable(selectedManipulable); view.repaint(); }
Example #7
Source File: DocumentTesting.java From netbeans with Apache License 2.0 | 6 votes |
public static void undo(Context context, final int count) throws Exception { final Document doc = getDocument(context); final UndoManager undoManager = (UndoManager) doc.getProperty(UndoManager.class); logUndoRedoOp(context, "UNDO", count); invoke(context, new Runnable() { @Override public void run() { try { int cnt = count; while (undoManager.canUndo() && --cnt >= 0) { undoManager.undo(); } } catch (CannotUndoException e) { throw new IllegalStateException(e); } } }); logPostUndoRedoOp(context, count); }
Example #8
Source File: LauncherUndo.java From osp with GNU General Public License v3.0 | 5 votes |
public void redo() throws CannotUndoException { super.redo(); launcher.postEdits = false; launcher.open(args); launcher.refreshGUI(); launcher.postEdits = true; }
Example #9
Source File: EditAttributeCommand.java From niftyeditor with Apache License 2.0 | 5 votes |
@Override public void undo() throws CannotUndoException { super.undo(); if(toBeEdited == null){ this.editor.getElementEditor().setAttribute(attribute, oldValue); }else{ this.editor.getElementEditor(toBeEdited).setAttribute(attribute, oldValue); } }
Example #10
Source File: DefaultStyledDocument.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); }
Example #11
Source File: UndoGridLines.java From energy2d with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void undo() throws CannotUndoException { super.undo(); newValue = view.isGridOn(); view.setGridOn(oldValue); view.repaint(); }
Example #12
Source File: DefaultStyledDocument.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); }
Example #13
Source File: EditorUndoManager.java From SikuliX1 with MIT License | 5 votes |
@Override public void undo() throws CannotUndoException { if (!canUndo()) { throw new CannotUndoException(); } MyCompoundEdit u=edits.get(pointer); u.undo(); pointer--; refreshControls(); }
Example #14
Source File: GuardedDocumentEvent.java From netbeans with Apache License 2.0 | 5 votes |
public void undo() throws CannotUndoException { GuardedDocument gdoc = (GuardedDocument)getDocument(); boolean origBreak = gdoc.breakGuarded; gdoc.breakGuarded = true; super.undo(); if (!origBreak) { gdoc.breakGuarded = false; } }
Example #15
Source File: DefaultStyledDocument.java From Java8CN with Apache License 2.0 | 5 votes |
/** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); }
Example #16
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
@Override public void actionPerformed(ActionEvent e) { try { undoManager.undo(); } catch (CannotUndoException ex) { Toolkit.getDefaultToolkit().beep(); } }
Example #17
Source File: PencilControl.java From tracker with GNU General Public License v3.0 | 5 votes |
@Override public void undo() throws CannotUndoException { super.undo(); drawer.setScenes(scenes); PencilScene scene = drawer.getSceneAtFrame(trackerPanel.getFrameNumber()); if (scene!=null) { setSelectedScene(scene); } else { goToScene(scenes.get(0)); } trackerPanel.repaint(); }
Example #18
Source File: AddAnchorPointEdit.java From Pixelitor with GNU General Public License v3.0 | 5 votes |
@Override public void undo() throws CannotUndoException { super.undo(); subPath.deleteLast(); comp.repaint(); }
Example #19
Source File: ModifyElementsEdit.java From nextreports-designer with Apache License 2.0 | 5 votes |
@Override public void undo() throws CannotUndoException { super.undo(); BandUtil.insertElements(oldElements, rows, columns); Globals.getReportDesignerPanel().getPropertiesPanel().refresh(); }
Example #20
Source File: GapContent.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public void undo() throws CannotUndoException { super.undo(); try { // Get the Positions in the range being removed. posRefs = getPositionsInRange(null, offset, length); string = getString(offset, length); remove(offset, length); } catch (BadLocationException bl) { throw new CannotUndoException(); } }
Example #21
Source File: UndoRedoTest.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void undo() throws CannotUndoException { if (undoFails) { throw new CannotUndoException(); } undo++; }
Example #22
Source File: GapContent.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public void undo() throws CannotUndoException { super.undo(); try { insertString(offset, string); // Update the Positions that were in the range removed. if(posRefs != null) { updateUndoPositions(posRefs, offset, length); posRefs = null; } string = null; } catch (BadLocationException bl) { throw new CannotUndoException(); } }
Example #23
Source File: GapContent.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public void undo() throws CannotUndoException { super.undo(); try { insertString(offset, string); // Update the Positions that were in the range removed. if(posRefs != null) { updateUndoPositions(posRefs, offset, length); posRefs = null; } string = null; } catch (BadLocationException bl) { throw new CannotUndoException(); } }
Example #24
Source File: MyUndoManager.java From gameserver with Apache License 2.0 | 5 votes |
@Override public synchronized void undo() throws CannotUndoException { super.undo(); for ( UndoRedoListener listener: list ) { listener.redoHappened(); } }
Example #25
Source File: DefaultStyledDocument.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); }
Example #26
Source File: ExplorerTopComponent.java From opensim-gui with Apache License 2.0 | 5 votes |
public void undo() throws CannotUndoException { if (java.awt.EventQueue.isDispatchThread()) { superUndo(); } else { try { Mutex.EVENT.readAccess(runUndo); } catch (MutexException ex) { Exception e = ex.getException(); if (e instanceof CannotUndoException) throw (CannotUndoException) e; else // should not happen, ignore e.printStackTrace(); } } }
Example #27
Source File: InstantRenamePerformer.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void undo() throws CannotUndoException { InstantRenamePerformer perf = performer.get(); if (perf != null) { perf.release(); } }
Example #28
Source File: LauncherUndo.java From osp with GNU General Public License v3.0 | 5 votes |
public void undo() throws CannotUndoException { super.undo(); // set file, node, page and/or URL if((undoFile!=null)&&!undoFile.equals(redoFile)) { // TODO load file } launcher.postEdits = false; int page = (undoPage==null) ? 0 : undoPage.intValue(); launcher.setSelectedNode(undoNode, page, undoURL); launcher.postEdits = true; }
Example #29
Source File: DefaultStyledDocument.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * Undoes a change. * * @exception CannotUndoException if the change cannot be undone */ public void undo() throws CannotUndoException { super.undo(); MutableAttributeSet as = (MutableAttributeSet)element.getAttributes(); as.removeAttributes(as); as.addAttributes(copy); }
Example #30
Source File: JarTreeDialog.java From osp with GNU General Public License v3.0 | 5 votes |
public void undo() throws CannotUndoException { super.undo(); ignoreEvents = true; CheckTreeSelectionModel checkModel = checkManager.getSelectionModel(); checkModel.setSelectionPaths(undo); jarTree.setSelectionRow(undoRow); ignoreEvents = false; refresh(); prevRow = undoRow; }