Skip to content

Commit d33c29c

Browse files
committed
Remove object variables for collections that have to be created dynamically #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.
1 parent 4228bcc commit d33c29c

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/internal/ContentGeneratorDescriptor.java

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,8 @@ public class ContentGeneratorDescriptor {
4545
private static final String MARKER_FIELD_REFERENCE = "markerFieldReference"; //$NON-NLS-1$
4646

4747
private IConfigurationElement configurationElement;
48-
private MarkerField[] allFields;
49-
private Collection<MarkerType> markerTypes;
5048
private MarkerField[] initialVisible;
51-
private Collection<MarkerGroup> groups;
5249
private Collection<IConfigurationElement> generatorExtensions = new ArrayList<>();
53-
private Map<String, MarkerType> allTypesTable;
5450

5551
/**
5652
* Create a new ContentGeneratorDescriptor
@@ -186,16 +182,15 @@ public MarkerField[] getInitialVisible() {
186182
* @return Collection of {@link MarkerGroup}
187183
*/
188184
public Collection<MarkerGroup> getMarkerGroups() {
189-
if (groups == null) {
190-
groups = new TreeSet<>((mg1, mg2) -> mg1.getMarkerField().getName().compareTo(mg2.getMarkerField().getName()));
185+
Collection<MarkerGroup> groups = new TreeSet<>(
186+
(mg1, mg2) -> mg1.getMarkerField().getName().compareTo(mg2.getMarkerField().getName()));
191187

192-
// Add the groups defined in the receiver
193-
addDefinedGroups(groups);
188+
// Add the groups defined in the receiver
189+
addDefinedGroups(groups);
194190

195-
if (getId().equals(MarkerSupportRegistry.PROBLEMS_GENERATOR)) {
196-
// Add the groups that reference the receiver.
197-
groups.addAll(MarkerSupportRegistry.getInstance().getMarkerGroups());
198-
}
191+
if (getId().equals(MarkerSupportRegistry.PROBLEMS_GENERATOR)) {
192+
// Add the groups that reference the receiver.
193+
groups.addAll(MarkerSupportRegistry.getInstance().getMarkerGroups());
199194
}
200195
return groups;
201196
}

0 commit comments

Comments
 (0)