Model Access

Feature models (.fmp files) are serialized using standard EMF serializer and stored in XMI (the resource type is set to XMI in .genmodel). The root of the resource is an instance of Project class. fmp.util.FmpResourceImpl is the implementation of the resource for storing feature models. It is best to load resources using editing domain.

fmp.util.FmpExternalLoader class can be used to load multiple resources the same way the FmpEditor would. To load a resource use public void load(IFile file) or public void load(String fullPath) functions (where fullName is the same as IFile.getFullPath()). Retrieve the list of loaded resources using public EList getResources(). The root object of a resource can be retrieved using getAllContents().next(). In case of feature models, the root object can be cast to Project class.

The model should be modified using commands, which, in turn, can be executed on the command stack. The instance of the command stack can be obtained by calling getEditingDomain.getCommandStack(). Execute the command using getEditingDomain().getCommandStack().execute(Command command).

The model can be saved using public void save(int i) where i is the index of a resource to be saved.

Details of the fmp.util.FmpExternalLoader class.

  • public AdapterFactory getAdapterFactory()
  • public EditingDomain getEditingDomain()
  • public void load(IFile file)
  • public void load(String fullPath)
  • public EList getResources()
  • public void save(int i)