[Editor] Adding Tags to Tag manager On Import

Hello there, I have 2 questions here,

  1. how to add a tag to the tag manager’s Tags array from editor on Importing something into unity say a package or a the like.

  2. I know how to find when an asset is imported into unity using asset importer or assetpostprocessor but how to i find when a package is imported.

Basically I want to set some tags for my project when I import my framwork is it possible!!?.

Cheers.

I have try this in unity4.0.
Add this script in your framework and it will works when you import your frameworkpackage.

using UnityEditor;
using UnityEngine;
using System.Collections;

public class MyClass : AssetPostprocessor 
{
    static void OnPostprocessAllAssets (
        string[] importedAssets, string[] deletedAssets,
        string[] movedAssets, string[] movedFromAssetPaths) 
    {
        if (IsMyFrameWorkTagFile(importedAssets))
        {
            SerializedObject tagManager = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/TagManager.asset")[0]);

            SerializedProperty it = tagManager.GetIterator();
            bool showChildren = true;
            while (it.NextVisible(showChildren))
            {
                //set your tags here
                if (it.name == "User Layer 31")
                {
                    it.stringValue = "MyTag31";
                }
            }
            tagManager.ApplyModifiedProperties();
        }
    }

    static bool IsMyFrameWorkTagFile(string[] asstNames)
    {
        foreach(string s in asstNames)
        {
            //replaced by your path
            if (s.Equals("Assets/Editor/MyClass.cs"))
                return true;
        }   
        return false;
    }
}