Ejemplo n.º 1
0
        public override void Run()
        {
            if (System.Windows.Forms.Form.ActiveForm.Modal)
            {
                return;
            }

            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window != null)
            {
                if (window.ViewContent.IsViewOnly)
                {
                    return;
                }

                if (window.ViewContent.TitleName == null)
                {
                    SaveFileAs sfa = new SaveFileAs();
                    sfa.Run();
                }
                else
                {
                    FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
                    if ((File.GetAttributes(window.ViewContent.TitleName) & attr) != 0)
                    {
                        SaveFileAs sfa = new SaveFileAs();
                        sfa.Run();
                    }
                    else
                    {
                        ICSharpCode.SharpDevelop.Project.ProjectService.MarkFileDirty(window.ViewContent.TitleName);
                        FileUtility.ObservedSave(new FileOperationDelegate(window.ViewContent.Save), window.ViewContent.TitleName);
                    }
                }
            }
        }
Ejemplo n.º 2
0
    public override void Run()
    {

      if(System.Windows.Forms.Form.ActiveForm.Modal)
        return; 

      IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
      if (window != null) 
      {
        if (window.ViewContent.IsViewOnly) 
        {
          return;
        }
        
        if (window.ViewContent.TitleName == null) 
        {
          SaveFileAs sfa = new SaveFileAs();
          sfa.Run();
        } 
        else 
        {
          FileAttributes attr = FileAttributes.ReadOnly | FileAttributes.Directory | FileAttributes.Offline | FileAttributes.System;
          if ((File.GetAttributes(window.ViewContent.TitleName) & attr) != 0) 
          {
            SaveFileAs sfa = new SaveFileAs();
            sfa.Run();
          } 
          else 
          {
            ICSharpCode.SharpDevelop.Project.ProjectService.MarkFileDirty(window.ViewContent.TitleName);
            FileUtility.ObservedSave(new FileOperationDelegate(window.ViewContent.Save), window.ViewContent.TitleName);
          }
        }
      }
    }