Implementing pluglets
Before you begin
The Model Enumeration pluglet lists the contents of a selected class in a model. It demonstrates basic model examination. The Model Enumeration function is implemented in the run method of the EnumModel class. In this method, the selected elements are obtained from the model. From a modeling perspective, the UMLModeler class allows you access to a model and its contents. An editing context is established. For each selected element, the contents are iterated using the logObject method. The contents are obtained as a list of EMF EObjects. The objects names are listed using the toString method.
The Fan-In pluglet calculates the fan-in metric for a class. The fan-in metric represents the number of references that a class has when selected in the Project Explorer. The Fan-In pluglet initiates the plugletMain method, which iterates through the user selections. If the selection is an instance of a UML class, the calcFanIn method is called. This method accesses the model through the execute method of the ResourceSetReadOperation class. The class references are calculated using the getReferencingClassesByOperation and getReferencingClassesByProperty methods. These two methods use the IEObjectHelper.getReferencers method.