Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

UML Import Model Trimmer

< To: Tigerstripe Extension Points

  • Full name : org.eclipse.tigerstripe.workbench.ui.UML2Import.umlImportModelTrimmer

Purpose : During a UML2 import, the Model that is being imported can be "trimmed" to prevent unncessary imports. This can be useful in the following situations: If there are "private" parts of the model that you do not wish to import into Tigerstripe. If you have previously imported the Model and wish to only se "deltas", you can keep a record of what is imported and then only present deltas for re-import.

  • Usage :

The extension point only has 2 attributes: "name" - This is only used for logging and has no functional purpose. "trimmer_class" - This is the name of a class that must implement the IModelTrimmer interface.

The IModelTrimmer interface has only one method : public Model trimModel(Model modelToTrim);

The UML2 Model that is loaded form the specified files is passed in and a UML2 Model is to be returned. There are no constraints as to the relationship between the two models.

  • Example :

This example would allow for removal of any element with the stereotype "Private" to be removed. The removal should take care to maintain the integrity of the model.

   public Model trimModel(Model modelToTrim) {
       List<EObject> itemsToRemove = new ArrayList<EObject>();
       TreeIterator t = modelToTrim.eAllContents();
       t = modelToTrim.eAllContents();
       while (t.hasNext()) {
           EObject eObject = (EObject);
           if (eObject instanceof Classifier) {
               Classifier classifier = (Classifier) eObject;
               if (classifier.getAppliedStereotype("Private") != null){
                   // Add to list of items to remove from Model
       // Do the removal here	
       return modelToTrim;

Back to the top