static string Common(ScintillaControl sci, string sourceText, int ch) { sci.Text = sourceText; sci.Colourise(0, -1); SnippetHelper.PostProcessSnippets(sci, 0); sci.OnSmartIndent(sci, ch); return(sci.Text); }
static string Common(string sourceText, MemberModel currentMember, string newName, ScintillaControl sci) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); ASContext.Context.CurrentMember.Returns(currentMember); CommandFactoryProvider.GetFactory(sci) .CreateExtractLocalVariableCommand(false, newName) .Execute(); return(sci.Text); }
void GenerateExtractVariable(List <SearchMatch> matches) { if (string.IsNullOrEmpty(newName)) { newName = GetNewName(); } if (string.IsNullOrEmpty(newName)) { return; } var sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); try { var expression = sci.SelText.Trim(new char[] { '=', ' ', '\t', '\n', '\r', ';', '.' }); expression = expression.TrimEnd(new char[] { '(', '[', '{', '<' }); expression = expression.TrimStart(new char[] { ')', ']', '}', '>' }); var insertPosition = sci.PositionFromLine(ASContext.Context.CurrentMember.LineTo); foreach (var match in matches) { var position = sci.MBSafePosition(match.Index); insertPosition = Math.Min(insertPosition, position); match.LineText = sci.GetLine(match.Line - 1); } insertPosition = sci.LineFromPosition(insertPosition); insertPosition = sci.LineIndentPosition(insertPosition); RefactoringHelper.ReplaceMatches(matches, sci, newName); sci.SetSel(insertPosition, insertPosition); var member = new MemberModel(newName, string.Empty, FlagType.LocalVar, 0) { Value = expression }; var snippet = TemplateUtils.GetTemplate("Variable"); snippet = TemplateUtils.ReplaceTemplateVariable(snippet, "Modifiers", null); snippet = TemplateUtils.ToDeclarationString(member, snippet); snippet += "$(Boundary)\n$(Boundary)"; SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, snippet); foreach (var match in matches) { match.Line += 1; } Results = new Dictionary <string, List <SearchMatch> > { { sci.FileName, matches } }; if (outputResults) { ReportResults(); } } finally { sci.EndUndoAction(); } }
protected override void ExecutionImplementation() { var sci = PluginBase.MainForm.CurrentDocument.SciControl; var expr = Complete.GetExpression(sci, sci.CurrentPos); var snippet = GetSnippet(sci, expr); var startPosition = expr.StartPosition; sci.SetSel(startPosition, expr.EndPosition); sci.ReplaceSel(string.Empty); SnippetHelper.InsertSnippetText(sci, startPosition, snippet); sci.SetSel(startPosition, startPosition); }
static string Common(string sourceText, string newName, ScintillaControl sci) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); var model = ASContext.Context.GetCodeModel(sourceText); ASContext.Context.CurrentMember.Returns(model.Classes.First().Members.Items.First()); CommandFactoryProvider.GetFactory(sci) .CreateExtractMethodCommand(newName) .Execute(); return(sci.Text); }
static bool Common(string sourceText, ScintillaControl sci) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, sci.Text); var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass; ASContext.Context.CurrentClass.Returns(currentClass); ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault()); return(Provider.CommandFactoryProvider.GetFactory(sci.ConfigurationLanguage).IsValidForConvertForeachToKeyValueIterator(sci)); }
internal static string Common(ScintillaControl sci, string sourceText, string fileName) { sci.Text = sourceText; sci.Colourise(0, -1); // Needed for preprocessor directives... SnippetHelper.PostProcessSnippets(sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, sci.Text); CommandFactoryProvider.GetFactory(sci) .CreateOrganizeImportsCommand() .Execute(); return(sci.Text); }
public string AS3(string sourceText, MemberModel currentMember, string newName) { ASContext.Context.SetAs3Features(); ASContext.Context.CurrentModel.Returns(new FileModel { Context = ASContext.Context }); ASContext.Context.CurrentMember.Returns(currentMember); Sci.Text = sourceText; Sci.ConfigurationLanguage = "as3"; SnippetHelper.PostProcessSnippets(Sci, 0); new ExtractLocalVariableCommand(false, newName).Execute(); return(Sci.Text); }
static EForeach Common(string sourceText, ScintillaControl sci) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, sci.Text); var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass; ASContext.Context.CurrentClass.Returns(currentClass); ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault()); var result = Complete.GetExpression(sci, sci.CurrentPos); return(result); }
bool Common(string sourceText) { Sci.Text = sourceText; SnippetHelper.PostProcessSnippets(Sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, Sci.Text); var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass; ASContext.Context.CurrentClass.Returns(currentClass); ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault()); var target = RefactoringHelper.GetDefaultRefactorTarget(); return(RefactoringHelper.IsPrivateTarget(target)); }
public string Haxe(string sourceText, MemberModel currentMember, string newName, int contextualGeneratorItem) { ASContext.Context.SetHaxeFeatures(); ASContext.Context.CurrentModel.Returns(new FileModel { haXe = true, Context = ASContext.Context }); ASContext.Context.CurrentMember.Returns(currentMember); Sci.Text = sourceText; Sci.ConfigurationLanguage = "haxe"; SnippetHelper.PostProcessSnippets(Sci, 0); var command = (ExtractLocalVariableCommand)CommandFactoryProvider.GetFactory(Sci).CreateExtractLocalVariableCommand(false, newName); command.Execute(); ((CompletionListItem)command.CompletionList[contextualGeneratorItem]).PerformClick(); return(Sci.Text); }
protected static void SetSrc(ScintillaControl sci, string sourceText) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); var currentModel = ASContext.Context.CurrentModel; ASContext.Context.GetCodeModel(currentModel, sci.Text); var line = sci.CurrentLine; var currentClass = currentModel.Classes.FirstOrDefault(line); ASContext.Context.CurrentClass.Returns(currentClass); var currentMember = currentClass?.Members.FirstOrDefault(line); ASContext.Context.CurrentMember.Returns(currentMember); ASGenerator.contextToken = sci.GetWordFromPosition(sci.CurrentPos); }
public Result Common(string sourceText) { ASContext.Context.SetHaxeFeatures(); Sci.ConfigurationLanguage = "haxe"; Sci.Text = sourceText; SnippetHelper.PostProcessSnippets(Sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, Sci.Text); var currentClass = currentModel.Classes.FirstOrDefault() ?? ClassModel.VoidClass; ASContext.Context.CurrentClass.Returns(currentClass); ASContext.Context.CurrentMember.Returns(currentClass.Members.Items.FirstOrDefault()); var target = RefactoringHelper.GetDefaultRefactorTarget(); return(new Result(target.IsPackage, target.Member, target.Type)); }
static public bool HandleElementClose(object data) { if (!GetContext(data)) { return(false); } if (tagContext.Closing) { return(false); } string type = ResolveType(mxmlContext, tagContext.Name); ScintillaNet.ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; if (type.StartsWith("mx.builtin.") || type.StartsWith("fx.builtin.")) // special tags { if (type.EndsWith(".Script")) { string snip = "$(Boundary)\n\t<![CDATA[\n\t$(EntryPoint)\n\t]]>\n</" + tagContext.Name + ">"; SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, snip); return(true); } if (type.EndsWith(".Style")) { string snip = "$(Boundary)"; foreach (string ns in mxmlContext.namespaces.Keys) { string uri = mxmlContext.namespaces[ns]; if (ns != "fx") { snip += String.Format("\n\t@namespace {0} \"{1}\";", ns, uri); } } snip += "\n\t$(EntryPoint)\n</" + tagContext.Name + ">"; SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, snip); return(true); } } return(false); }
public string Haxe(string sourceText, string fileName) { Sci.ConfigurationLanguage = "haxe"; ASContext.Context.SetHaxeFeatures(); ASContext.Context.CurrentModel.Returns(new FileModel { haXe = true, Context = ASContext.Context, FileName = fileName }); Sci.Text = sourceText; SnippetHelper.PostProcessSnippets(Sci, 0); var currentModel = ASContext.Context.CurrentModel; new ASFileParser().ParseSrc(currentModel, Sci.Text); CommandFactoryProvider.GetFactory(Sci) .CreateOrganizeImportsCommand() .Execute(); return(Sci.Text); }
/// <summary> /// 文字入力イベント /// </summary> /// <param name="sci"></param> /// <param name="value"></param> public void OnChar(ScintillaControl sci, Int32 value) { if (!m_showComplete) { return; } switch ((char)value) { case '[': showCompletion(m_compProvider.GenerateCompletionData(this.CurrentSci, (char)value)); SnippetHelper.InsertSnippetText(sci, sci.CurrentPos, "]"); break; case '@': case ' ': case '=': showCompletion(m_compProvider.GenerateCompletionData(this.CurrentSci, (char)value)); break; } }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 1 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* The MIT License (MIT) */ #line default #line hidden #line 2 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* Copyright (c) 1994-2021 The Sage Group plc or its licensors. All rights reserved. */ #line default #line hidden #line 3 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* */ #line default #line hidden #line 4 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* Permission is hereby granted, free of charge, to any person obtaining a copy of */ #line default #line hidden #line 5 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* this software and associated documentation files (the "Software"), to deal in */ #line default #line hidden #line 6 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* the Software without restriction, including without limitation the rights to use, */ #line default #line hidden #line 7 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the */ #line default #line hidden #line 8 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* Software, and to permit persons to whom the Software is furnished to do so, */ #line default #line hidden #line 9 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* subject to the following conditions: */ #line default #line hidden #line 10 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* */ #line default #line hidden #line 11 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* The above copyright notice and this permission notice shall be included in all */ #line default #line hidden #line 12 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* copies or substantial portions of the Software. */ #line default #line hidden #line 13 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* */ #line default #line hidden #line 14 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */ #line default #line hidden #line 15 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A */ #line default #line hidden #line 16 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ #line default #line hidden #line 17 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ #line default #line hidden #line 18 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE */ #line default #line hidden #line 19 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" /* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #line default #line hidden #line 25 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Locals var entityName = view.Properties[BusinessView.Constants.EntityName]; var localEntityName = entityName.Substring(0, 1).ToLower() + entityName.Substring(1); var moduleId = view.Properties[BusinessView.Constants.ModuleId].ToLower(); var copyright = settings.Copyright; var containerName = settings.EntitiesContainerName; var keyFieldName = settings.screenKeyFieldName; var snippet = new StringBuilder(); #line default #line hidden this.Write("/* "); #line 35 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(copyright)); #line default #line hidden this.Write(" */\r\n\r\n// Enable the following commented line to enable TypeScript static type ch" + "ecking\r\n// @ts-check\r\n\r\n\"use strict\";\r\n\r\nvar "); #line 42 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI = "); #line 42 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI || {}\r\n\r\n"); #line 44 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI = {\r\n "); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Model: {},\r\n computedProperties: [],\r\n\r\n /**\r\n * @function\r\n * @nam" + "e init\r\n * @description Primary Initialization Routine\r\n * @namespace "); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n init: function () { \r\n // Initialize " + "the controls and apply kendo bindings \r\n "); #line 57 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initKendoBindings(); \r\n "); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initGrids();\r\n "); #line 59 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initTabs();\r\n "); #line 60 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initFinders();\r\n "); #line 61 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initButtons();\r\n "); #line 62 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initNumericTextboxes();\r\n "); #line 63 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initTextboxes();\r\n "); #line 64 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initTimePickers();\r\n "); #line 65 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initCheckBoxes();\r\n "); #line 66 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.initBlur();\r\n ko.applyBindings("); #line 67 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI."); #line 67 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Model);\r\n },\r\n \r\n /**\r\n * @function\r\n * @name initKendoBindings\r" + "\n * @description Initialization of Kendo bindings\r\n * @namespace "); #line 74 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initKendoBindings: function () {\r\n "); #line 78 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI."); #line 78 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Model = ko.mapping.fromJS("); #line 78 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel); \r\n "); #line 79 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("KoExtn."); #line 79 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("ReportExtension("); #line 79 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI."); #line 79 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Model);\r\n },\r\n\r\n /**\r\n * @function\r\n * @name initGrids\r\n * @des" + "cription Initialize the grids, if any\r\n * @namespace "); #line 86 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initGrids: function () {\r\n\r\n },\r\n\r\n /**\r\n " + " * @function\r\n * @name initTabs\r\n * @description Initialize the tabs," + " if any\r\n * @namespace "); #line 97 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initTabs: function () {\r\n\r\n },\r\n\r\n /**\r\n " + " * @function\r\n * @name initFinders\r\n * @description Initialize the fin" + "ders\r\n * @namespace "); #line 108 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initFinders: function() {\r\n "); #line 112 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Create code for finder snippet = new StringBuilder(); SnippetHelper.FinderJavaScript(8, settings, snippet); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n\r\n /**\r\n * @function\r\n * @name initCheckBoxes\r\n * @descriptio" + "n Set up the change events for check boxes, if any\r\n * @namespace "); #line 127 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initCheckBoxes: function () {\r\n\r\n },\r\n \r\n " + " /**\r\n * @function\r\n * @name initBlur\r\n * @description Set up the blur " + "events, if needed\r\n * @namespace "); #line 138 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initBlur:function() {\r\n\r\n }, \r\n\r\n /**\r\n " + " * @function\r\n * @name initTimePickers\r\n * @description Initialize the" + " time pickers, if any\r\n * @namespace "); #line 149 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initTimePickers: function () {\r\n"); #line 153 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Create code for init timepickers snippet = new StringBuilder(); SnippetHelper.InitTimePickersJavaScript(8, settings, snippet, localEntityName, view); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n\r\n /**\r\n * @function\r\n * @name initNumericTextboxes\r\n * @d" + "escription Initialize the numeric textboxes, if any\r\n * @namespace "); #line 168 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initNumericTextboxes: function () {\r\n"); #line 172 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Create code for init numeric textboxes snippet = new StringBuilder(); SnippetHelper.InitNumericTextboxesJavaScript(8, settings, snippet, view); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n\r\n /**\r\n * @function\r\n * @name initTextboxes\r\n * @descript" + "ion Initialize the textboxes, if any\r\n * @namespace "); #line 187 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initTextboxes: function () {\r\n "); #line 191 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Create code for init textboxes snippet = new StringBuilder(); SnippetHelper.InitTextboxesJavaScript(8, settings, snippet, containerName); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n \r\n /**\r\n * @function\r\n * @name initButtons\r\n * @descri" + "ption Initialize the buttons\r\n * @namespace "); #line 206 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n initButtons: function () {\r\n $(\"#btnPrint" + "\").on(\'click\', function () {\r\n sg.utls.SyncExecute("); #line 211 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.print);\r\n });\r\n"); #line 213 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" // Create code for buttons, if any snippet = new StringBuilder(); SnippetHelper.InitButtonsJavaScript(8, settings, snippet); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n \r\n /**\r\n * @function\r\n * @name print\r\n * @description " + "Print \r\n * @namespace "); #line 228 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI\r\n * @public\r\n */\r\n print: function () {\r\n if (sg.utls.isProc" + "essRunning) {\r\n return;\r\n }\r\n\r\n // Check if form is val" + "id\r\n if ($(\"#frm"); #line 237 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("\").valid()) {\r\n // Check Validations\r\n if ("); #line 239 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.validation()) {\r\n $(\"#message\").empty();\r\n sg.ut" + "ls.clearValidations(\"frm"); #line 241 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("\");\r\n sg.utls.isProcessRunning = true;\r\n\r\n let mode" + "l = "); #line 244 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI."); #line 244 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Model.Data;\r\n let data = sg.utls.ko.toJS(model, "); #line 245 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.computedProperties);\r\n \r\n "); #line 247 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("Repository.execute"); #line 247 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("RepositoryReport(model);\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * @fu" + "nction\r\n * @name validation\r\n * @description Validation \r\n * @namesp" + "ace "); #line 256 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write(@"UI * @public */ validation: function () { var errorRangeMessage = """"; var inputValid = true; if (!inputValid) { if (errorRangeMessage != """") { sg.utls.showMessageInfo(sg.utls.msgType.ERROR, jQuery.validator.format("); #line 265 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write(@"Resources.ErrorFromToValueMessage, errorRangeMessage)); } else if (errorMessage != """") { sg.utls.showMessageInfo(sg.utls.msgType.ERROR, errorMessage); } } return inputValid; } }; // Callbacks var "); #line 277 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("OnSuccess = {\r\n /**\r\n * @function\r\n * @name execute\r\n * @descripti" + "on Open the report result or display a message\r\n * @namespace "); #line 282 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write(@"OnSuccess * @public * * @param {object} result The JSON result payload */ execute: function (result) { if (result !== null && result.UserMessage.IsSuccess) { window.sg.utls.openReport(result.ReportToken); } else { sg.utls.showMessage(result); } } }; // UI Callbacks var "); #line 297 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UISuccess = { \r\n};\r\n\r\n\r\n// Finder success callback\r\nvar onFinderSuccess = {\r\n}" + ";\r\n\r\n// Finder cancel callback\r\nvar onFinderCancel = {\r\n};\r\n\r\n\r\n// Primary page " + "entry point\r\n$(function () {\r\n "); #line 312 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\Behaviour.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("UI.init();\r\n});"); return(this.GenerationEnvironment.ToString()); }
static string Common(ScintillaControl sci, string sourceText, bool skipWS) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); return(sci.GetWordRight(sci.CurrentPos, skipWS)); }
/// <summary> /// The actual process implementation /// </summary> protected void ExecutionImplementation() { ScintillaControl sci = PluginBase.MainForm.CurrentDocument.SciControl; sci.BeginUndoAction(); try { string selection = sci.SelText; if (string.IsNullOrEmpty(selection)) { return; } if (selection.TrimStart().Length == 0) { return; } sci.SetSel(sci.SelectionStart + selection.Length - selection.TrimStart().Length, sci.SelectionEnd); sci.CurrentPos = sci.SelectionEnd; selection = sci.SelText; int lineStart = sci.LineFromPosition(sci.SelectionStart); int lineEnd = sci.LineFromPosition(sci.SelectionEnd); int firstLineIndent = sci.GetLineIndentation(lineStart); int entryPointIndent = 0; string snippet = GetSnippet(SnippetCode, sci.ConfigurationLanguage, sci.Encoding); int pos = snippet.IndexOfOrdinal("{0}"); if (pos > -1) { while (pos >= 0) { string c = snippet.Substring(--pos, 1); if (c.Equals("\t")) { entryPointIndent += sci.Indent; } else { break; } } } for (int i = lineStart; i <= lineEnd; i++) { int indent = sci.GetLineIndentation(i); if (i > lineStart) { sci.SetLineIndentation(i, indent - firstLineIndent + entryPointIndent); } } snippet = snippet.Replace("{0}", sci.SelText); int insertPos = sci.SelectionStart; int selEnd = sci.SelectionEnd; sci.SetSel(insertPos, selEnd); SnippetHelper.InsertSnippetText(sci, insertPos, snippet); } finally { sci.EndUndoAction(); } }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 1 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* The MIT License (MIT) */ #line default #line hidden #line 2 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* Copyright (c) 1994-2021 The Sage Group plc or its licensors. All rights reserved. */ #line default #line hidden #line 3 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* */ #line default #line hidden #line 4 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* Permission is hereby granted, free of charge, to any person obtaining a copy of */ #line default #line hidden #line 5 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* this software and associated documentation files (the "Software"), to deal in */ #line default #line hidden #line 6 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* the Software without restriction, including without limitation the rights to use, */ #line default #line hidden #line 7 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the */ #line default #line hidden #line 8 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* Software, and to permit persons to whom the Software is furnished to do so, */ #line default #line hidden #line 9 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* subject to the following conditions: */ #line default #line hidden #line 10 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* */ #line default #line hidden #line 11 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* The above copyright notice and this permission notice shall be included in all */ #line default #line hidden #line 12 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* copies or substantial portions of the Software. */ #line default #line hidden #line 13 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* */ #line default #line hidden #line 14 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */ #line default #line hidden #line 15 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A */ #line default #line hidden #line 16 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ #line default #line hidden #line 17 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ #line default #line hidden #line 18 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE */ #line default #line hidden #line 19 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" /* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #line default #line hidden #line 26 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" // Locals var entityName = view.Properties[BusinessView.Constants.EntityName]; var moduleId = settings.ModuleId; var copyright = settings.Copyright; var resxName = view.Properties[BusinessView.Constants.ResxName]; var companyNamespace = settings.CompanyNamespace; var keyFieldName = view.Keys.FirstOrDefault(); var modelName = view.Properties[BusinessView.Constants.ModelName]; var webModuleNamespace = (settings.DoesAreasExist ? (settings.WebProjectIncludesModule ? moduleId + "." : string.Empty) + "Web.Areas." + moduleId : moduleId + ".Web"); var xmlLayout = settings.XmlLayout; #line default #line hidden this.Write("@* "); #line 39 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(copyright)); #line default #line hidden this.Write(" *@\r\n\r\n@using Sage.CA.SBS.ERP.Sage300.Common.Web.HtmlHelperExtension\r\n@using Comm" + "onResx = Sage.CA.SBS.ERP.Sage300.Common.Resources.CommonResx\r\n@using "); #line 43 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("Resx = "); #line 43 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 43 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Resources.Reports."); #line 43 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("Resx\r\n\r\n@model "); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(webModuleNamespace)); #line default #line hidden this.Write(".Models.Reports."); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel<"); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Models.Reports."); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(modelName)); #line default #line hidden this.Write(">\r\n\r\n<script type=\"text/javascript\">\r\n @Html.ConvertToJsVariableUsingNewtonSof" + "t(\""); #line 48 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel\", Model)\r\n @Html.ConvertToJsVariableUsingNewtonSoft(\"screenName\", "); #line 49 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write(@".Entity); </script> <div class=""form-screen""> <div id=""message""></div> <header> <section class=""header-group-1""> <div class=""header-wrapper""> <div class=""header-headline""> @Html.SageHeader3Label(""lbl"); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("\", "); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write(".Entity)\r\n </div>\r\n </div>\r\n </section>\r\n </h" + "eader>\r\n "); #line 63 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" if (xmlLayout == null) { WriteLine(new string(' ', 4) + "<div class=\"form-group\">"); } #line default #line hidden this.Write(" "); #line 69 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" if (xmlLayout != null) { // XML Layout has been specified and therefore generate layout // Counter for indentation int depth = 0; // Get first element and proceed if there are elements specified var element = xmlLayout.Root.Descendants().First(); // Iterate xml and apply snippets directly to template if (element.HasElements) { // Recursion var snippet = new StringBuilder(); SnippetHelper.GenerateWidgets(depth, element, snippet, settings, view); WriteLine(snippet.ToString()); } } #line default #line hidden this.Write(" "); #line 90 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\View\Entity.tt" if (xmlLayout == null) { WriteLine(new string(' ', 4) + "</div>"); } #line default #line hidden this.Write(" <section class=\"footer-group-1\">\r\n @Html.KoSageButton(\"btnPrint\", null" + ", new { @id = \"btnPrint\", @class = \"btn btn-primary\", @value = CommonResx.Print " + "})\r\n </section>\r\n\r\n</div>"); return(this.GenerationEnvironment.ToString()); }
static int Common(string sourceText, ScintillaControl sci) { sci.Text = sourceText; SnippetHelper.PostProcessSnippets(sci, 0); return(Complete.GetStartOfIfStatement(sci, sci.CurrentPos)); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 1 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* The MIT License (MIT) */ #line default #line hidden #line 2 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* Copyright (c) 1994-2021 The Sage Group plc or its licensors. All rights reserved. */ #line default #line hidden #line 3 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* */ #line default #line hidden #line 4 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* Permission is hereby granted, free of charge, to any person obtaining a copy of */ #line default #line hidden #line 5 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* this software and associated documentation files (the "Software"), to deal in */ #line default #line hidden #line 6 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* the Software without restriction, including without limitation the rights to use, */ #line default #line hidden #line 7 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the */ #line default #line hidden #line 8 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* Software, and to permit persons to whom the Software is furnished to do so, */ #line default #line hidden #line 9 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* subject to the following conditions: */ #line default #line hidden #line 10 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* */ #line default #line hidden #line 11 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* The above copyright notice and this permission notice shall be included in all */ #line default #line hidden #line 12 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* copies or substantial portions of the Software. */ #line default #line hidden #line 13 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* */ #line default #line hidden #line 14 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */ #line default #line hidden #line 15 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A */ #line default #line hidden #line 16 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ #line default #line hidden #line 17 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ #line default #line hidden #line 18 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE */ #line default #line hidden #line 19 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" /* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #line default #line hidden #line 26 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" // Locals var entityName = view.Properties[BusinessView.Constants.EntityName]; var resxName = view.Properties[BusinessView.Constants.ResxName]; var moduleId = settings.ModuleId; var copyright = settings.Copyright; var companyNamespace = settings.CompanyNamespace; var keyFieldName = view.Keys.FirstOrDefault(); var modelName = view.Properties[BusinessView.Constants.ModelName]; var webModuleNamespace = (settings.DoesAreasExist ? (settings.WebProjectIncludesModule ? moduleId + "." : string.Empty) + "Web.Areas." + moduleId : moduleId + ".Web"); var xmlLayout = settings.XmlLayout; #line default #line hidden this.Write("@* "); #line 41 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(copyright)); #line default #line hidden this.Write(" *@\r\n"); #line 42 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" if (view.Options[BusinessView.Constants.GenerateGrid]) { #line default #line hidden this.Write("\t@model "); #line 46 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 46 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(webModuleNamespace)); #line default #line hidden this.Write(".Models."); #line 46 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel\r\n"); #line 47 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" } else { #line default #line hidden this.Write("\t@model "); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(webModuleNamespace)); #line default #line hidden this.Write(".Models."); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel<"); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Models."); #line 52 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(modelName)); #line default #line hidden this.Write(">\r\n"); #line 53 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" } #line default #line hidden this.Write("\r\n@using "); #line 57 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write(" = "); #line 57 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 57 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Resources.Forms."); #line 57 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write("\r\n@using "); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Web.Areas."); #line 58 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(@".Constants @using Sage.CA.SBS.ERP.Sage300.Common.Web.AreaConstants @using Sage.CA.SBS.ERP.Sage300.Common.Resources @using Sage.CA.SBS.ERP.Sage300.Common.Web.HtmlHelperExtension @using Sage.CA.SBS.ERP.Sage300.Common.Models.Enums @using AnnotationsResx = Sage.CA.SBS.ERP.Sage300.Common.Resources.AnnotationsResx <script type=""text/javascript""> @Html.ConvertToJsVariableUsingNewtonSoft("""); #line 67 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel\", Model)\r\n</script>\r\n\r\[email protected](\"~/Areas/"); #line 70 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write("/Views/"); #line 70 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write(@"/Partials/_Localization.cshtml"") <div id=""success"" class=""message""></div> <div class=""form-screen""> <div id=""message""></div> <header> <section class=""header-group-1""> <div class=""header-wrapper""> <div class=""header-headline""> @Html.SageHeader1Label("""); #line 80 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("Header\", "); #line 80 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write(".Entity)\r\n </div>\r\n @Html.Partial(Core.OptionsMenu," + " Model.UserAccess)\t\r\n\t"); #line 83 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" if (!view.Options[BusinessView.Constants.GenerateGrid]) { #line default #line hidden this.Write(@" <div class=""header-options""> @if (Model.UserAccess.SecurityType.HasFlag(SecurityType.Modify)) { @Html.KoSageButton(""btnNew"", null, new { @value = CommonResx.CreateNew, @id = ""btnNew"", @class = ""btn btn-primary"" }) } </div> "); #line 93 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" } #line default #line hidden this.Write(" </div>\r\n <div class=\"flag-required\">\r\n <spa" + "n class=\"req-option\">@CommonResx.RequiredLegend</span>\r\n </div>\r\n " + " </section>\r\n </header>\r\n"); #line 102 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" if (xmlLayout == null) { WriteLine(new string(' ', 4) + "<div class=\"form-group\">"); } #line default #line hidden #line 108 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" if (view.Options[BusinessView.Constants.GenerateGrid]) { var gridName = entityName.Substring(0, 1).ToLower() + entityName.Substring(1); WriteLine("@Html.SageGrid(\"{0}Grid\", (Sage.CA.SBS.ERP.Sage300.Common.Models.GridDefinition)@ViewBag.{1}Grid)", gridName, view.Properties[BusinessView.Constants.EntityName]); } else if (xmlLayout != null) { // XML Layout has been specified and therefore generate layout using this instead of generating // only the key field // Counter for indentation int depth = 0; // Get first element and proceed if there are elements specified var element = xmlLayout.Root.Descendants().First(); // Iterate xml and apply snippets directly to template if (element.HasElements) { // Recursion var snippet = new StringBuilder(); SnippetHelper.GenerateWidgets(depth, element, snippet, settings, view); WriteLine(snippet.ToString()); } } else { // No XML layout specified, therefore we will no longer generate only the key field } if (xmlLayout == null) { WriteLine(new string(' ', 4) + "</div>"); } #line default #line hidden this.Write(@" <section class=""footer-group-1""> @if (Model.UserAccess.SecurityType.HasFlag(SecurityType.Modify)) { @Html.KoSageButton(""btnSave"", new { }, new { @value = CommonResx.Save, @id = ""btnSave"", @class = ""btn btn-primary"" }) "); #line 148 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" if (!view.Options[BusinessView.Constants.GenerateGrid]) { #line default #line hidden this.Write("\t\t\[email protected](\"btnDelete\", new { }, new { @value = CommonResx.Delete, @id" + " = \"btnDelete\", @class = \"btn btn-primary\" })\r\n"); #line 153 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Flat\View\Entity.tt" } #line default #line hidden this.Write(" }\r\n </section>\r\n</div>"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 1 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* The MIT License (MIT) */ #line default #line hidden #line 2 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* Copyright (c) 1994-2021 The Sage Group plc or its licensors. All rights reserved. */ #line default #line hidden #line 3 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* */ #line default #line hidden #line 4 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* Permission is hereby granted, free of charge, to any person obtaining a copy of */ #line default #line hidden #line 5 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* this software and associated documentation files (the "Software"), to deal in */ #line default #line hidden #line 6 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* the Software without restriction, including without limitation the rights to use, */ #line default #line hidden #line 7 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the */ #line default #line hidden #line 8 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* Software, and to permit persons to whom the Software is furnished to do so, */ #line default #line hidden #line 9 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* subject to the following conditions: */ #line default #line hidden #line 10 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* */ #line default #line hidden #line 11 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* The above copyright notice and this permission notice shall be included in all */ #line default #line hidden #line 12 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* copies or substantial portions of the Software. */ #line default #line hidden #line 13 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* */ #line default #line hidden #line 14 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */ #line default #line hidden #line 15 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A */ #line default #line hidden #line 16 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ #line default #line hidden #line 17 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ #line default #line hidden #line 18 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE */ #line default #line hidden #line 19 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" /* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #line default #line hidden #line 25 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" // Locals var entityName = view.Properties[BusinessView.Constants.EntityName]; var localEntityName = entityName.Substring(0, 1).ToLower() + entityName.Substring(1); var moduleId = view.Properties[BusinessView.Constants.ModuleId].ToLower(); var copyright = settings.Copyright; var snippet = new StringBuilder(); #line default #line hidden this.Write("/* "); #line 33 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(copyright)); #line default #line hidden this.Write(" */\r\n\r\n// Enable the following commented line to enable TypeScript static type ch" + "ecking\r\n// @ts-check\r\n\r\n\"use strict\";\r\n\r\nvar "); #line 40 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("KoExtn = "); #line 40 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("KoExtn || {};\r\n\r\n"); #line 42 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("KoExtn = {\r\n /**\r\n * @function \r\n * @name "); #line 45 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("ReportExtension\r\n * @description Knockout extensions\r\n * @namespace "); #line 47 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("KoExtn\r\n * @public \r\n * \r\n * @param model\r\n */\r\n \r\n "); #line 53 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" this.Write(this.ToStringHelper.ToStringWithCulture(localEntityName)); #line default #line hidden this.Write("ReportExtension: function (model) {\r\n \r\n // Computed Fields go here\r\n"); #line 56 "C:\Development\Branches\SDK\Sage300-SDK\src\wizards\CodeGenerationWizard\Templates\Reports\Script\KoExtn.tt" // Create disabled properties snippet = new StringBuilder(); SnippetHelper.DisabledPropertiesJavaScript(4, settings, snippet, view, localEntityName); if (!string.IsNullOrEmpty(snippet.ToString())) { WriteLine(snippet.ToString()); } #line default #line hidden this.Write(" },\r\n\r\n};"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Create the template output /// </summary> public virtual string TransformText() { #line 1 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* The MIT License (MIT) */ #line default #line hidden #line 2 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* Copyright (c) 1994-2021 The Sage Group plc or its licensors. All rights reserved. */ #line default #line hidden #line 3 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* */ #line default #line hidden #line 4 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* Permission is hereby granted, free of charge, to any person obtaining a copy of */ #line default #line hidden #line 5 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* this software and associated documentation files (the "Software"), to deal in */ #line default #line hidden #line 6 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* the Software without restriction, including without limitation the rights to use, */ #line default #line hidden #line 7 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the */ #line default #line hidden #line 8 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* Software, and to permit persons to whom the Software is furnished to do so, */ #line default #line hidden #line 9 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* subject to the following conditions: */ #line default #line hidden #line 10 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* */ #line default #line hidden #line 11 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* The above copyright notice and this permission notice shall be included in all */ #line default #line hidden #line 12 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* copies or substantial portions of the Software. */ #line default #line hidden #line 13 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* */ #line default #line hidden #line 14 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, */ #line default #line hidden #line 15 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A */ #line default #line hidden #line 16 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT */ #line default #line hidden #line 17 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF */ #line default #line hidden #line 18 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE */ #line default #line hidden #line 19 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" /* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #line default #line hidden #line 27 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" // Locals var entityName = settings.EntitiesContainerName; var resxName = view.Properties[BusinessView.Constants.ResxName]; var moduleId = settings.ModuleId; var copyright = settings.Copyright; var companyNamespace = settings.CompanyNamespace; var modelName = view.Properties[BusinessView.Constants.ModelName]; var webModuleNamespace = (settings.DoesAreasExist ? (settings.WebProjectIncludesModule ? moduleId + "." : string.Empty) + "Web.Areas." + moduleId : moduleId + ".Web"); var xmlLayout = settings.XmlLayout; #line default #line hidden this.Write("@* "); #line 39 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(copyright)); #line default #line hidden this.Write(@" *@ @using Sage.CA.SBS.ERP.Sage300.Common.Web.AreaConstants @using Sage.CA.SBS.ERP.Sage300.Common.Models.Enums @using Sage.CA.SBS.ERP.Sage300.Common.Web.HtmlHelperExtension @using CommonResx = Sage.CA.SBS.ERP.Sage300.Common.Resources.CommonResx @using AnnotationsResx = Sage.CA.SBS.ERP.Sage300.Common.Resources.AnnotationsResx @using "); #line 46 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write(" = "); #line 46 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 46 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Resources.Forms."); #line 46 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(resxName)); #line default #line hidden this.Write("\r\n@using "); #line 47 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 47 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Web.Areas."); #line 47 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(moduleId)); #line default #line hidden this.Write(".Constants\r\n\r\n@model "); #line 49 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(companyNamespace)); #line default #line hidden this.Write("."); #line 49 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(webModuleNamespace)); #line default #line hidden this.Write(".Models."); #line 49 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" this.Write(this.ToStringHelper.ToStringWithCulture(entityName)); #line default #line hidden this.Write("ViewModel\r\n\r\n<div>\r\n"); #line 52 "C:\Development\Branches\UIWizard\Columbus-Innovation\src\wizards\CodeGenerationWizard\Templates\HeaderDetail\View\PartialEntity.tt" // Counter for indentation int depth = 0; // Iterate xml and apply snippets directly to template if (element.HasElements) { // Recursion var snippet = new StringBuilder(); SnippetHelper.GenerateWidgets(depth, element, snippet, settings, view); WriteLine(snippet.ToString()); } #line default #line hidden this.Write("</div>"); return(this.GenerationEnvironment.ToString()); }
/// <summary> /// Inserts text from the snippets class /// </summary> public static Boolean InsertTextByWord(String word, Boolean emptyUndoBuffer) { ScintillaControl sci = Globals.SciControl; if (sci == null) { return(false); } Boolean canShowList = false; String snippet = null; if (word == null) { canShowList = true; word = sci.GetWordFromPosition(sci.CurrentPos); } if (word != null && word.Length > 0) { snippet = GetSnippet(word, sci.ConfigurationLanguage, sci.Encoding); } // let plugins handle the snippet Hashtable data = new Hashtable(); data["word"] = word; data["snippet"] = snippet; DataEvent de = new DataEvent(EventType.Command, "SnippetManager.Expand", data); EventManager.DispatchEvent(Globals.MainForm, de); if (de.Handled) { return(true); } snippet = (string)data["snippet"]; if (!String.IsNullOrEmpty(sci.SelText)) { // Remember the previous selection ArgsProcessor.PrevSelText = sci.SelText; } if (snippet != null) { Int32 endPos = sci.SelectionEnd; Int32 startPos = sci.SelectionStart; String curWord = sci.GetWordFromPosition(endPos); if (startPos == endPos) { endPos = sci.WordEndPosition(sci.CurrentPos, true); startPos = sci.WordStartPosition(sci.CurrentPos, true); sci.SetSel(startPos, endPos); } if (!String.IsNullOrEmpty(curWord)) { // Remember the current word ArgsProcessor.PrevSelWord = curWord; } SnippetHelper.InsertSnippetText(sci, endPos, snippet); return(true); } else if (canShowList) { ICompletionListItem item; List <ICompletionListItem> items = new List <ICompletionListItem>(); PathWalker walker = new PathWalker(PathHelper.SnippetDir, "*.fds", false); List <String> files = walker.GetFiles(); foreach (String file in files) { item = new SnippetItem(Path.GetFileNameWithoutExtension(file), file); items.Add(item); } String path = Path.Combine(PathHelper.SnippetDir, sci.ConfigurationLanguage); if (Directory.Exists(path)) { walker = new PathWalker(path, "*.fds", false); files = walker.GetFiles(); foreach (String file in files) { item = new SnippetItem(Path.GetFileNameWithoutExtension(file), file); items.Add(item); } } if (items.Count > 0) { items.Sort(); if (!String.IsNullOrEmpty(sci.SelText)) { word = sci.SelText; } else { word = sci.GetWordFromPosition(sci.CurrentPos); if (word == null) { word = String.Empty; } } CompletionList.OnInsert += new InsertedTextHandler(HandleListInsert); CompletionList.OnCancel += new InsertedTextHandler(HandleListInsert); CompletionList.Show(items, false, word); return(true); } } return(false); }
public void Execute() { Sci = PluginBase.MainForm.CurrentDocument.SciControl; Sci.BeginUndoAction(); try { IASContext context = ASContext.Context; Int32 pos = Sci.CurrentPos; string expression = Sci.SelText.Trim(new char[] { '=', ' ', '\t', '\n', '\r', ';', '.' }); expression = expression.TrimEnd(new char[] { '(', '[', '{', '<' }); expression = expression.TrimStart(new char[] { ')', ']', '}', '>' }); cFile = ASContext.Context.CurrentModel; ASFileParser parser = new ASFileParser(); parser.ParseSrc(cFile, Sci.Text); MemberModel current = cFile.Context.CurrentMember; string characterClass = ScintillaControl.Configuration.GetLanguage(Sci.ConfigurationLanguage).characterclass.Characters; int funcBodyStart = ASGenerator.GetBodyStart(current.LineFrom, current.LineTo, Sci); Sci.SetSel(funcBodyStart, Sci.LineEndPosition(current.LineTo)); string currentMethodBody = Sci.SelText; bool isExprInSingleQuotes = (expression.StartsWith("'") && expression.EndsWith("'")); bool isExprInDoubleQuotes = (expression.StartsWith("\"") && expression.EndsWith("\"")); int stylemask = (1 << Sci.StyleBits) - 1; int lastPos = -1; char prevOrNextChar; Sci.Colourise(0, -1); while (true) { lastPos = currentMethodBody.IndexOf(expression, lastPos + 1); if (lastPos > -1) { if (lastPos > 0) { prevOrNextChar = currentMethodBody[lastPos - 1]; if (characterClass.IndexOf(prevOrNextChar) > -1) { continue; } } if (lastPos + expression.Length < currentMethodBody.Length) { prevOrNextChar = currentMethodBody[lastPos + expression.Length]; if (characterClass.IndexOf(prevOrNextChar) > -1) { continue; } } int style = Sci.StyleAt(funcBodyStart + lastPos) & stylemask; if (ASComplete.IsCommentStyle(style)) { continue; } else if ((isExprInDoubleQuotes && currentMethodBody[lastPos] == '"' && currentMethodBody[lastPos + expression.Length - 1] == '"') || (isExprInSingleQuotes && currentMethodBody[lastPos] == '\'' && currentMethodBody[lastPos + expression.Length - 1] == '\'')) { } else if (!ASComplete.IsTextStyle(style)) { continue; } Sci.SetSel(funcBodyStart + lastPos, funcBodyStart + lastPos + expression.Length); Sci.ReplaceSel(NewName); currentMethodBody = currentMethodBody.Substring(0, lastPos) + NewName + currentMethodBody.Substring(lastPos + expression.Length); lastPos += NewName.Length; } else { break; } } Sci.CurrentPos = funcBodyStart; Sci.SetSel(Sci.CurrentPos, Sci.CurrentPos); string snippet = "var " + NewName + ":$(EntryPoint) = " + expression + ";\n$(Boundary)"; SnippetHelper.InsertSnippetText(Sci, Sci.CurrentPos, snippet); } finally { Sci.EndUndoAction(); } }