-
-
Notifications
You must be signed in to change notification settings - Fork 15
Plugin Extensions Module
type: module title: Plugin Extensions Module created: 2026-05-25 updated: 2026-05-25 tags:
- domain/metrics
- domain/ui status: mature related:
- "Metrics Module"
- "Feature Location Module"
- "Extension Points"
- "Feature Metrics View" sources:
- .raw/MetricsService.java
- .raw/ProjectMetricsService.java
- .raw/HighlighterService.java
- .raw/FeatureHighlighterService.java
- .raw/GetProjectMetrics.java
- .raw/GetFeatureMetricsForFeature.java
Package: se.isselab.HAnS.pluginExtensions
The primary API surface for external plugins. All methods fall into regions tagged in the source:
| Method | Return | Notes |
|---|---|---|
getFeatures() |
List<FeatureModelFeature> |
All registered features |
getChildFeatures(feature) |
List<FeatureModelFeature> |
Direct children in model tree |
getParentFeature(feature) |
FeatureModelFeature |
Returns file root if at top level |
isRootFeature(feature) |
boolean |
True if parent is FeatureModelFile
|
getRootFeature(feature) |
FeatureModelFeature |
Walks up until parent is FeatureModelFile
|
getRootFeatures() |
List<FeatureModelFeature> |
All top-level features via sibling traversal |
| Method | Notes |
|---|---|
getFeatureFileMappingOfFeature(map, feature) |
Lookup by feature.getLPQText()
|
isFeatureInFeatureModel(map, feature) |
Map containment check |
getFeatureFileMappingBackground(feature, callback) |
Spawns GetFeatureFileMappingForFeature
|
getAllFeatureFileMappingsBackground(callback) |
Spawns GetFeatureFileMappings
|
| Method | Notes |
|---|---|
getTotalFeatureLineCount(mapping) |
Delegates to FeatureFileMapping.getTotalFeatureLineCount()
|
getFeatureLineCountInFile(mapping, location) |
Uses location.getMappedPathPairMappedBy() as key |
| Method | Notes |
|---|---|
getTanglingMapOfFeature(map, feature) |
Direct HashMap.get()
|
getFeatureTanglings(feature, callback) |
Spawns GetTangledFeaturesForFeature
|
getFeatureTanglingDegreeBackground(feature, callback) |
Spawns GetTanglingDegreeForFeature
|
getTanglingMapBackground(callback) |
Spawns GetTanglingMap
|
| Method | Notes |
|---|---|
getFeatureScattering(mapping) |
Calls FeatureScattering.getScatteringDegree(mapping) directly |
getFeatureScatteringBackground(feature, callback) |
Spawns GetScatteringDegreeForFeature
|
| Method | Notes |
|---|---|
getNestingDepthsBackGround(feature, callback) |
Spawns GetNestingDepthsForFeature
|
| Method | Notes |
|---|---|
getNumberOfAnnotatedFilesBackground(feature, callback) |
Spawns GetNumberOfAnnotationsForFeature
|
| Method | Notes |
|---|---|
getFeatureLocations(mapping) |
Delegates to FeatureFileMapping.getFeatureLocations()
|
getListOfFeatureLocationBlock(location) |
Delegates to FeatureLocation.getFeatureLocations()
|
| Method | Notes |
|---|---|
getProjectMetricsBackground(callback) |
Spawns GetProjectMetrics (all features) |
getFeatureMetricsBackground(callback, feature) |
Spawns GetFeatureMetricsForFeature
|
@Service(Service.Level.PROJECT) — one instance per project, accessed via project.getService(ProjectMetricsService.class).
All async methods follow the pattern:
new BackgroundTask(project, "title", callback, [optional data]).queue();getRootFeatures() traverses sibling PSI links (prev/next) from FeatureModelUtil.findFeatures().getFirst().
| Method | Notes |
|---|---|
highlightFeatureInFeatureModel(String lpq) |
Opens feature model and scrolls to feature by LPQ |
highlighFeatureInFeatureModel(FeatureModelFeature) |
Same, but from PSI element |
openFileInProject(String path) |
Opens file in editor |
openFileInProject(String path, int start, int end) |
Opens file and highlights line range |
@Service(Service.Level.PROJECT) — thin delegate to static FileHighlighter methods.
Runs in background thread:
-
FeatureLocationManager.getAllFeatureFileMappings(project)— full location scan -
FeatureTangling.getTanglingMap(project, mappings)— tangling -
NestingDepths.getNestingDepthMap(mappings)— nesting
Then iterates every FeatureFileMapping, computes per-feature metrics and sets them on the FeatureModelFeature:
-
scatteringDegree,tanglingDegree,lineCount -
avgNestingDepth,maxNestingDepth,minNestingDepth -
numberOfAnnotatedFiles,numberOfFolderAnnotations,numberOfFileAnnotations
Constructs ProjectMetrics snapshot. On onSuccess() → callback.onComplete(metrics).
Progress indicator: fraction 0 → 1 over feature count.
Sequentially runs four sub-tasks inline (reusing same ProgressIndicator):
-
GetScatteringDegreeForFeature(0% → 25%) -
GetTanglingDegreeForFeature(25% → 50%) -
GetNestingDepthsForFeature(50% → 75%) -
GetNumberOfAnnotationsForFeature(75% → 100%)
On onSuccess() → callback.onComplete(feature).
[!key-insight]
GetFeatureMetricsForFeaturecalls.run(indicator)directly on sub-tasks rather than.queue()— they share the same background thread and progress indicator.
| Interface |
onComplete signature |
|---|---|
MetricsCallback |
(ProjectMetrics) |
FeatureCallback |
(FeatureModelFeature) |
FeatureFileMappingCallback |
(HashMap<String, FeatureFileMapping>) |
TanglingMapCallback |
(HashMap<FeatureModelFeature, HashSet<FeatureModelFeature>>) |
- Metrics Module — calculator implementations
- Feature Location Module — data model consumed by all tasks
- Extension Points — how external plugins register callbacks
Modules
Components
- Annotation Syntax
- Feature Model Language
- Feature Model View
- Feature Metrics View
- Traffic Light
- Extension Points
- Syntax Highlighting
- Live Templates
Decisions
Dependencies
Flows