Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _filePath = WebDialogueContext.GetDialogueParameter<string>("Path");
     if (!WAFRuntime.FileSystem.FileExists(_filePath)) WebDialogueContext.SendResult(ExchangeResult.Cancel);
     _editor = new CodeEditor();
     _editor.Language = "cs";
     _editor.Height = Unit.Percentage(100);
     _editor.Width = Unit.Percentage(100);
     pnlEditor.Controls.Add(_editor);
     _editor.Text = WAFRuntime.FileSystem.FileReadAllText(_filePath);
     MainButton btnSaveChanges = new MainButton();
     btnSaveChanges.Text = "Save";
     btnSaveChanges.Click += new EventHandler(btnSaveChanges_Click);
     Form.Controls.Add(btnSaveChanges);
     WebDialogueContext.AddDialogueButton(btnSaveChanges);
     MainButton btnSaveAndClose = new MainButton();
     btnSaveAndClose.Text = "Save & Close";
     btnSaveAndClose.Tooltip = "Save data and then close this dialog window";
     btnSaveAndClose.Click += new EventHandler(btnSaveAndClose_Click);
     Form.Controls.Add(btnSaveAndClose);
     WebDialogueContext.AddDialogueButton(btnSaveAndClose);
     MainButton btnCloseFile = new MainButton();
     btnCloseFile.Text = "Close";
     btnCloseFile.Tooltip = "Close this dialog window";
     btnCloseFile.Click += new EventHandler(btnCloseFile_Click);
     Form.Controls.Add(btnCloseFile);
     WebDialogueContext.AddDialogueButton(btnCloseFile);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates style scheme for editor from Settings instance or any object with FontStyle properties
 /// </summary>
 /// <param name="editor"></param>
 /// <param name="source"></param>
 public StyleScheme(CodeEditor editor, object source)
 {
     Editor = editor;
     Source = source;
     Properties = Source.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance);
     var commonStyleNames = Enum.GetNames(typeof(CommonStyles));
     var styleProperties = Properties.Where(p => p.PropertyType == typeof(FontStyle));
     Properties = styleProperties != null ? styleProperties.ToArray() : null;
     if (Properties != null) {
         var syntaxProperties = Properties.Where(p => !commonStyleNames.Contains(p.Name));
         if (syntaxProperties != null) SyntaxProperties = syntaxProperties.ToArray();
     }
 }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ce = new CodeEditor();
        pnlEditor.Controls.Add(ce);
        ce.Height = Unit.Pixel(WebDialogueContext.Exchange.WindowHeight);
        ce.Width = Unit.Pixel(WebDialogueContext.Exchange.WindowWidth - 10);
        ce.Text = WebDialogueContext.GetDialogueParameter<string>("Text");
        ce.Language = WebDialogueContext.GetDialogueParameter<string>("Language");

        MainButton mb = new MainButton();
        mb.Click += new EventHandler(mb_Click);
        mb.Text = WebDialogueContext.GetDialogueParameter<string>("ButtonText", "Save");
        this.Form.Controls.Add(mb);
        WebDialogueContext.AddDialogueButton(mb);

        mb = new MainButton();
        mb.Text = "Resize";
        this.Form.Controls.Add(mb);
        WebDialogueContext.AddDialogueButton(mb);
    }
Ejemplo n.º 4
0
    protected override void OnInit(EventArgs e)
    {
        _treeControl = new StyleSheetTree();
        _treeControl.RootFolder = WAFContext.PathFromRootToAppFolder;
        _treeControl.AllowSelect = true;
        _treeControl.AllowDrag = false;
        _treeControl.DblClick += new EventHandler(_treeControl_DblClick);
        pnlLeft.Controls.Add(_treeControl);
        TemplatesMaster.ViewChanged += new EventHandler<MainMenuItem>(TemplatesMaster_ViewChanged);
        cntFrm.CommandClick += new EventHandler<CommandArgument>(cntFrm_CommandClick);

        WAFPanel p1 = new WAFPanel();
        p1.Width = Unit.Percentage(100);
        p1.Height = Unit.Pixel(26);
        p1.Border = false;
        p1.Margin = true;

        MainButton saveCss = new MainButton();
        saveCss.Click += new EventHandler(saveCss_Click);
        saveCss.Text = "Save changes";

        _fileEditor = new CodeEditor();
        _fileEditor.Width = Unit.Percentage(100);
        _fileEditor.Height = Unit.Percentage(100);
        _fileEditor.Language = "css";
        tabFile.Controls.Add(p1);
        tabFile.Controls.Add(_fileEditor);
        p1.Controls.Add(saveCss);

        btnCreateStylesheet.Click += new EventHandler(btnCreateStylesheet_Click);

        if (!IsPostBack && Request["Open"] != null) {
            CKeyNLR key = new CKeyNLR(Request["Open"]);
            cntFrm.ContentKey = key;
            tabbedView.Visible = true;
            Stylesheet s = WAFContext.Session.GetContent<Stylesheet>(key);
            string treeKey = s.Filepath + "." + s.NodeId + ".";
            if (WAFRuntime.FileSystem.FileExists(WAFContext.PathFromRootToAppFolder + s.Filepath)) {
                treeKey += "match#";
            } else {
                treeKey += "onlyContent#";
            }
            _treeControl.SetSelected(treeKey);
            _treeControl.Refresh();
            updateCodeEditors(s.Filepath);
            cntFrm.Refresh();
        }

        base.OnInit(e);
    }
