public TextStandardActions(JTextComponent textComponent) { this.textComponent = textComponent; this.undoManager = new UndoManager(); initActions(); addPopupItems(); addKeyActions(); registerListeners(); }
private static void makeTextComponentUndoable(JTextComponent textConponent) { final UndoManager undoManager = new UndoManager(); textConponent.getDocument().addUndoableEditListener(new UndoableEditListener() { @Override
final UndoManager undo = new UndoManager(); Document doc = this.getProxy().getDocument();
public ProductSceneView(ProductSceneImage sceneImage) { this(sceneImage, new UndoManager()); }
public UndoPerZone(Zone z) { // All we need to do is register for the Zone.Event.DRAWABLE_REMOVED event so that we can // eliminate that drawable out of the undo list. As of SVN 5771, this is only used by the // CLEAR ALL DRAWINGS function. See ServerMethodHandler.clearAllDrawings() // Using an event handler is the right way to do this, but the DrawableUndoManager would // need to register with every zone as they are created. Tying into that process is too much // intrusion this late in the game. Instead, I'll modify the Zone class to invoke this class // whenever a drawable is removed. The coupling is too tight, but it'll work for 1.3. // This is weird. It seems that this constructor can be called via Reflection when a new Zone is being instantiated by the Hessian library. // That creation process causes null to be passed as the zone so we can't register ourselves as a modelChangeListener for that zone or // we get NPE errors. Instead, we need to let the Zone constructor instantiate use, then add us as a change listener. Seems a little weird // to me, but the whole MapTool as both server/client is weird anyway... zone = z; manager = new UndoManager(); }
UndoManager manager = new UndoManager(); textArea.getDocument().addUndoableEditListener(manager);
(..) public void createUndoMananger() { m_undoManager = new UndoManager(); m_undoManager.setLimit(50); } public void removeUndoMananger() { m_undoManager.end(); } public void focusGained(FocusEvent fe) { //createUndoMananger(); //System.out.println("focusGained()"); } public void focusLost(FocusEvent fe) { //removeUndoMananger(); //System.out.println("focusLost()"); }
UndoableEditListener getUndoableEditListener() { if (undoHandler == null) { undoHandler = new UndoHandler(); undoManager = new UndoManager(); } return undoHandler; }
UndoableEditListener getUndoableEditListener() { if (undoHandler == null) { undoHandler = new UndoHandler(); undoManager = new UndoManager(); } return undoHandler; }
UndoableEditListener getUndoableEditListener() { if (undoHandler == null) { undoHandler = new UndoHandler(); undoManager = new UndoManager(); } return undoHandler; }
UndoableEditListener getUndoableEditListener() { if (undoHandler == null) { undoHandler = new UndoHandler(); undoManager = new UndoManager(); } return undoHandler; }
UndoableEditListener getUndoableEditListener() { if (undoHandler == null) { undoHandler = new UndoHandler(); undoManager = new UndoManager(); } return undoHandler; }
/** * For initializing member variables. */ protected void initialize() { super.initialize(); m_FileChooser = new JFileChooser(); m_FileChooser.setAcceptAllFileFilterUsed(true); m_FileChooser.setMultiSelectionEnabled(false); m_Undo = new UndoManager(); m_Args = new String[0]; }
/** * For initializing member variables. */ protected void initialize() { super.initialize(); m_FileChooser = new JFileChooser(); m_FileChooser.setAcceptAllFileFilterUsed(true); m_FileChooser.setMultiSelectionEnabled(false); m_Undo = new UndoManager(); m_Args = new String[0]; }
public UndoSupportImpl() { m_undoManager = new UndoManager(); m_undoSupport = new UndoableEditSupport(); m_undoSupport.addUndoableEditListener( m_undoManager ); }
public static void registerNewUndoManager(JComponent jtc, Document d) { UndoManager undoManager = new UndoManager(); d.addUndoableEditListener(undoManager); FormUtils.registerUndoRedoActions(jtc, FormUtils.createUndoAction(undoManager, "undo"), FormUtils.createRedoAction(undoManager, "redo")); }
static protected void addUndoRedoSupport(JEditorPane editor) { UndoManager undo = (UndoManager) editor.getClientProperty(UNDO_MANAGER); if (undo == null) { undo = new UndoManager(); editor.putClientProperty(UNDO_MANAGER, undo); Action undoAction = new UndoAction(undo); KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_Z, Event.CTRL_MASK); editor.getInputMap().put(key, "undo"); editor.getActionMap().put("undo", undoAction); Action redoAction = new RedoAction(undo); key = KeyStroke.getKeyStroke(KeyEvent.VK_Z, KeyEvent.CTRL_MASK + KeyEvent.SHIFT_DOWN_MASK); editor.getInputMap().put(key, "redo"); editor.getActionMap().put("redo", redoAction); } Document doc = editor.getDocument(); doc.addUndoableEditListener(undo); }
/** Creates new Notes Text Area Pane */ public NotesTextArea(IMainWindow mw) { super(true); String title = OStrings.getString("GUI_NOTESWINDOW_SUBWINDOWTITLE_Notes"); scrollPane = new DockableScrollPane("NOTES", title, this, true); mw.addDockable(scrollPane); setEditable(false); setText(EXPLANATION); setMinimumSize(new Dimension(100, 50)); JTextPaneLinkifier.linkify(this); undoManager = new UndoManager(); getDocument().addUndoableEditListener(undoManager); }
/** Creates a new instance of XMLEditorPane */ public XMLTextEditor() { super(); XMLEditorKit kit = new XMLEditorKit(); setEditorKitForContentType(XMLEditorKit.XML_MIME_TYPE, kit); setContentType(XMLEditorKit.XML_MIME_TYPE); setBackground(Color.white); //setFont(new Font("Monospaced", Font.PLAIN, 12)); // add undoable edit undoManager = new UndoManager(); UndoableEditListener undoableEditHandler = new UndoableEditListener() { public void undoableEditHappened(UndoableEditEvent e) { undoManager.addEdit(e.getEdit()); } }; getDocument().addUndoableEditListener(undoableEditHandler); }
/** Creates a new instance of XMLEditorPane */ public XMLTextEditor() { super(); XMLEditorKit kit = new XMLEditorKit(); setEditorKitForContentType(XMLEditorKit.XML_MIME_TYPE, kit); setContentType(XMLEditorKit.XML_MIME_TYPE); setBackground(Color.white); //setFont(new Font("Monospaced", Font.PLAIN, 12)); // add undoable edit undoManager = new UndoManager(); UndoableEditListener undoableEditHandler = new UndoableEditListener() { public void undoableEditHappened(UndoableEditEvent e) { undoManager.addEdit(e.getEdit()); } }; getDocument().addUndoableEditListener(undoableEditHandler); }