Skip to content

Commit

Permalink
Remove object variables for collections that have to be created dynam…
Browse files Browse the repository at this point in the history
…ically eclipse-platform#2193

Since extensions can be added and removed and have to be considered when collecting marker fields, marker types, and marker groups,
we cannot create the collections once, we have to create them on demand.
  • Loading branch information
travkin79 committed Aug 16, 2024
1 parent 076a240 commit 243a928
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,8 @@ public class ContentGeneratorDescriptor {
private static final String MARKER_FIELD_REFERENCE = "markerFieldReference"; //$NON-NLS-1$

private IConfigurationElement configurationElement;
private MarkerField[] allFields;
private Collection<MarkerType> markerTypes;
private MarkerField[] initialVisible;
private Collection<MarkerGroup> groups;
private Collection<IConfigurationElement> generatorExtensions = new ArrayList<>();
private Map<String, MarkerType> allTypesTable;

/**
* Create a new ContentGeneratorDescriptor
Expand Down Expand Up @@ -186,16 +182,15 @@ public MarkerField[] getInitialVisible() {
* @return Collection of {@link MarkerGroup}
*/
public Collection<MarkerGroup> getMarkerGroups() {
if (groups == null) {
groups = new TreeSet<>((mg1, mg2) -> mg1.getMarkerField().getName().compareTo(mg2.getMarkerField().getName()));
Collection<MarkerGroup> groups = new TreeSet<>(
(mg1, mg2) -> mg1.getMarkerField().getName().compareTo(mg2.getMarkerField().getName()));

// Add the groups defined in the receiver
addDefinedGroups(groups);
// Add the groups defined in the receiver
addDefinedGroups(groups);

if (getId().equals(MarkerSupportRegistry.PROBLEMS_GENERATOR)) {
// Add the groups that reference the receiver.
groups.addAll(MarkerSupportRegistry.getInstance().getMarkerGroups());
}
if (getId().equals(MarkerSupportRegistry.PROBLEMS_GENERATOR)) {
// Add the groups that reference the receiver.
groups.addAll(MarkerSupportRegistry.getInstance().getMarkerGroups());
}
return groups;
}
Expand Down

0 comments on commit 243a928

Please sign in to comment.