Ejemplo n.º 5
0
 public static ILanguageFeatures Apply(CodeEditor codeEditor)
 {
     return(new XmlLanguageFeatures(codeEditor));
 }
Ejemplo n.º 6
0
 public CSharpLanguageFeatures(CodeEditor codeEditor)
   : base(codeEditor, new CSharpCodeFoldingStrategy(codeEditor), new CSharpCodeCompletionStrategy(codeEditor)) {
 }
 public XmlLanguageFeatures(CodeEditor codeEditor)
     : base(codeEditor, new XmlCodeFoldingStrategy(codeEditor), null)
 {
 }
Ejemplo n.º 8
0
 static VimExternalEditor()
 {
     var editor = new VimExternalEditor();
     CodeEditor.Register(editor);
 }
Ejemplo n.º 9
0
 public static void SetExternalScriptEditor(string path)
 {
     CodeEditor.SetExternalScriptEditor(path);
 }
Ejemplo n.º 10
0
        /// <summary>
        /// Generate Construct method.
        /// </summary>
        public void Generate(String outputPath)
        {
            CodeEditor editor = new CodeEditor();

            CodeBlockNested main = editor.Blocks.AppendBlock();

            main
            .AppendLine($"using System;")
            .AppendLine($"using System.Linq;")
            .AppendLine($"using System.Collections.Generic;")
            .AppendLine($"using System.Reflection;")
            .AppendLine($"using System.Text;")
            .AppendLine($"using FhirKhit.Tools;")
            .AppendLine($"using Hl7.Fhir.Introspection;")
            .AppendLine($"using Hl7.Fhir.Model;")
            .AppendLine($"using Hl7.Fhir.Support.Model;")
            .AppendLine($"using System.Diagnostics;")
            .AppendLine($"using Hl7.FhirPath;")
            .BlankLine()
            .AppendLine($"namespace FhirKhit.SliceGen.CSApi")
            .OpenBrace()
            .SummaryOpen()
            .Summary("This class will generate code to create an element that has the same values as the passed value.")
            .Summary("This class was automatically generated by GenerateFixCodes.cs.")
            .Summary("Do not hand modify this file!")
            .SummaryClose()
            .AppendLine($"public static class ElementFixCode")
            .OpenBrace()
            ;
            CodeBlockNested construct = main.AppendBlock();
            CodeBlockNested methods   = main.AppendBlock();

            main
            .CloseBrace()
            .CloseBrace()
            ;

            construct
            .AppendLine("static String CleanString(String s) => s.Replace(\"\\\"\", \"\\\\\\\"\");")
            .AppendLine($"/// <summary>")
            .AppendLine($"/// Return c# text to create indicated element.")
            .AppendLine($"/// </summary>")
            .AppendLine($"static public bool Construct(CodeBlockNested block,")
            .AppendCode($"    Element fix,")
            .AppendCode($"    String varName,")
            .AppendCode($"    out String propertyType)")
            .OpenBrace()
            //.AppendCode($"const String fcn = \"Construct\";")
            .BlankLine()
            .AppendCode($"if (fix is null)")
            .AppendCode($"    throw new ArgumentNullException(nameof(fix));")
            .AppendCode($"propertyType = null;")
            .AppendCode($"switch (fix.TypeName)")
            .OpenBrace()
            ;

            foreach (FHIRAllTypes fhirType in Enum.GetValues(typeof(FHIRAllTypes)).OfType <FHIRAllTypes>())
            {
                String fhirTypeName = ModelInfo.FhirTypeToFhirTypeName(fhirType);

                if (ModelInfo.IsPrimitive(fhirType))
                {
                    ConstructPrimitive(methods, construct, fhirType);
                }
                else if (ModelInfo.IsDataType(fhirType))
                {
                    ConstructDataType(methods, construct, fhirType);
                }
            }

            construct
            .CloseBrace()
            .AppendCode($"return false;")
            .CloseBrace()
            ;

            editor.Save(outputPath);
        }
