I am trying to creat a popup action for the Papyrus model browser popup menu that will create a UML Class and apply a stereotype to it. In the old Papyrus version we used the extension point org.eclipse.ui.popupMenus and actions (see below) that enables the menu based on the meta class (e.g. objectState name="isUmlType" value="Class"):

you could look in the plugins org.eclipse.papyrus.sysml.modelexplorer and org.eclipse.papyrus.sysml.service.types to see how we create SysML blocks directly from the model explorer, in the menu "create new child" etc.

Otherwise, there are many actions placed on the model explorer. For example, look into the org.eclipse.papyrus.uml.modelexplorer plugin.

The code you propose as an implementation of an action should take care of the fact that Papyrus as migrate to GMF and EMF Transaction.
Thus, it requires to encapsulate commands in a transaction, otherwise, you will have a read/write exception when modifying the model.
I invite you to read the documentation of EMF Transaction project.