Browse Source

added option to disable advanced highlighting for XAML

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6272 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Siegfried Pammer 15 years ago
parent
commit
ed54e3423a
  1. 20
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/CodeCompletion.xaml
  2. 5
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/XamlBindingOptions.cs
  3. 24
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlLanguageBinding.cs

20
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/CodeCompletion.xaml

@ -23,20 +23,22 @@ @@ -23,20 +23,22 @@
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.ColumnSpan="2" Margin="3" Text="{sd:Localize AddIns.XamlBinding.Options.HighlightingDescription}" TextWrapping="WrapWithOverflow" />
<Label Grid.Row="1" Content="{sd:Localize AddIns.XamlBinding.Options.PropertyColor}" />
<Label Grid.Row="2" Content="{sd:Localize AddIns.XamlBinding.Options.EventColor}" />
<Label Grid.Row="3" Content="{sd:Localize AddIns.XamlBinding.Options.NamespaceDeclarationColor}" />
<Label Grid.Row="4" Content="{sd:Localize AddIns.XamlBinding.Options.IgnoredElementColor}" />
<gui:ColorPicker Grid.Row="1" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.PropertyForegroundColor}" />
<gui:ColorPicker Grid.Row="2" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.EventForegroundColor}" />
<gui:ColorPicker Grid.Row="3" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.NamespaceDeclarationForegroundColor}" />
<gui:ColorPicker Grid.Row="4" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.IgnoredForegroundColor}" />
<CheckBox Grid.ColumnSpan="2" Margin="3" Content="{sd:Localize AddIns.XamlBinding.Options.UseHighlighting}" IsChecked="{sd:OptionBinding addin:XamlBindingOptions.UseAdvancedHighlighting}" />
<TextBlock Grid.ColumnSpan="2" Grid.Row="1" Margin="3" Text="{sd:Localize AddIns.XamlBinding.Options.HighlightingDescription}" TextWrapping="WrapWithOverflow" />
<Label Grid.Row="2" Content="{sd:Localize AddIns.XamlBinding.Options.PropertyColor}" />
<Label Grid.Row="3" Content="{sd:Localize AddIns.XamlBinding.Options.EventColor}" />
<Label Grid.Row="4" Content="{sd:Localize AddIns.XamlBinding.Options.NamespaceDeclarationColor}" />
<Label Grid.Row="5" Content="{sd:Localize AddIns.XamlBinding.Options.IgnoredElementColor}" />
<gui:ColorPicker Grid.Row="2" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.PropertyForegroundColor}" />
<gui:ColorPicker Grid.Row="3" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.EventForegroundColor}" />
<gui:ColorPicker Grid.Row="4" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.NamespaceDeclarationForegroundColor}" />
<gui:ColorPicker Grid.Row="5" Grid.Column="1" Value="{sd:OptionBinding addin:XamlBindingOptions.IgnoredForegroundColor}" />
</Grid>
</GroupBox>
</StackPanel>

5
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Options/XamlBindingOptions.cs

@ -40,6 +40,11 @@ namespace ICSharpCode.XamlBinding @@ -40,6 +40,11 @@ namespace ICSharpCode.XamlBinding
set { Properties.Set("SwitchToCodeViewAfterInsertion", value); }
}
public static bool UseAdvancedHighlighting {
get { return Properties.Get("UseAdvancedHighlighting", true); }
set { Properties.Set("UseAdvancedHighlighting", value); }
}
public static string EventHandlerNamePattern {
get { return Properties.Get("EventHandlerNamePattern", "%Object%_%Event%"); }
set { Properties.Set("EventHandlerNamePattern", value); }

24
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlLanguageBinding.cs

@ -30,14 +30,16 @@ namespace ICSharpCode.XamlBinding @@ -30,14 +30,16 @@ namespace ICSharpCode.XamlBinding
// try to access the ICSharpCode.AvalonEdit.Rendering.TextView
// of this ITextEditor
this.textView = editor.GetService(typeof(TextView)) as TextView;
// if editor is not an AvalonEdit.TextEditor
// GetService returns null
if (textView != null) {
if (WorkbenchSingleton.Workbench != null) {
colorizer = new XamlColorizer(editor, textView);
// attach the colorizer
textView.LineTransformers.Add(colorizer);
if (XamlBindingOptions.UseAdvancedHighlighting) {
colorizer = new XamlColorizer(editor, textView);
// attach the colorizer
textView.LineTransformers.Add(colorizer);
}
// add the XamlOutlineContentHost, which manages the tree view
contentHost = new XamlOutlineContentHost(editor);
textView.Services.AddService(typeof(IOutlineContentHost), contentHost);
@ -52,13 +54,17 @@ namespace ICSharpCode.XamlBinding @@ -52,13 +54,17 @@ namespace ICSharpCode.XamlBinding
base.Detach();
// if we added something before
if (textView != null && colorizer != null && contentHost != null) {
if (textView != null) {
// remove and dispose everything we added
textView.LineTransformers.Remove(colorizer);
textView.Services.RemoveService(typeof(IOutlineContentHost));
if (colorizer != null) {
textView.LineTransformers.Remove(colorizer);
colorizer.Dispose();
}
if (contentHost != null) {
textView.Services.RemoveService(typeof(IOutlineContentHost));
contentHost.Dispose();
}
textView.Services.RemoveService(typeof(XamlLanguageBinding));
colorizer.Dispose();
contentHost.Dispose();
}
}
}

Loading…
Cancel
Save