Skip to content
jeremiaheinle edited this page Apr 21, 2021 · 50 revisions

VariantSync documentation:

The documentation differentiates between the main datastructure, the view, events and interfaces. The rest is blue.

legend of documentation pictures

Main datastructure

IPatch, IDelta, IVariantSyncMarker

VariantSyncPlugin is the activator class for the Eclipse Plugin (extends AbstractUIPlugin). It is a central class, that provides access to the main datastructure (seen below), Eclipse UI elements and propagates events. More info in VariantSyncPlugin page. The ConfigurationProjectManager creates and stores ConfigurationProjects. A ConfigurationProject represents a current Workspace it has a single IFeatureProject and multiple IProjects. Representing the a FeatureIDEProject and the mutiple product variants. A ConfigurationProject has three important classes for storage ( MappingManager, PatchesManager, FeatureContextManager). The MappingManager stores changes that have been applied to the files of a project variant. This information is important for creating and keeping track of the Eclipse Markers inside of the editor. SourceFile stores CodeMappings for a single file. A CodeMappings stores the lines of code affected and AMarkerInformation. AMarkerInformation stores the Information needed for representing a Eclipse Marker. FeatureContextManager is responsible for keeping track of FeatureContexts. FeatureContexts store the names of features from the FeatureIDEProject and the corrsponding Highlighter Color chosen in the FeatureContextWizard. The PatchesManager stores all created APatches. A Patch is a accumulation of DefaultDeltas. Deltas stores the changes of a file, with a lot of additional information . The CodeMappings in SourcFile also get created, with the help of Deltas. A Patch accumulates all the Deltas created in a session.

If a class gets accessed through a interface, a interface class is next to the arrow in the figure below. the main datastructure stores state about features, changes and markers per project.

Changes Propagation

IResoureEvent, ResourceChangeHandler,ResourceChangeVisitor, CodeMappingHandler

MappingManager,VariantSyncEvent, VariantSyncPlugin, IEventListener

PartAdapter, MarkerUtils

The following graph demonstrates the propagation of changes inside a product variant. This graph focuses on how Markers are created. the propagation of changes troughout the project, if a file gets edited.

Markers also get created manually inside of DynamicContextPopupItems.

Patches Propagation

IResoureEvent, ResourceChangeHandler,ResourceChangeVisitor

PatchesManager,VariantSyncEvent, VariantSyncPlugin, IEventListener

ResourceTree,FeatureTree,ProjectTree

The following graph demonstrates the propagation of changes inside a product variant. This graph focuses on how patches get created and moved to the view. describes the propagation of a patch throughout the project

Synchronization

The Synchronization between Variants happens inside the view classes TargetFocus, SourceFocus, ResourceChanges and with the help of the classes TargetsCalculator, SynchronizationHandler, ResourceCompareInput, which are from inside the package syncronization. The Tree classes in the View provide the Deltas relevant for the operations. VariantSyncPlugin is also necessary to get additional information about FeatureIDE Configurations and the project structure, besides this, it does not require other classes from the Main Datatstructure.

TargetsCalculator is a utility class that calculates to which other Variants a feature should be synchronized. It uses VariantSyncPlugin to get info about Projects and the currently selected Configuration of the FeatureIDEProject, to determine which Features should be synchronized. It uses the DefaultDeltaFactory to determine if a Delta is automatically synchronizable or not. TargetsCalculator is needed in the ResourceChanges view.

SynchronizationHandler is responsible for synchronizing Deltas to another Variant (IProject). If automatic synchronization is possible this is performed with the help of the appylDelta function in DefaultDeltaFactory. If not, manual Synchronization has to be performed, this is done with the help of ResourceCompareInput. The SynchronizationHandler gets called, when the Synchronization Button inside of the TargetFocus or SourceFocus gets clicked.

ResourceCompareInput is a UI Element for merging two text files. It pop us when the the synchronize button in TargetFocus or SourceFocus gets pressed but no automatic merging is possible.

Storage in XML

The classes MappingManager, PatchesManager, FeatureContextManager, ConfigurationProject of the Main Datastructure get stored inside of XML files. This is necessary to store Data like Markers and FeatureContext, even after Eclipse has been closed. To do so, they all implement the ISaveableManager. XML operation are done by the CodeMappingFormat,PatchFormat and FeatureContextFormat, they all extend the AXMLFormat class from FeatureIDE. XMLFormatHelper is a helper class.

Event System

IEventManager -> VariantSyncPlugin, VariantSyncEvent, FeatureIDEEvent, IEventListener, de.ovgu.featureide.fm.core.base.event.IEventListener

Events can be differentiated into two types.

VariantSyncEvents: The mechanism to propagate VariantSyncEvents works as follows. VariantSyncPlugin has a List of IEventListeners and a method fireEvent(VariantSyncEvent event). A class can create a VariantSyncEvent element, containing a reference to itself, an EventType and two Objects relevant to the Event. Then fireEvent gets called which propagates the Event to all the classes that implement IEventListener. So VariantSyncPlugin functions as a central class which Broadcast all of the VariantSyncEvents. What Type of Event gets fired and listened for by which class can be viewed in the Event Page.

FeatureIDEEvents: FeatureIDEEvents only gets processed in the ConfigurationProjectManager, since it implements the FeatureIDE EventListener. It processes the Events thrwon, when the FeatureIDEProject gets edited.

Clone this wiki locally