public override void EditorActionClick(EditorAction.ClickContext context) { //switch( context.Action.Name ) //{ ////case "Undo": //// //scriptEditorControl.Editor.Undo(); //// return; ////case "Redo": //// //scriptEditorControl.Editor.Redo(); //// return; //case "Comment Selection": // scriptEditorControl.CommentUncommentSelection( true ); // break; //case "Uncomment Selection": // scriptEditorControl.CommentUncommentSelection( false ); // break; //case "Rename": // scriptEditorControl.TryShowRenameDialog(); // break; //case "Format Document": // scriptEditorControl.FormatDocument(); // break; //} base.EditorActionClick(context); }
public virtual void EditorActionClick(EditorAction.ClickContext context) { switch (context.Action.Name) { case "Cut": Cut(); break; case "Copy": Copy(); break; case "Paste": Paste(); break; case "Duplicate": TryCloneObjects(); break; case "Delete": TryDeleteObjects(); break; case "Rename": TryRename(); break; } }
public override void EditorActionClick(EditorAction.ClickContext context) { switch (context.Action.Name) { case "Undo": avalonTextEditor.Editor.Undo(); return; case "Redo": avalonTextEditor.Editor.Redo(); return; } base.EditorActionClick(context); }
public static void EditorActionClick(EditorAction.HolderEnum holder, EditorAction action) { var state = EditorActionGetState(holder, action); if (state.Enabled) { var objectsInFocus = state.ObjectsInFocus; //var objectsInFocus = GetObjectsInFocus(); var context = new EditorAction.ClickContext(holder, objectsInFocus, action); //common action.PerformClick(context); //selected document objectsInFocus.DocumentWindow?.Document?.EditorActionClick(context); //selected window objectsInFocus.DocumentWindow?.EditorActionClick(context); //event EditorActionClickEvent?.Invoke(context); } }
public override void EditorActionClick(EditorAction.ClickContext context) { switch (context.Action.Name) { case "Undo": scriptEditorControl.Editor.Undo(); return; case "Redo": scriptEditorControl.Editor.Redo(); return; case "Comment Selection": scriptEditorControl.CommentUncommentSelection(true); return; case "Uncomment Selection": scriptEditorControl.CommentUncommentSelection(false); return; case "Rename": scriptEditorControl.TryShowRenameDialog(); return; case "Format Document": scriptEditorControl.FormatDocument(); return; case "Add Property Code": AddPropertyCode(); return; case "Go To Definition": scriptEditorControl.TryGoToDefinition(); return; } base.EditorActionClick(context); }
public virtual void EditorActionClick(EditorAction.ClickContext context) { switch (context.Action.Name) { case "Save": Save(null); break; case "Save As": { #if !PROJECT_DEPLOY var dialog = new CommonSaveFileDialog(); dialog.InitialDirectory = Path.GetDirectoryName(RealFileName); dialog.DefaultFileName = Path.GetFileName(RealFileName); dialog.Filters.Add(new CommonFileDialogFilter("All Files", ".*")); if (dialog.ShowDialog() != CommonFileDialogResult.Ok) { return; } var saveAsFileName = dialog.FileName; //if( File.Exists( saveAsFileName ) ) //{ // var text = string.Format( EditorLocalization.Translate( "General", "A file with the name \'{0}\' already exists. Overwrite?" ), saveAsFileName ); // if( EditorMessageBox.ShowQuestion( text, MessageBoxButtons.OKCancel ) != DialogResult.OK ) // return; //} if (string.Compare(RealFileName, saveAsFileName, true) == 0) { Save(); } else { Save(saveAsFileName, false); EditorAPI.OpenFileAsDocument(saveAsFileName, true, true); } #endif } break; case "Undo": if (undoSystem != null) { if (undoSystem.DoUndo()) { Modified = true; } } break; case "Redo": if (undoSystem != null) { if (undoSystem.DoRedo()) { Modified = true; } } break; case "Play": { var component = LoadedResource?.ResultComponent; if (component != null && RunSimulation.CheckTypeSupportedByPlayer(component.BaseType)) { if (!EditorAPI.SaveDocuments()) { return; } //if( Modified ) //{ // if( !Save( null ) ) // return; //} //!!!!не только standalone var realFileName = VirtualPathUtility.GetRealPathByVirtual(LoadedResource.Owner.Name); RunSimulation.Run(realFileName, RunSimulation.RunMethod.Player); } } break; case "Find Resource": if (!string.IsNullOrEmpty(RealFileName)) { EditorAPI.SelectFilesOrDirectoriesInMainResourcesWindow(new string[] { RealFileName }); } break; } }
internal void PerformEditorActionClick(EditorAction.ClickContext context) { OnEditorActionClick(context); EditorActionClick?.Invoke(this, context); }
//!!!!надо ли ref bool handled protected virtual void OnEditorActionClick(EditorAction.ClickContext context) { }