protected override void Run() { try { string json = Clipboard.GetText(); string classCode = JsonToClassService.GenerateClassCodeFromJson(json); IdeApp.Workbench.ActiveDocument.Editor.InsertAtCaret(classCode); } catch (UninstalledQuicktypeException) { MessageDialog.ShowWarning("Ouch!", "Something has happened. You may not have QuickType installed"); } }
private void GenerateClass() { try { LoadQuicktypePropertiesFromGUI(); var generatedClass = JsonToClassService.GenerateClassCodeFromJson(Clipboard.GetText(), quicktypeProperties); IdeApp.Workbench.ActiveDocument.Editor.InsertAtCaret(generatedClass); } catch (UninstalledQuicktypeException) { MessageDialog.ShowWarning("Ouch!", "Something has happened. You may not have QuickType installed"); } catch (Exception) { IdeApp.Workbench.StatusBar.ShowError("The model could not be generate"); } }
protected override void Run() { try { var projectFolder = (ProjectFolder)IdeApp.ProjectOperations.CurrentSelectedItem; string json = Clipboard.GetText(); var filePath = new FilePath(Path.Combine(projectFolder.Path, ClassOutputName)); string classCode = JsonToClassService.GenerateClassCodeFromJson(json); IdeApp.ProjectOperations.CurrentSelectedProject.CreateAndAddFileToProject(filePath, classCode); } catch (UninstalledQuicktypeException) { MessageDialog.ShowWarning("Ouch!", "Something has happened. You may not have QuickType installed"); } }