Eusebiu Marcu 14 years ago
parent
commit
722e90a904
  1. 4
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs
  2. 15
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs
  3. 5
      src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs
  4. 5
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs
  5. 3
      src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs

4
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/AvalonEditViewContent.cs

@ -139,10 +139,6 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -139,10 +139,6 @@ namespace ICSharpCode.AvalonEdit.AddIn
codeEditor.SyntaxHighlighting =
HighlightingManager.Instance.GetDefinitionByExtension(Path.GetExtension(file.FileName));
if (!file.IsUntitled) {
codeEditor.PrimaryTextEditor.IsReadOnly = (File.GetAttributes(file.FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly;
}
codeEditor.Load(stream);
// Load() causes the undo stack to think stuff changed, so re-mark the file as original if necessary
if (!this.PrimaryFile.IsDirty) {

15
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeEditorView.cs

@ -84,6 +84,21 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -84,6 +84,21 @@ namespace ICSharpCode.AvalonEdit.AddIn
get { return this.Adapter.FileName; }
}
public new bool IsReadOnly {
get {
if (!File.Exists(FileName))
return base.IsReadOnly;
if ((File.GetAttributes(FileName) & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
return true;
return base.IsReadOnly;
}
set {
base.IsReadOnly = value;
}
}
protected override void OnOptionChanged(PropertyChangedEventArgs e)
{
base.OnOptionChanged(e);

5
src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs

@ -72,6 +72,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -72,6 +72,11 @@ namespace ICSharpCode.SharpDevelop.Gui
/// </summary>
void SelectWindow();
/// <summary>
/// Refresh window status: title, infotip, lock.
/// </summary>
void RefreshStatus();
/// <summary>
/// Is called when the title of this window has changed.
/// </summary>

5
src/Main/Base/Project/Src/Gui/Workbench/Layouts/AvalonWorkbenchWindow.cs

@ -267,6 +267,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -267,6 +267,11 @@ namespace ICSharpCode.SharpDevelop.Gui
Activate();//this.SetAsActive();
}
public void RefreshStatus()
{
UpdateActiveViewContent();
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();

3
src/Main/Base/Project/Src/Services/File/FileChangeWatcher.cs

@ -137,6 +137,7 @@ namespace ICSharpCode.SharpDevelop @@ -137,6 +137,7 @@ namespace ICSharpCode.SharpDevelop
watcher.Path = Path.GetDirectoryName(fileName);
watcher.Filter = Path.GetFileName(fileName);
watcher.EnableRaisingEvents = true;
watcher.NotifyFilter |= NotifyFilters.Attributes;
} catch (PlatformNotSupportedException) {
if (watcher != null) {
watcher.Dispose();
@ -173,6 +174,8 @@ namespace ICSharpCode.SharpDevelop @@ -173,6 +174,8 @@ namespace ICSharpCode.SharpDevelop
delegate { MainForm_Activated(this, EventArgs.Empty); } );
}
}
file.RegisteredViewContents.ForEach(vc => vc.WorkbenchWindow.RefreshStatus());
}
void MainForm_Activated(object sender, EventArgs e)

Loading…
Cancel
Save