@Override
  public void pluginAdded(final Object serviceObject) {
    try {
      SpoonPluginInterface spoonPluginInterface =
          (SpoonPluginInterface) getPluginRegistry().loadClass((PluginInterface) serviceObject);

      if (plugins.get(serviceObject) != null) {
        return;
      }
      SpoonPluginCategories categories =
          spoonPluginInterface.getClass().getAnnotation(SpoonPluginCategories.class);
      if (categories != null) {
        for (String cat : categories.value()) {
          List<SpoonPluginInterface> categoryList = pluginCategoryMap.get(cat);
          if (categoryList == null) {
            categoryList = new ArrayList<>();
            pluginCategoryMap.put(cat, categoryList);
          }
          categoryList.add(spoonPluginInterface);
        }
      }

      if (spoonPluginInterface.getPerspective() != null) {
        getSpoonPerspectiveManager().addPerspective(spoonPluginInterface.getPerspective());
      }

      plugins.put(serviceObject, spoonPluginInterface);

    } catch (KettlePluginException e) {
      e.printStackTrace();
    }
  }
  @Override
  public void pluginRemoved(Object serviceObject) {
    SpoonPluginInterface spoonPluginInterface = plugins.get(serviceObject);
    if (spoonPluginInterface == null) {
      return;
    }

    SpoonPluginCategories categories =
        spoonPluginInterface.getClass().getAnnotation(SpoonPluginCategories.class);
    if (categories != null) {
      for (String cat : categories.value()) {
        List<SpoonPluginInterface> categoryList = pluginCategoryMap.get(cat);
        categoryList.remove(spoonPluginInterface);
      }
    }

    if (spoonPluginInterface.getPerspective() != null) {
      getSpoonPerspectiveManager().removePerspective(spoonPluginInterface.getPerspective());
    }

    plugins.remove(serviceObject);
  }