|
14 | 14 | *******************************************************************************/
|
15 | 15 | package org.eclipse.core.internal.content;
|
16 | 16 |
|
17 |
| -import java.io.*; |
18 |
| -import java.util.*; |
| 17 | +import java.io.IOException; |
| 18 | +import java.io.InputStream; |
| 19 | +import java.io.Reader; |
| 20 | +import java.util.ArrayList; |
| 21 | +import java.util.Arrays; |
| 22 | +import java.util.Collection; |
| 23 | +import java.util.Collections; |
| 24 | +import java.util.Comparator; |
| 25 | +import java.util.HashMap; |
| 26 | +import java.util.HashSet; |
| 27 | +import java.util.Iterator; |
| 28 | +import java.util.List; |
| 29 | +import java.util.Map; |
19 | 30 | import java.util.Map.Entry;
|
| 31 | +import java.util.Set; |
20 | 32 | import java.util.regex.Pattern;
|
21 |
| -import org.eclipse.core.runtime.*; |
22 |
| -import org.eclipse.core.runtime.content.*; |
| 33 | +import org.eclipse.core.runtime.CoreException; |
| 34 | +import org.eclipse.core.runtime.ISafeRunnable; |
| 35 | +import org.eclipse.core.runtime.QualifiedName; |
| 36 | +import org.eclipse.core.runtime.SafeRunner; |
| 37 | +import org.eclipse.core.runtime.content.IContentDescriber; |
| 38 | +import org.eclipse.core.runtime.content.IContentDescription; |
| 39 | +import org.eclipse.core.runtime.content.IContentType; |
| 40 | +import org.eclipse.core.runtime.content.IContentTypeManager; |
23 | 41 | import org.eclipse.core.runtime.content.IContentTypeManager.ISelectionPolicy;
|
| 42 | +import org.eclipse.core.runtime.content.IContentTypeSettings; |
| 43 | +import org.eclipse.core.runtime.content.ITextContentDescriber; |
| 44 | +import org.eclipse.core.runtime.content.XMLRootElementContentDescriber; |
| 45 | +import org.eclipse.core.runtime.content.XMLRootElementContentDescriber2; |
24 | 46 | import org.eclipse.core.runtime.preferences.IScopeContext;
|
25 | 47 | import org.eclipse.osgi.util.NLS;
|
26 | 48 |
|
27 | 49 | public final class ContentTypeCatalog {
|
28 | 50 | private static final IContentType[] NO_CONTENT_TYPES = new IContentType[0];
|
29 | 51 |
|
30 | 52 | /**
|
31 |
| - * All fields are guarded by lock on "this" |
| 53 | + * Access to all fields is synchronized by "this" |
32 | 54 | */
|
33 | 55 | private final Map<ContentType, ContentType[]> allChildren = new HashMap<>();
|
34 | 56 | private final Map<String, IContentType> contentTypes = new HashMap<>();
|
@@ -725,15 +747,15 @@ private Set<ContentType> selectMatchingByName(final IScopeContext context, Colle
|
725 | 747 | return destination;
|
726 | 748 | }
|
727 | 749 |
|
728 |
| - void removeContentType(String contentTypeIdentifier) throws CoreException { |
| 750 | + synchronized void removeContentType(String contentTypeIdentifier) throws CoreException { |
729 | 751 | ContentType contentType = getContentType(contentTypeIdentifier);
|
730 | 752 | if (contentType == null) {
|
731 | 753 | return;
|
732 | 754 | }
|
733 | 755 | if (!contentType.isUserDefined()) {
|
734 | 756 | throw new IllegalArgumentException("Content type must be user-defined."); //$NON-NLS-1$
|
735 | 757 | }
|
736 |
| - contentTypes.remove(contentType.getId()); |
| 758 | + this.contentTypes.remove(contentType.getId()); |
737 | 759 | }
|
738 | 760 |
|
739 | 761 | }
|
0 commit comments