The Connector for Source Code Management enhances the Relations
View with information about connections between pure::variants model elements and
source code. Relations are added for features which are used in conditions of the
ps:condxml
and ps:condtext
elements. For ps:flag
and
ps:flagfile
elements the location of preprocessor constants in C/C++ source
files are shown. In addition the locations of matching preprocessor constants are shown for a
selected feature by using the mapping between feature unique names and preprocessor
constants.
The relation indexer can be activated on a special project property page. Select the project and choose the Properties item in the context menu. In the upcoming dialog select the Relation Indexer page.
The relation indexer is activated for the project by selecting the Enable Relation Indexer option (1). After enabling the indexer there are some more options to define the project specific behavior. The indexing of pure::variants Conditions and C/C++ Preprocessor Constants can be activated separately (2). The list with file name patterns (3) is used to select the files for indexing. Only files which match one of the patterns are scanned. Add the "*" as pattern to scan all files of a project.
After activating the indexer for a project a builder is added to the project. This builder scans changed files for new relations to pure::variants model elements automatically.
With activated relation indexer the Relations View contains additional entries. These entries shows the name of the file and the line number of the variant point. The tool tip shows the appropriate section of the file. By double-clicking the entry the file will be opened into an editor.
The pure::variants condition can be used to include or exclude sections of a file depending on a feature selection. The Condition Indexer scans for such rules and extracts the referenced features. If such a feature is selected in the editor the Relations View will show all files and lines where a condition with the selected feature is located (see Figure 6, “Representation of a Condition in the Relations View”).
To get a detailed explanation on how to define conditions, consult the section ps:condtext of chapter 9.5.7 of the pure::variants User's Guide (Reference-->Predefined Source Element Types-->ps:condtext).
The C/C++ Preprocessor Indexer scans files for
constants used in preprocessor rules (e.g. #ifdef
, #ifndef
,
...). If a ps:flag
or ps:flagfile
element is selected the
Relations View shows the usage of the defined preprocessor constant.
The Relations View also shows preprocessor constants connected to features by using
mapping patterns. For this the patterns are expanded with the data of the selected
feature. The resulting symbols are used to search for matching preprocessor constants.
Figure 7, “Representation of a C/C++ Preprocessor Constant in the Relations View” shows an example with the pattern
fame{Name}
. The pattern is expanded with the unique name of the feature to
fameNative
. In the indexed code there are 76 locations where the
preprocessor constant fameNative
is used. This locations are shown in the
Relations View. The patterns can be defined in the
preferences (see Section 3.3, “The Preferences”).
To change the default behavior of the indexer open the Eclipse preferences and select the Relation Indexer page in the Variant Management category. The page shows two lists.
The upper list contains the default file patterns for the indexer (1). This list is the initial pattern setting for newly enabled projects.
The lower list contains the mapping between features and preprocessor constants (2). This mapping is used for all projects. Table 1, “Supported Mapping Replacements” shows all possible replacements.
Table 1. Supported Mapping Replacements
Wildcard | Description | Example: FeatureA |
---|---|---|
Name | the Unique Name of the selected feature | FLAG_{Name} - FLAG_FeatureA |
NAME | the upper case Unique Name of the selected feature | FLAG_{NAME} - FLAG_FEATUREA |
name | the lower case Unique Name of the selected feature | flag_{name} - flag_featurea |