Example #1
0
        void UpdatePreview()
        {
            XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;

            if (xshd != null)
            {
                var customizationsForCurrentLanguage = customizationList.Where(c => c.Language == null || c.Language == xshd.Name);
                CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(textEditor, customizationsForCurrentLanguage);
                ApplyToFolding(textEditor, customizationsForCurrentLanguage);
                var      item     = (IHighlightingItem)listBox.SelectedItem;
                TextView textView = textEditor.TextArea.TextView;
                foldingManager.Clear();
                textView.LineTransformers.Remove(colorizer);
                colorizer = null;
                if (item != null)
                {
                    if (item.ParentDefinition != null)
                    {
                        colorizer = new CustomizableHighlightingColorizer(item.ParentDefinition.MainRuleSet, customizationsForCurrentLanguage);
                        textView.LineTransformers.Add(colorizer);
                    }
                    textEditor.Select(0, 0);
                    bracketHighlighter.SetHighlight(null);
                    item.ShowExample(textEditor.TextArea);
                }
            }
        }
Example #2
0
        void UpdatePreview()
        {
            XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;

            if (xshd != null)
            {
                var customizationsForCurrentLanguage = customizationList.Where(c => c.Language == null || c.Language == xshd.Name);
                CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(textEditor, customizationsForCurrentLanguage);
                ApplyToRendering(textEditor, customizationsForCurrentLanguage);
                var      item     = (IHighlightingItem)listBox.SelectedItem;
                TextView textView = textEditor.TextArea.TextView;
                foldingManager.Clear();
                textMarkerService.RemoveAll(m => true);
                marker = null;
                textView.LineTransformers.Remove(colorizer);
                colorizer = null;
                if (item != null)
                {
                    if (item.ParentDefinition != null)
                    {
                        colorizer = new CustomizableHighlightingColorizer(item.ParentDefinition.MainRuleSet, customizationsForCurrentLanguage);
                        textView.LineTransformers.Add(colorizer);
                    }
                    textEditor.Select(0, 0);
                    bracketHighlighter.SetHighlight(null);
                    item.ShowExample(textEditor.TextArea);
                    if (marker != null)
                    {
                        switch (item.Name)
                        {
                        case ErrorPainter.ErrorColorName:
                        case ErrorPainter.WarningColorName:
                        case ErrorPainter.MessageColorName:
                            marker.MarkerType  = TextMarkerType.SquigglyUnderline;
                            marker.MarkerColor = item.Foreground;
                            break;

                        default:
                            marker.MarkerType  = TextMarkerType.None;
                            marker.MarkerColor = Colors.Transparent;
                            break;
                        }
                    }
                }
            }
        }
		void UpdatePreview()
		{
			XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;
			if (xshd != null) {
				var customizationsForCurrentLanguage = customizationList.Where(c => c.Language == null || c.Language == xshd.Name);
				CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(textEditor, customizationsForCurrentLanguage);
				ApplyToRendering(textEditor, customizationsForCurrentLanguage);
				var item = (IHighlightingItem)listBox.SelectedItem;
				TextView textView = textEditor.TextArea.TextView;
				foldingManager.Clear();
				textMarkerService.RemoveAll(m => true);
				marker = null;
				textView.LineTransformers.Remove(colorizer);
				colorizer = null;
				if (item != null) {
					if (item.ParentDefinition != null) {
						colorizer = new CustomizableHighlightingColorizer(item.ParentDefinition.MainRuleSet, customizationsForCurrentLanguage);
						textView.LineTransformers.Add(colorizer);
					}
					textEditor.Select(0, 0);
					bracketHighlighter.SetHighlight(null);
					item.ShowExample(textEditor.TextArea);
					if (marker != null) {
						switch (item.Name) {
							case ErrorPainter.ErrorColorName:
							case ErrorPainter.WarningColorName:
							case ErrorPainter.MessageColorName:
								marker.MarkerType = TextMarkerType.SquigglyUnderline;
								marker.ForegroundColor = item.Foreground;
								marker.BackgroundColor = item.Background;
								break;
							default:
								marker.MarkerType = TextMarkerType.None;
								marker.ForegroundColor = item.Foreground;
								marker.BackgroundColor = item.Background;
								break;
						}
					}
				}
			}
		}
		void UpdatePreview()
		{
			XshdSyntaxDefinition xshd = (XshdSyntaxDefinition)languageComboBox.SelectedItem;
			if (xshd != null) {
				var customizationsForCurrentLanguage = customizationList.Where(c => c.Language == null || c.Language == xshd.Name);
				CustomizableHighlightingColorizer.ApplyCustomizationsToDefaultElements(textEditor, customizationsForCurrentLanguage);
				var item = (IHighlightingItem)listBox.SelectedItem;
				TextView textView = textEditor.TextArea.TextView;
				textView.LineTransformers.Remove(colorizer);
				colorizer = null;
				if (item != null) {
					if (item.ParentDefinition != null) {
						colorizer = new CustomizableHighlightingColorizer(item.ParentDefinition.MainRuleSet, customizationsForCurrentLanguage);
						textView.LineTransformers.Add(colorizer);
					}
					textEditor.Select(0, 0);
					item.ShowExample(textEditor.TextArea);
				}
			}
		}