2222import java .util .Iterator ;
2323import java .util .List ;
2424import java .util .Map ;
25+ import java .util .Set ;
2526import java .util .TreeSet ;
2627import java .util .stream .Stream ;
2728
@@ -97,7 +98,7 @@ private void addGroupsFrom(IConfigurationElement element, Collection<MarkerGroup
9798 * @return boolean
9899 */
99100 public boolean allTypesSelected (Collection <MarkerType > selectedTypes ) {
100- return selectedTypes .containsAll (markerTypes );
101+ return selectedTypes .containsAll (getMarkerTypes () );
101102 }
102103
103104 /**
@@ -205,23 +206,41 @@ public Collection<MarkerGroup> getMarkerGroups() {
205206 * @return Collection of {@link MarkerType}
206207 */
207208 public Collection <MarkerType > getMarkerTypes () {
208- if (markerTypes == null ) {
209- markerTypes = new HashSet <>();
210- IConfigurationElement [] markerTypeElements = configurationElement .getChildren (MarkerSupportRegistry .MARKER_TYPE_REFERENCE );
211- for (IConfigurationElement configElement : markerTypeElements ) {
212- String elementName = configElement .getAttribute (MarkerSupportInternalUtilities .ATTRIBUTE_ID );
213- MarkerType [] types = MarkerTypesModel .getInstance ().getType (elementName ).getAllSubTypes ();
214- markerTypes .addAll (Arrays .asList (types ));
215- markerTypes .add (MarkerTypesModel .getInstance ().getType (elementName ));
216- }
217- if (markerTypes .isEmpty ()) {
218- MarkerType [] types = MarkerTypesModel .getInstance ().getType (IMarker .PROBLEM ).getAllSubTypes ();
219- markerTypes .addAll (Arrays .asList (types ));
209+ Set <MarkerType > markerTypes = new HashSet <>();
210+ addMarkerTypesFrom (configurationElement , markerTypes );
211+
212+ Iterator <IConfigurationElement > extensions = generatorExtensions .iterator ();
213+ while (extensions .hasNext ()) {
214+ IConfigurationElement extensionElement = extensions .next ();
215+ String extendingMarkerContentGeneratorId = extensionElement
216+ .getAttribute (MarkerSupportInternalUtilities .ATTRIBUTE_ID );
217+ if (extendingMarkerContentGeneratorId != null && !extendingMarkerContentGeneratorId .isBlank ()) {
218+ ContentGeneratorDescriptor descriptor = MarkerSupportRegistry .getInstance ()
219+ .getContentGenDescriptor (extendingMarkerContentGeneratorId );
220+ if (descriptor != null ) {
221+ markerTypes .addAll (descriptor .getMarkerTypes ());
222+ }
220223 }
221224 }
222225 return markerTypes ;
223226 }
224227
228+ private void addMarkerTypesFrom (IConfigurationElement markerContentGeneratorConfigElement ,
229+ Collection <MarkerType > markerTypes ) {
230+ IConfigurationElement [] markerTypeElements = markerContentGeneratorConfigElement
231+ .getChildren (MarkerSupportRegistry .MARKER_TYPE_REFERENCE );
232+ for (IConfigurationElement configElement : markerTypeElements ) {
233+ String elementName = configElement .getAttribute (MarkerSupportInternalUtilities .ATTRIBUTE_ID );
234+ MarkerType [] types = MarkerTypesModel .getInstance ().getType (elementName ).getAllSubTypes ();
235+ markerTypes .addAll (Arrays .asList (types ));
236+ markerTypes .add (MarkerTypesModel .getInstance ().getType (elementName ));
237+ }
238+ if (markerTypes .isEmpty ()) {
239+ MarkerType [] types = MarkerTypesModel .getInstance ().getType (IMarker .PROBLEM ).getAllSubTypes ();
240+ markerTypes .addAll (Arrays .asList (types ));
241+ }
242+ }
243+
225244 /**
226245 * Return the name for the receiver.
227246 *
@@ -247,14 +266,12 @@ public MarkerType getType(String typeId) {
247266 * @return Map of {@link String} to {@link MarkerType}
248267 */
249268 public Map <String , MarkerType > getTypesTable () {
250- if (allTypesTable == null ) {
251- allTypesTable = new HashMap <>();
269+ Map <String , MarkerType > allTypesTable = new HashMap <>();
252270
253- Iterator <MarkerType > allIterator = markerTypes .iterator ();
254- while (allIterator .hasNext ()) {
255- MarkerType next = allIterator .next ();
256- allTypesTable .put (next .getId (), next );
257- }
271+ Iterator <MarkerType > allIterator = getMarkerTypes ().iterator ();
272+ while (allIterator .hasNext ()) {
273+ MarkerType next = allIterator .next ();
274+ allTypesTable .put (next .getId (), next );
258275 }
259276 return allTypesTable ;
260277 }
0 commit comments