コード例 #1
0
		public void Attach(ITextEditor editor)
		{
			this.editor = editor;
			inspectionManager = new IssueManager(editor);
			codeManipulation = new CodeManipulation(editor);
			renderer = new CaretReferenceHighlightRenderer(editor);
			
			// Patch editor options (indentation) to project-specific settings
			if (!editor.ContextActionProviders.IsReadOnly) {
				contextActionProviders = AddInTree.BuildItems<IContextActionProvider>("/SharpDevelop/ViewContent/TextEditor/C#/ContextActions", null);
				editor.ContextActionProviders.AddRange(contextActionProviders);
			}
			
			// Create instance of options adapter and register it as service
			var formattingPolicy = CSharpFormattingPolicies.Instance.GetProjectOptions(
				SD.ProjectService.FindProjectContainingFile(editor.FileName));
			options = new CodeEditorFormattingOptionsAdapter(editor.Options, formattingPolicy.OptionsContainer);
			var textEditor = editor.GetService<TextEditor>();
			if (textEditor != null) {
				var textViewServices = textEditor.TextArea.TextView.Services;
				
				// Unregister any previous ITextEditorOptions instance from editor, if existing, register our impl.
				textViewServices.RemoveService(typeof(ITextEditorOptions));
				textViewServices.AddService(typeof(ITextEditorOptions), options);
				
				// Set TextEditor's options to same object
				originalEditorOptions = textEditor.Options;
				textEditor.Options = options;
			}
		}
コード例 #2
0
 public override bool SaveOptions()
 {
     foreach (var m in viewModels)
     {
         m.Provider.CurrentSeverity = m.Severity;
     }
     IssueManager.SaveIssueSeveritySettings();
     return(base.SaveOptions());
 }
コード例 #3
0
		public void Attach(ITextEditor editor)
		{
			this.editor = editor;
			inspectionManager = new IssueManager(editor);
			codeManipulation = new CodeManipulation(editor);
			
			if (!editor.ContextActionProviders.IsReadOnly) {
				contextActionProviders = AddInTree.BuildItems<IContextActionProvider>("/SharpDevelop/ViewContent/TextEditor/C#/ContextActions", null);
				editor.ContextActionProviders.AddRange(contextActionProviders);
			}
		}
コード例 #4
0
		public void Detach()
		{
			codeManipulation.Dispose();
			if (inspectionManager != null) {
				inspectionManager.Dispose();
				inspectionManager = null;
			}
			if (contextActionProviders != null) {
				editor.ContextActionProviders.RemoveAll(contextActionProviders.Contains);
			}
			this.editor = null;
		}
コード例 #5
0
            public InspectionTag(IssueManager manager, IssueProvider provider, ITextSourceVersion inspectedVersion, string description, int startOffset, int endOffset, IssueMarker markerType, IEnumerable <CodeAction> actions)
            {
                this.manager          = manager;
                this.Provider         = provider;
                this.InspectedVersion = inspectedVersion;
                this.Description      = description;
                this.StartOffset      = startOffset;
                this.EndOffset        = endOffset;
                this.Severity         = provider.CurrentSeverity;
                this.MarkerType       = markerType;

                this.Actions = actions.Select(Wrap).ToList();
            }
コード例 #6
0
			internal IssueTreeNode(IssueManager.IssueProvider provider)
			{
				this.Provider = provider;
				this.attribute = provider.Attribute;
			}
コード例 #7
0
		public void Detach()
		{
			var textEditor = editor.GetService<TextEditor>();
			if (textEditor != null) {
				var textView = textEditor.TextArea.TextView;
				
				// Unregister our ITextEditorOptions instance from editor
				var optionsService = textView.GetService<ITextEditorOptions>();
				if ((optionsService != null) && (optionsService == options))
					textView.Services.RemoveService(typeof(ITextEditorOptions));
				
				// Reset TextEditor options, too?
				 if ((textEditor.Options != null) && (textEditor.Options == options))
				 	textEditor.Options = originalEditorOptions;
			}
			
			codeManipulation.Dispose();
			if (inspectionManager != null) {
				inspectionManager.Dispose();
				inspectionManager = null;
			}
			if (contextActionProviders != null) {
				editor.ContextActionProviders.RemoveAll(contextActionProviders.Contains);
			}
			renderer.Dispose();
			options = null;
			this.editor = null;
		}
コード例 #8
0
		internal IssueOptionsViewModel(IssueManager.IssueProvider provider)
		{
			this.Provider = provider;
			this.attribute = provider.Attribute;
			this.Severity = attribute.Severity;
		}
コード例 #9
0
			public InspectionTag(IssueManager manager, IssueProvider provider, ITextSourceVersion inspectedVersion, string description, int startOffset, int endOffset, IssueMarker markerType, IEnumerable<CodeAction> actions)
			{
				this.manager = manager;
				this.Provider = provider;
				this.InspectedVersion = inspectedVersion;
				this.Description = description;
				this.StartOffset = startOffset;
				this.EndOffset = endOffset;
				this.Severity = provider.CurrentSeverity;
				this.MarkerType = markerType;
				
				this.Actions = actions.Select(Wrap).ToList();
			}
コード例 #10
0
			internal IssueTreeNode(IssueManager.IssueProvider provider, Action checkedChanged)
			{
				this.Provider = provider;
				this.attribute = provider.Attribute;
				this.checkedChanged = checkedChanged;
				this.PropertyChanged += OnPropertyChanged;
			}