Inheritance: System.EventArgs
Example #1
0
        public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded)
        {
            // Check if the item is a nemerle file.
            //

#if DEBUG
            string itemName;
            string parentName;
            string siblingName;

            Hierarchy.GetCanonicalName(itemidAdded, out itemName);
            Hierarchy.GetCanonicalName(itemidParent, out parentName);
            Hierarchy.GetCanonicalName(itemidSiblingPrev, out siblingName);

            Debug.WriteLine(string.Format("tr: \tOnItemsAdded '{0}' to '{1}' next to '{2}'", Path.GetFileName(itemName),
                                          Path.GetFileName(parentName),
                                          Path.GetFileName(siblingName)));
#endif

            if (TryFierOnAddReference(itemidAdded))
            {
                return(VSConstants.S_OK);
            }

            string name;

            if (!IsFile(itemidAdded, out name))
            {
                return(VSConstants.S_OK);
            }

            // This item is a physical file, so we can notify that it is added to the hierarchy.
            //
            if (ItemAdded != null)
            {
                HierarchyItemEventArgs args = new HierarchyItemEventArgs(Hierarchy, itemidAdded, name);
                ItemAdded(this, args);
            }

            return(VSConstants.S_OK);
        }
Example #2
0
        public int OnItemDeleted(uint itemid)
        {
            Debug.WriteLine("tr: \tOnItemDeleted");

            // Notify that the item is deleted only if it is a nemerle file.
            //
            string name;

            if (!IsFile(itemid, out name))
            {
                return(VSConstants.S_OK);
            }

            if (ItemDeleted != null)
            {
                HierarchyItemEventArgs args = new HierarchyItemEventArgs(Hierarchy, itemid, name);
                ItemDeleted(this, args);
            }

            return(VSConstants.S_OK);
        }
Example #3
0
        private void FileDeleted(object sender, HierarchyItemEventArgs e)
        {
            var path = e.FileName;
              var ext  = Path.GetExtension(path);
              var id   = new FileId(_stringManager.GetId(path));

              string action = e.Hierarchy.GetProp<string>(e.ItemId, __VSHPROPID4.VSHPROPID_BuildAction);

              if (action == "Compile" || action == "Nitra")
            foreach (var server in _servers)
              if (server.IsSupportedExtension(ext))
            server.FileUnloaded(id);

              Debug.WriteLine($"tr: FileAdded(FileName='{path}' id={id})");
        }
Example #4
0
        private void FileAdded(object sender, HierarchyItemEventArgs e)
        {
            var path = e.FileName;
              var ext  = Path.GetExtension(path);
              var id   = new FileId(_stringManager.GetId(path));

              string action = e.Hierarchy.GetProp<string>(e.ItemId, __VSHPROPID4.VSHPROPID_BuildAction);

              if (action == "Compile" || action == "Nitra")
              {
            object obj;
            var hr2 = e.Hierarchy.GetProperty(e.ItemId, (int)__VSHPROPID.VSHPROPID_ExtObject, out obj);

            var projectItem = obj as EnvDTE.ProjectItem;
            if (ErrorHelper.Succeeded(hr2) && projectItem != null)
            {
              var projectPath = projectItem.ContainingProject.FullName;
              var projectId = new ProjectId(_stringManager.GetId(projectPath));

              foreach (var server in _servers)
            if (server.IsSupportedExtension(ext))
              server.FileAdded(projectId, path, id, new FileVersion());

              Debug.WriteLine($"tr: FileAdded(BuildAction='{action}', FileName='{path}' projectId={projectId})");
              return;
            }
              }

              Debug.WriteLine($"tr: FileAdded(BuildAction='{action}', FileName='{path}')");
        }
Example #5
0
    public int OnItemDeleted(uint itemid)
    {
      Debug.WriteLine("tr: \tOnItemDeleted");

      // Notify that the item is deleted only if it is a nemerle file.
      //
      string name;

      if (!IsFile(itemid, out name))
        return VSConstants.S_OK;

      if (ItemDeleted != null)
      {
        HierarchyItemEventArgs args = new HierarchyItemEventArgs(Hierarchy, itemid, name);
        ItemDeleted(this, args);
      }

      return VSConstants.S_OK;
    }
Example #6
0
    public int OnItemAdded(uint itemidParent, uint itemidSiblingPrev, uint itemidAdded)
    {
      // Check if the item is a nemerle file.
      //

#if DEBUG
      string itemName;
      string parentName;
      string siblingName;

      Hierarchy.GetCanonicalName(itemidAdded, out itemName);
      Hierarchy.GetCanonicalName(itemidParent, out parentName);
      Hierarchy.GetCanonicalName(itemidSiblingPrev, out siblingName);

      Debug.WriteLine(string.Format("tr: \tOnItemsAdded '{0}' to '{1}' next to '{2}'", Path.GetFileName(itemName),
      Path.GetFileName(parentName),
      Path.GetFileName(siblingName)));
#endif

      if (TryFierOnAddReference(itemidAdded))
        return VSConstants.S_OK;

      string name;

      if (!IsFile(itemidAdded, out name))
        return VSConstants.S_OK;

      // This item is a physical file, so we can notify that it is added to the hierarchy.
      //
      if (ItemAdded != null)
      {
        HierarchyItemEventArgs args = new HierarchyItemEventArgs(Hierarchy, itemidAdded, name);
        ItemAdded(this, args);
      }

      return VSConstants.S_OK;
    }