Hi 
Team,
 
I'm developing a model validator and encountered an 
issue which is (very likely) about synchronization between the validator and 
the model.  Let me give the issue and explain related validation 
logic below. Your suggestions are very much 
appreciated.
 
The model 
validator is an eclipse plugin which checks standard Tigerstripe 
models against some error conditions specific in the context of TMF interfaces. 
An example of the error conditions is "int-based enumeration", which is 
allowed in general Tigerstripe model but not recommended to use in TMF 
Interfaces. 
 
1. the issue - 
synchronization between the validator and the 
model
 
To 
reproduce the issue:
1. run 
validator on a model.
2. edit the model to correct an error
3. run 
validator on the updatd model
 
Result: 
1. the 
validator still gives the findings number (which is calculated at runtime) 
as in previous run and show all the previous findings, including the 
error already fixed. 
2. 
restart the workbench, run the validator again, it shows correct 
findings.
 
Note that 
at runtime all markers owned by this validator are cleaned up before a new run, 
so this issue is not likely caused by cache of the findings but possibly by 
cache of model artifacts information.
 
Below I'll explain the logic of the 
validator.
 
 
2. The logic of the validator with the reading 
of Tigerstripe models highlighted
 
Let's explain the logic in top down style, 
totally 3 steps.
 
1) In 
Tigerstripe workbench, right click on a standard Tigerstripe model and choose 
"Validate TIP Model" in the pop-up menu. According to the configuration in 
plugin.xml, the plugins will start 
ValidateTipModelActionDelegate:
 
  <extension 
point="org.eclipse.ui.popupMenus">
 
  
  <objectContribution
            
objectClass="org.eclipse.tigerstripe.workbench.project.ITigerstripeModelProject"
            
adaptable="true"
            
id="org.tmforum.tip.model.validate.projcontribution">
            
<action
        
  id="validateModelActionDelegate"
        
  label="Validate TIP 
Model"
        
  class="org.tmforum.tip.model.validate.ValidateTipModelActionDelegate"
        
  enablesFor="1"/>
        
 <!-- more actions -->
  
  </objectContribution>
    
  
  <!-- objectContributions -->
 
 </extension>
 
2) The 
ValidateTipModelActionDelegate implements 
IActionDelegate. It reads the Tigerstripe model and give the artifacts 
information to concrete validation logic implemented in the class 
ValidateTipModelAction.
 
public 
class ValidateTipModelActionDelegate implements 
org.eclipse.ui.IActionDelegate 
{
        private 
ISelection selection;
 
        public void 
selectionChanged(IAction action, ISelection selection) 
{
             
  this.selection = 
selection;
       }
 
       public void 
run(IAction action) {
 
           
if (!selection.isEmpty() && selection instanceof IStructuredSelection) 
{
                 
   IStructuredSelection structuredSelection = 
(IStructuredSelection) selection;
                   
// the project in 
focus
                
   Object element = 
structuredSelection.getFirstElement();
                
                
   if (element instanceof ITigerstripeModelProject) 
{
                         //The precise type of the focused project is 
org.eclipse.tigerstripe.workbench.internal.api.impl.TigerstripeOssjProjectHandle
                          System.out.println("ValidateTipModelActionDelegate: 
the element is an instance of ITigerstripeModelProject. Its precise type is 
\'"  + element.getClass() + "\'");
                        
                         ProgressMonitorDialog 
dialog = new 
ProgressMonitorDialog(Display.getDefault().getActiveShell());
                         
                         
//read the details of the model 
project
                     
    TipModelValidationContext context = new 
TipModelValidationContext();
                     
    context.setProgressMonitorDialog(dialog);
                        context.init((ITigerstripeModelProject) 
element);//see (3) for details
                        
Collection<IAbstractArtifact> artifacts = 
context.getArtifacts();
                         
                       
// give the artifacts to concrete validation 
logic
                        
ValidateTipModelAction validateAction = new 
ValidateTipModelAction();
                        validateAction.setArtifacts(artifacts);
                        validateAction.setProgressMonitorDialog(dialog);
                        validateAction.run();
                  } 
else 
{
                        System.out.println("ValidateTipModelActionDelegate: 
this is not a Tigerstripe model project: \'"  + element.getClass() + 
"\'");
                   }
              }
         }
}
 
3) read 
details of the model - the logic of context.init((ITigerstripeModelProject) 
element)
 
org.eclipse.tigerstripe.workbench.project.ITigerstripeModelProject 
handler = null;
handler = (ITigerstripeModelProject) 
element;
 
org.eclipse.tigerstripe.workbench.internal.api.impl.ArtifactManagerSessionImpl 
session = (ArtifactManagerSessionImpl) 
handle.getArtifactManagerSession();
session.refreshAll(true, 
_monitor); 
session.updateCaches(_monitor);
 
monitor.worked(1);
monitor.subTask("reading artifacts 
...");
org.eclipse.tigerstripe.workbench.internal.core.model.ArtifactManager 
artifactMgr = session.getArtifactManager();
Collection<IAbstractArtifact> artifacts = 
artifactMgr.getAllArtifacts(false, _monitor));//here 'false' means dont include 
dependencies
this.setArtifacts(artifacts);
 
 
best 
regards,
Jinzhai