private void initDocument(Control parent, DesignerHost host) { System.Diagnostics.Trace.WriteLine("Creating document..."); // get the ExtensibleTextEditor instance of the Source code's view textEditor = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <SourceEditorView> ().TextEditor; if (!(parent is WebFormPage)) { throw new NotImplementedException("Only WebFormsPages can have a document for now"); } this.parent = parent; this.host = host; if (!host.Loading) { throw new InvalidOperationException("The document cannot be initialised or loaded unless the host is loading"); } directives = new Hashtable(StringComparer.InvariantCultureIgnoreCase); txtDocDirty = true; suppressSerialization = false; // create and set the event, to let the parser run the first time updateEditorContent = new ManualResetEvent(true); undoTracker = new UndoTracker(); undoHandler = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <IUndoHandler> (); if (undoHandler == null) { throw new NullReferenceException("Could not obtain the IUndoHandler from the SourceEditorView"); } }
protected void OnRedo() { IUndoHandler editable = GetContent <IUndoHandler> (); if (editable != null) { editable.Redo(); } }
public override void Run() { IUndoHandler editable = WorkbenchSingleton.Workbench.ActiveContent as IUndoHandler; if (editable != null) { editable.Redo(); } }
private void menuEditRedo_Click(object sender, EventArgs e) { IUndoHandler h = this.DockPanel.ActiveContent as IUndoHandler; if (h != null && h.CanRedo) { h.Redo(); } }
/// <summary> /// Register a new undo command along with an undo handler. The /// undo handler is used to perform the actual undo or redo /// operation later when requested. /// </summary> /// <param name="cmd">New command to add to the manager.</param> /// <param name="undoHandler">Undo handler to perform the actual undo/redo operation.</param> public void AddUndoCommand(UndoCommand cmd, IUndoHandler undoHandler) { AddUndoCommand(cmd); if (m_undoList.Count > 0) { UndoInfo info = (UndoInfo)m_undoList[m_undoList.Count - 1]; Debug.Assert(info != null); info.m_undoHandler = undoHandler; undoHandler.refreshHistory(m_undoList); } }
public void ResetHandler(object handler) { hUndo = handler as IUndoHandler; hClip = handler as IClipboardHandler; hDelete = handler as IDeleteHandler; hSelectAll = handler as ISelectAllHandler; hFind = handler as IFindReplaceHandler; this.menuUndo.Tag = hUndo != null; this.menuRedo.Tag = hUndo != null; this.menuCut.Tag = hClip != null; this.menuCopy.Tag = hClip != null; this.menuPaste.Tag = hClip != null; this.menuDelete.Tag = hDelete != null; this.menuSelectAll.Tag = hSelectAll != null; this.menuFind.Tag = hFind != null; this.menuReplace.Tag = hFind != null; }
public override void Run() { IUndoHandler editable = WorkbenchSingleton.Workbench.ActiveContent as IUndoHandler; if (editable != null) { editable.Undo(); } else { TextBoxBase textBox = WorkbenchSingleton.ActiveControl as TextBoxBase; if (textBox != null) { textBox.Undo(); } } }
protected void OnUpdateRedo(CommandInfo info) { IUndoHandler textBuffer = GetContent <IUndoHandler> (); info.Enabled = textBuffer != null && textBuffer.EnableRedo; }
private void initDocument (Control parent, DesignerHost host) { System.Diagnostics.Trace.WriteLine ("Creating document..."); // get the ExtensibleTextEditor instance of the Source code's view textEditor = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent<SourceEditorView> ().TextEditor; if (!(parent is WebFormPage)) throw new NotImplementedException ("Only WebFormsPages can have a document for now"); this.parent = parent; this.host = host; if (!host.Loading) throw new InvalidOperationException ("The document cannot be initialised or loaded unless the host is loading"); directives = new Hashtable (StringComparer.InvariantCultureIgnoreCase); txtDocDirty = true; suppressSerialization = false; // create and set the event, to let the parser run the first time updateEditorContent = new ManualResetEvent (true); undoTracker = new UndoTracker (); undoHandler = IdeApp.Workbench.ActiveDocument.PrimaryView.GetContent <IUndoHandler> (); if (undoHandler == null) throw new NullReferenceException ("Could not obtain the IUndoHandler from the SourceEditorView"); }
private void menuEdit_DropDownOpening(object sender, EventArgs e) { IUndoHandler hUndo = this.DockPanel.ActiveContent as IUndoHandler; IClipboardHandler hClip = this.DockPanel.ActiveContent as IClipboardHandler; IDeleteHandler hDelete = this.DockPanel.ActiveContent as IDeleteHandler; ISelectAllHandler hSelectAll = this.DockPanel.ActiveContent as ISelectAllHandler; IFindReplaceHandler hFind = this.DockPanel.ActiveContent as IFindReplaceHandler; if (hUndo != null) { this.menuEditUndo.Enabled = hUndo.CanUndo; this.menuEditRedo.Enabled = hUndo.CanRedo; } else { this.menuEditUndo.Enabled = false; this.menuEditRedo.Enabled = false; } if (hClip != null) { this.menuEditCut.Enabled = hClip.CanCut; this.menuEditCopy.Enabled = hClip.CanCopy; this.menuEditPaste.Enabled = hClip.CanPaste; } else { this.menuEditCut.Enabled = false; this.menuEditCopy.Enabled = false; this.menuEditPaste.Enabled = false; } if (hDelete != null) { this.menuEditDelete.Enabled = hDelete.CanDelete; } else { this.menuEditDelete.Enabled = false; } if (hSelectAll != null) { this.menuEditSelectAll.Enabled = hSelectAll.CanSelectAll; } else { this.menuEditSelectAll.Enabled = false; } if (hFind != null) { this.menuEditFind.Enabled = hFind.CanShowFindDialog; this.menuEditReplace.Enabled = hFind.CanShowReplaceDialog; } else { this.menuEditFind.Enabled = false; this.menuEditReplace.Enabled = false; } }
public UndoInfo() { m_undoCommand = null; m_undoHandler = null; }