Ejemplo n.º 11
0
        public MainForm()
        {
            Title      = $"CodeEditor Test, Platform: {Platform.ID}";
            ClientSize = new Size(1400, 800);

            Menu = new MenuBar(); // show standard macOS menu.


            var editor = new CodeEditor(ProgrammingLanguage.CSharp, true);

            editor.Text =
                @"// Just some sample code
for( int i=0; i<10; i++ )
{
  print(i);
}";
            editor.IsFoldingMarginVisible = true;

            editor.SetupIndicatorStyles();
            editor.AddErrorIndicator(13, 6);

            Action <Font, string> pp = (f, pfx) => MessageBox.Show($"{pfx}: name: {editor.Font.FamilyName}, size: {editor.FontSize}");

            var btn = new Button {
                Text = "Font"
            };

            btn.Click += (s, e) =>
            {
                var originalFont = editor.Font ?? SystemFonts.Default();
                pp(originalFont, "first");
                var fd = new Eto.Forms.FontDialog {
                    Font = originalFont
                };
                fd.FontChanged += (ss, ee) =>
                {
                    editor.Font = fd.Font;
                    pp(editor.Font, "FontChanged");
                };
                var r = fd.ShowDialog(this);
                editor.Font = (r == DialogResult.Ok || r == DialogResult.Yes)
                  ? fd.Font
                  : originalFont;

                pp(fd.Font, "fd");
                pp(editor.Font, "editor");
                //editor.ShowWhitespaceWithColor(Colors.Red);
                //editor.Text = $"name: {editor.FontName}, size: {editor.FontSize}";
            };


            var tests = new Eto.UnitTest.UI.UnitTestPanel(true, Orientation.Vertical);

            this.LoadComplete += async(s, e) =>
            {
                var testSource = new UnitTest.TestSource(System.Reflection.Assembly.GetExecutingAssembly());
                var mtr        = new Eto.UnitTest.Runners.MultipleTestRunner();
                await mtr.Load(testSource);

                tests.Runner           = new UnitTest.Runners.LoggingTestRunner(mtr);
                CodeEditorTests.editor = editor;
                RegexTests.editor      = editor;
            };

            var ta = new TextArea {
                Height = 200
            };

            editor.SelectionChanged                       += (s, e) =>
                                                  ta.Text += $"empty: {e.SelectionIsEmpty}, s:{e.SelectionStart}, e:{e.SelectionEnd}, txt:{e.SelectionText}\n";

            var splitter = new Splitter
            {
                Panel1 = tests,
                Panel2 = new Splitter {
                    Panel1 = editor, Panel2 = ta, Orientation = Orientation.Vertical, Panel1MinimumSize = 100, FixedPanel = SplitterFixedPanel.Panel2
                }
            };

            Content = new TableLayout {
                Rows = { splitter }
            };
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Creates the child controls.
        /// </summary>
        /// <param name="parentControl"></param>
        /// <returns></returns>
        public override System.Web.UI.Control[] CreateChildControls(System.Web.UI.Control parentControl)
        {
            var ddlProperty = new RockDropDownList();

            ddlProperty.HelpBlock.Text        = "Select the property you wish to include in the report";
            ddlProperty.ID                    = parentControl.ID + "_0";
            ddlProperty.Label                 = "Property";
            ddlProperty.SelectedIndexChanged += ddlProperty_SelectedIndexChanged;
            ddlProperty.AutoPostBack          = true;
            parentControl.Controls.Add(ddlProperty);

            /* Get all the DataMember properties that are not hidden in reporting. */
            var properties = typeof(TargetEntityType)
                             .GetProperties()
                             .Where(p => Attribute.IsDefined(p, typeof(DataMemberAttribute)))
                             .Where(p => !Attribute.IsDefined(p, typeof(NotMappedAttribute)))
                             .Where(p => !Attribute.IsDefined(p, typeof(HideFromReportingAttribute)))
                             .Select(p => p.Name)
                             .ToList();

            /* Some of the navigation properties are not marked as DataMember so add missing ones in. */
            foreach (var p in GetNavigationPropertyNames(typeof(TargetEntityType)))
            {
                if (!properties.Contains(p))
                {
                    properties.Add(p);
                }
            }

            /* Add each of the available properties to the drop down list. */
            ddlProperty.Items.Add(new ListItem());
            foreach (var prop in properties.OrderBy(n => n))
            {
                ddlProperty.Items.Add(prop);
            }

            /* Direct access the postback variables to set the currently selected property value. */
            string selectedPropertyValue = parentControl.Page.Request.Params[ddlProperty.UniqueID];

            ddlProperty.SelectedValue = selectedPropertyValue;

            /* Create the sort property drop down. */
            var ddlSortProperty = new RockDropDownList();

            ddlSortProperty.HelpBlock.Text = "The selected property is a linked entity and cannot be sorted on directly. Select the sub-property you wish to sort by.";
            ddlSortProperty.ID             = parentControl.ID + "_1";
            ddlSortProperty.Label          = "Sort-by Property";
            parentControl.Controls.Add(ddlSortProperty);
            PopulateSortProperties(ddlProperty.SelectedValue, ddlSortProperty);

            /* Create the code editor they use to provide Lava formatting syntax. */
            CodeEditor codeEditor = new CodeEditor();

            codeEditor.HelpBlock.Text = "Use Lava syntax to get format the value of the selected property. The lava variable uses the same name as the property name. Common merge fields such as CurrentPerson are also available.";
            codeEditor.EditorMode     = CodeEditorMode.Lava;
            codeEditor.ID             = parentControl.ID + "_2";
            codeEditor.Label          = "Template";
            parentControl.Controls.Add(codeEditor);

            return(new System.Web.UI.Control[] { ddlProperty, ddlSortProperty, codeEditor });
        }
Ejemplo n.º 13
0
 private void Window_Deactivated(object sender, EventArgs e)
 {
     CodeEditor.Deactivated();
 }
Ejemplo n.º 14
0
        public MainWindow()
        {
            InitializeComponent();

            CodeEditor.AddAdditionalstring("default", "function ab");
        }
Ejemplo n.º 15
0
        void ProcessFhirResource(SDefInfo sDefInfo)
        {
            const String fcn = "ProcessFhirResource";

            StructureDefinition sDef = sDefInfo.SDef;

            ClearSDef(sDef);

            this.ConversionInfo(this.GetType().Name, fcn, $"Processing Resource {sDef.Name} {sDefInfo.TFlag}");

            String          instanceName   = ResourceName(sDef.Name);
            CodeEditor      instanceEditor = this.project.CreateEditor(Path.Combine(ResourceGenPath, $"{instanceName}.cs"));
            CodeBlockNested instanceBlock  = instanceEditor.Blocks.AppendBlock();

            instanceBlock
            .AppendCode("using System;")
            .AppendCode("using System.Diagnostics;")
            .AppendCode("using System.IO;")
            .AppendCode("using System.Linq;")
            .AppendCode("using Hl7.Fhir.Model;")
            .BlankLine()
            .AppendCode($"namespace {ResourceNameSpace}")
            .OpenBrace()
            .AppendCode("#region Json")
            .AppendCode("#if NEVER")
            .AppendLines("", sDef.ToFormatedJson().ToLines())
            .AppendLine("#endif")
            .AppendCode("#endregion")
            .SummaryOpen()
            .Summary($"Fhir resource '{sDef.Name}'")
            .SummaryClose()
            .DefineBlock(out CodeBlockNested classBlock)
            .CloseBrace()
            ;

            String baseClass = ResourceBase;

            if (String.IsNullOrEmpty(sDef.BaseDefinition) == false)
            {
                String name = this.ResourceName(sDef.BaseDefinition.LastUriPart());
                baseClass = $"{ResourceNameSpace}.{name}";
            }
            Int32 i = 0;

            DefineClass(classBlock,
                        sDef.Differential.Element.ToArray(),
                        ref i,
                        sDef.Differential.Element[0].Path,
                        instanceName,
                        baseClass,
                        out CodeBlockNested constructorBlock);

            constructorBlock
            .AppendCode($"this.Name = \"{sDef.Name}\";")
            .AppendCode($"this.Uri = \"{sDef.Url}\";")
            ;

            if (i != sDef.Differential.Element.Count)
            {
                throw new ConvertErrorException(this.GetType().Name, fcn, $"Internal error. Invalid element index");
            }
        }
Ejemplo n.º 16
0
 public ModelHelper(CodeEditor editor)
 {
     _editor = new WeakReference <CodeEditor>(editor);
 }
Ejemplo n.º 17
0
 public DeleteCommand(CodeEditor codeEditor)
     : base(codeEditor)
 {
 }
Ejemplo n.º 18
0
    protected override void OnInit(EventArgs e)
    {
        if (!WAFContext.Session.Access.IsAdmin()) throw new AccessViolationException("Only admins has access to this module. ");
        _tree = new DirectoryTree();
        _tree.RootFolder = WAFContext.PathFromRootToAppFolder;
        _tree.PostOnClick = false;
        _tree.DblClick += new EventHandler(tree_DblClick);
        _tree.Drop += new EventHandler(_tree_Drop);
        _tree.Remove += new EventHandler(_tree_Remove);
        _tree.AllowDropBetweenElements = false;
        _tree.AllowDropOnElements = true;
        _tree.AllowRemoveDrag = true;
        ddlEncoding.AutoPostBack = true;
        ddlEncoding.SelectedIndexChanged += new EventHandler(ddlEncoding_SelectedIndexChanged);

        leftPanel.Controls.Add(_tree);
        folderIcon.ImageUrl = WAFContext.GetUrlFromHostToClassIcon(FileFolder.ContentClassId);
        //btnFolderSave.Click += new EventHandler(btnFolderSave_Click);
        btnFolderNewFile.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(newPath_WorkflowMethodCompleted);
        btnFolderCompress.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(newPath_WorkflowMethodCompleted);
        btnFolderCopy.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(newPath_WorkflowMethodCompleted);
        btnFolderCreateFolder.WorkflowMethodCompleted += new EventHandler<WorkflowMethodArgs>(newPath_WorkflowMethodCompleted);
        btnFileOpenFolder.Click += new EventHandler(btnFileOpenFolder_Click);
        btnNativeEdit.Click += new EventHandler(btnNativeEdit_Click);
        //btnFileSaveName.Click += new EventHandler(btnFileSaveName_Click);
        btnSaveContent.Click += new EventHandler(btnSaveContent_Click);
        MainMenu menu = WAFMaster.EditModule.Menu;
        menu.SetMenu(this.GetMenuItems());
        menu.SetItemCheckStatus("Options_StopMonitorNonSpecialChanges", WAFContext.HasStoppedFSMonitoringNonSpecialFolders);
        menu.SetItemCheckStatus("Options_StopMonitorAllChanges", WAFContext.HasStoppedFSMonitoringAllFolders);
        menu.Click += new EventHandler<MainMenuItem>(menu_Click);
        _editor = new CodeEditor();
        _editor.Height = Unit.Percentage(100);
        _editor.Width = Unit.Percentage(100);
        pnlEditor.Controls.Add(_editor);
        _tree.ShowFiles = WAFMaster.EditModule.Menu.IsItemChecked("View_ShowFilesInTree");
        fileList.DblClick += new EventHandler(fileList_DblClick);
        fileList.Remove += new EventHandler(fileList_Remove);
        fileList.AllowRemoveDrag = true;
        fileList.AllowDrop = false;
        if (!IsPostBack) {
            ddlEncoding.Items.Add(new ListItem("", "0"));
            foreach (EncodingInfo enc in from f in Encoding.GetEncodings() orderby f.DisplayName select f) {
                ddlEncoding.Items.Add(new ListItem(enc.DisplayName, enc.CodePage.ToString()));
            }
        }
        base.OnInit(e);
    }
Ejemplo n.º 19
0
 public static void ClassInitialize(TestContext a)
 {
     code = File.ReadAllText("../../../App/demos/simple.tech");
     lexer = new FxLexer();
     editor = new CodeEditor(code);
 }
Ejemplo n.º 20
0
 public static bool GetAutoLayoutOnResize(CodeEditor obj) => (bool)obj.GetValue(AutoLayoutOnResizeProperty);
        static RiderScriptEditor()
        {
            try
            {
                // todo: make ProjectGeneration lazy
                var projectGeneration = new ProjectGeneration.ProjectGeneration();
                var editor            = new RiderScriptEditor(new Discovery(), projectGeneration);
                CodeEditor.Register(editor);
                var path = GetEditorRealPath(CurrentEditor);

                if (IsRiderInstallation(path))
                {
                    RiderPathLocator.RiderInfo[] installations = null;

                    if (!RiderScriptEditorData.instance.initializedOnce)
                    {
                        installations = RiderPathLocator.GetAllRiderPaths().OrderBy(a => a.BuildNumber).ToArray();
                        // is likely outdated
                        if (installations.Any() && installations.All(a => GetEditorRealPath(a.Path) != path))
                        {
                            if (RiderPathLocator.GetIsToolbox(path)) // is toolbox - update
                            {
                                var toolboxInstallations = installations.Where(a => a.IsToolbox).ToArray();
                                if (toolboxInstallations.Any())
                                {
                                    var newEditor = toolboxInstallations.Last().Path;
                                    CodeEditor.SetExternalScriptEditor(newEditor);
                                    path = newEditor;
                                }
                                else
                                {
                                    var newEditor = installations.Last().Path;
                                    CodeEditor.SetExternalScriptEditor(newEditor);
                                    path = newEditor;
                                }
                            }
                            else // is non toolbox - notify
                            {
                                var newEditorName = installations.Last().Presentation;
                                Debug.LogWarning($"Consider updating External Editor in Unity to {newEditorName}.");
                            }
                        }

                        ShowWarningOnUnexpectedScriptEditor(path);
                        RiderScriptEditorData.instance.initializedOnce = true;
                    }

                    if (!FileSystemUtil.EditorPathExists(path)) // previously used rider was removed
                    {
                        if (installations == null)
                        {
                            installations = RiderPathLocator.GetAllRiderPaths().OrderBy(a => a.BuildNumber).ToArray();
                        }
                        if (installations.Any())
                        {
                            var newEditor = installations.Last().Path;
                            CodeEditor.SetExternalScriptEditor(newEditor);
                            path = newEditor;
                        }
                    }

                    RiderScriptEditorData.instance.Init();

                    editor.CreateSolutionIfDoesntExist();
                    if (RiderScriptEditorData.instance.shouldLoadEditorPlugin)
                    {
                        editor.m_Initiliazer.Initialize(path);
                    }

                    RiderFileSystemWatcher.InitWatcher(
                        Directory.GetCurrentDirectory(), "*.csproj", (sender, args) =>
                    {
                        RiderScriptEditorData.instance.hasChanges = true;
                    });

                    RiderFileSystemWatcher.InitWatcher(
                        Directory.GetCurrentDirectory(), "*.sln", (sender, args) =>
                    {
                        RiderScriptEditorData.instance.hasChanges = true;
                    });

                    RiderFileSystemWatcher.InitWatcher(
                        Path.Combine(Directory.GetCurrentDirectory(), "Packages"),
                        "manifest.json", (sender, args) => { RiderScriptEditorData.instance.hasChanges = true; });

                    // can't switch to non-deprecated api, because UnityEditor.Build.BuildPipelineInterfaces.processors is internal
#pragma warning disable 618
                    EditorUserBuildSettings.activeBuildTargetChanged += () =>
#pragma warning restore 618
                    {
                        RiderScriptEditorData.instance.hasChanges = true;
                    };
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
        }
Ejemplo n.º 22
0
 public static void SetAutoLayoutOnResize(CodeEditor obj, bool value) => obj.SetValue(AutoLayoutOnResizeProperty, value);
Ejemplo n.º 23
0
 public CSLinkDataProvider(CodeEditor editor)
 {
     FEditor = editor;
 }
Ejemplo n.º 24
0
 public static string GetCodeLanguage(CodeEditor obj) => (string)obj.GetValue(CodeLanguageProperty);
Ejemplo n.º 25
0
 public CSFormattingStrategy(CodeEditor editor)
     : base(editor)
 {
     FEditor = editor;
 }
Ejemplo n.º 26
0
 //public static string GetModelLanguage(CodeEditor obj) => (string)obj.GetValue(ModelLanguageProperty);
 public static void SetModelLanguage(CodeEditor obj, string value) => obj.SetValue(ModelLanguageProperty, value);
Ejemplo n.º 27
0
        public virtual void SetView(CodeEditor view)
        {
            _view = view;
            _view.Document = _model.TextDocument.AvDoc;

            //BindCommands(_view.CommandBindings);

            //Initialise the view's caret location in case CaretOffset has already been set.
            _view.CaretOffset = _caretLocation.Offset;
            //Track changes in the caret location
            _view.TextArea.Caret.PositionChanged += Caret_PositionChanged;

            _view.Loaded += OnViewLoaded;

            //Let any derived class initialise
            OnSetView(_view);
        }
Ejemplo n.º 28
0
 public XmlLanguageFeatures(CodeEditor codeEditor)
   : base(codeEditor, new XmlCodeFoldingStrategy(codeEditor), null) {
 }
Ejemplo n.º 29
0
 public static bool GetAutoUpdateTheme(CodeEditor obj) => (bool)obj.GetValue(AutoUpdateThemeProperty);
Ejemplo n.º 30
0
 protected override void OnSetView(CodeEditor view)
 {
     view.TextArea.TextView.BackgroundRenderers.Add(DiagnosticHighlighter.Renderer);
     view.TextArea.TextView.BackgroundRenderers.Add(SearchHighlighter.Renderer);
     view.TextArea.TextView.BackgroundRenderers.Add(_indexHighlighter.Renderer);
     view.KeyDown += OnViewKeyDown;
     //Underliner.Redraw();
 }
Ejemplo n.º 31
0
 protected virtual void OnSetView(CodeEditor view)
 {
 }
Ejemplo n.º 32
0
 public static void SetAutoUpdateTheme(CodeEditor obj, bool value) => obj.SetValue(AutoUpdateThemeProperty, value);
Ejemplo n.º 33
0
 public static ILanguageFeatures Apply(CodeEditor codeEditor) {
   return new XmlLanguageFeatures(codeEditor);
 }
Ejemplo n.º 34
0
 public static IDisposable GetAutoUpdateThemeSubscription(CodeEditor obj) => (IDisposable)obj.GetValue(AutoUpdateThemeSubscriptionProperty);
Ejemplo n.º 35
0
 protected override void OnSetView(CodeEditor view)
 {
     base.OnSetView(view);
     
 }
Ejemplo n.º 36
0
 public static void SetAutoUpdateThemeSubscription(CodeEditor obj, IDisposable value) => obj.SetValue(AutoUpdateThemeSubscriptionProperty, value);
Ejemplo n.º 37
0
        public void FhirConstructA()
        {
            CodeEditor editor = new CodeEditor();

            CodeBlockNested main = editor.Blocks.AppendBlock();

            main
            .AppendLine($"using System;")
            .AppendLine($"using System.Linq;")
            .AppendLine($"using System.Collections.Generic;")
            .AppendLine($"using System.Reflection;")
            .AppendLine($"using System.Text;")
            .AppendLine($"using FhirKhit.Tools;")
            .AppendLine($"using Hl7.Fhir.Introspection;")
            .AppendLine($"using Hl7.Fhir.Model;")
            .AppendLine($"using System.Diagnostics;")
            .AppendLine($"using Hl7.FhirPath;")
            .AppendLine($"using Range = Hl7.Fhir.Model.Range;")
            .BlankLine()
#if FHIR_R3
            .AppendLine($"namespace FhirKhit.Tools.R3")
#elif FHIR_R4
            .AppendLine($"namespace FhirKhit.Tools.R4")
#endif
            .OpenBrace()
            .AppendCode($"public static class FhirConstruct")
            .OpenBrace()
            ;
            CodeBlockNested construct = main.AppendBlock();
            CodeBlockNested methods   = main.AppendBlock();

            main
            .CloseBrace()
            .CloseBrace()
            ;

            construct
            .AppendLine($"/// <summary>")
            .AppendLine($"/// Return c# text to create indicated element.")
            .AppendLine($"/// </summary>")
            .AppendLine($"static public bool Construct(CodeBlockNested block,")
            .AppendCode($"    Element fix,")
            .AppendCode($"    String methodName,")
            .AppendCode($"    out String propertyType,")
            .AppendCode($"    String methodAccess = \"public\")")
            .OpenBrace()
            //.AppendCode($"const String fcn = \"Construct\";")
            .BlankLine()
            .AppendCode($"propertyType = null;")
            .AppendCode($"switch (fix.TypeName)")
            .OpenBrace()
            ;

            foreach (FHIRAllTypes fhirType in Enum.GetValues(typeof(FHIRAllTypes)).OfType <FHIRAllTypes>())
            {
                String fhirTypeName = ModelInfo.FhirTypeToFhirTypeName(fhirType);

                if (ModelInfo.IsPrimitive(fhirType))
                {
                    ConstructPrimitive(methods, construct, fhirType);
                }
                else if (ModelInfo.IsDataType(fhirType))
                {
                    ConstructDataType(methods, construct, fhirType);
                }
            }

            construct
            .CloseBrace()
            .AppendCode($"return false;")
            .CloseBrace()
            ;

            String outputPath = Path.Combine(DirHelper.FindParentDir("Tools"),
#if FHIR_R3
                                             "FhirKhit.Tools.R3",
#elif FHIR_R4
                                             "FhirKhit.Tools.R4",
#endif
                                             "FhirConstruct.cs");
            editor.Save(outputPath);
        }
Ejemplo n.º 38
0
        public void FhirConstructB()
        {
            CodeEditor editor = new CodeEditor();

            CodeBlockNested main = editor.Blocks.AppendBlock();

            main
            .AppendLine($"using System;")
            .AppendLine($"using System.Linq;")
            .AppendLine($"using System.Collections.Generic;")
            .AppendLine($"using System.Reflection;")
            .AppendLine($"using System.Text;")
            .AppendLine($"using FhirKhit.Tools;")
            .AppendLine($"using Hl7.Fhir.Introspection;")
            .AppendLine($"using Hl7.Fhir.Model;")
            .AppendLine($"using System.Diagnostics;")
            .AppendLine($"using Hl7.FhirPath;")
            .AppendLine($"using Range = Hl7.Fhir.Model.Range;")
            .BlankLine()
#if FHIR_R3
            .AppendLine($"namespace FhirKhit.Tools.R3")
#elif FHIR_R4
            .AppendLine($"namespace FhirKhit.Tools.R4")
#endif
            .OpenBrace()
            .AppendCode($"public class FhirConstructUse")
            .OpenBrace()
            ;
            CodeBlockNested construct = main.AppendBlock();
            CodeBlockNested methods   = main.AppendBlock();

            main
            .CloseBrace()
            .CloseBrace()
            ;

            construct
            .AppendLine($"/// <summary>")
            .AppendLine($"/// generate code for eqch fhri element. Makes sure it compiles.")
            .AppendLine($"/// </summary>")
            .AppendCode($"public void Use()")
            .OpenBrace()
            .BlankLine()
            ;

            Int32 varNum = 0;
            foreach (FHIRAllTypes fhirType in Enum.GetValues(typeof(FHIRAllTypes)).OfType <FHIRAllTypes>())
            {
                Trace.WriteLine($"fhirType {fhirType}");
                String fhirTypeName = ModelInfo.FhirTypeToFhirTypeName(fhirType);
                Type   fhirCSType   = ModelInfo.GetTypeForFhirType(fhirTypeName);

                if (ModelInfo.IsPrimitive(fhirType))
                {
                    String varName1    = $"x{++varNum}";
                    String methodName1 = $"Method{++varNum}";

                    construct
                    .AppendCode($"{fhirCSType} {varName1} = {methodName1}();")
                    ;

                    Element fix = CreateFix(fhirCSType);
                    FhirConstruct.Construct(methods, fix, methodName1, out String propertyType1);
                }
                else if (ModelInfo.IsDataType(fhirType))
                {
                    if (Ignore(fhirType) == false)
                    {
                        String varName1    = $"x{++varNum}";
                        String methodName1 = $"Method{++varNum}";

                        construct
                        .AppendCode($"{fhirCSType} {varName1} = {methodName1}();")
                        ;

                        Element fix = CreateFix(fhirCSType);
                        FhirConstruct.Construct(methods, fix, methodName1, out String propertyType1);
                    }
                }
            }

            construct
            .CloseBrace()
            ;


            String outputPath = Path.Combine(DirHelper.FindParentDir("Tools"),
#if FHIR_R3
                                             "FhirKhit.Tools.R3.XUnitTests",
#elif FHIR_R4
                                             "FhirKhit.Tools.R4.XUnitTests",
#endif
                                             "FhirConstructUseTests.cs");
            editor.Save(outputPath);
        }
Ejemplo n.º 39
0
    protected override void OnInit(EventArgs e)
    {
        _treeControl = new TemplateTree();
        _treeControl.RootFolder = WAFContext.PathFromRootToAppFolder;
        _treeControl.AllowSelect = true;
        _treeControl.AllowDrag = false;
        _treeControl.DblClick += new EventHandler(_treeControl_DblClick);
        pnlLeft.Controls.Add(_treeControl);
        cntFrm.CommandClick += new EventHandler<CommandArgument>(cntFrm_CommandClick);
        WAFPanel p1 = new WAFPanel();
        p1.Width = Unit.Percentage(100);
        p1.Height = Unit.Pixel(26);
        p1.Border = false;
        p1.Margin = true;
        MainButton saveAspx = new MainButton();
        saveAspx.Click += new EventHandler(saveAspx_Click);

        saveAspx.Text = Local.Text("Web.WAF.Edit.Templates.TemplatesSaveChanges");
        p1.Controls.Add(saveAspx);
        tabASPXFile.Controls.Add(p1);

        _aspxFileEditor = new CodeEditor();
        _aspxFileEditor.Width = Unit.Percentage(100);
        _aspxFileEditor.Height = Unit.Percentage(100);
        _aspxFileEditor.Language = "html";
        tabASPXFile.Controls.Add(_aspxFileEditor);

        WAFPanel p2 = new WAFPanel();
        p2.Width = Unit.Percentage(100);
        p2.Height = Unit.Pixel(26);
        p2.Border = false;
        p2.Margin = true;

        MainButton saveCodebehind = new MainButton();
        saveCodebehind.Click += new EventHandler(saveCodebehind_Click);
        saveCodebehind.Text = Local.Text("Web.WAF.Edit.Templates.TemplatesSaveChanges");

        _codebehindEditor = new CodeEditor();
        _codebehindEditor.Width = Unit.Percentage(100);
        _codebehindEditor.Height = Unit.Percentage(100);
        _codebehindEditor.Language = "cs";
        tabCodebindFile.Controls.Add(p2);
        tabCodebindFile.Controls.Add(_codebehindEditor);
        p2.Controls.Add(saveCodebehind);

        TemplatesMaster.ViewChanged += new EventHandler<MainMenuItem>(TemplatesMaster_ViewChanged);
        btnCreateTemplate.Click += new EventHandler(btnCreateTemplate_Click);

        if (!IsPostBack && Request["Open"] != null) {
            CKeyNLR key = new CKeyNLR(Request["Open"]);
            cntFrm.ContentKey = key;
            tabbedView.Visible = true;
            Template s = WAFContext.Session.GetContent<Template>(key);
            string treeKey = s.Filepath + "." + s.NodeId + ".";

            if (WAFRuntime.FileSystem.FileExists(WAFContext.PathFromRootToAppFolder + s.Filepath)) {
                treeKey += "match#";
            } else {
                treeKey += "onlyContent#";
            }
            _treeControl.SetSelected(treeKey);
            _treeControl.Refresh();
            updateCodeEditors(s.Filepath);
            cntFrm.Refresh();
        }

        base.OnInit(e);
    }
Ejemplo n.º 40
0
 public void OneTimeSetUp()
 {
     CodeEditor.SetExternalScriptEditor("NotSet");
 }