mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not use write action when creating webservicessettings component
This commit is contained in:
@@ -1,12 +1,19 @@
|
||||
package com.intellij.openapi.fileTypes;
|
||||
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author yole
|
||||
*/
|
||||
public interface FileTypeConsumer {
|
||||
void consume(final FileType fileType, @NonNls final String extensions);
|
||||
String EXTENSION_DELIMITER = ";";
|
||||
|
||||
void consume(final FileType fileType, final FileNameMatcher... matchers);
|
||||
void consume(final @NotNull FileType fileType, @NonNls final String extensions);
|
||||
|
||||
void consume(final @NotNull FileType fileType, final FileNameMatcher... matchers);
|
||||
|
||||
@Nullable
|
||||
FileType getStandardFileTypeByName(@NonNls @NotNull String name);
|
||||
}
|
||||
|
||||
@@ -84,12 +84,28 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
|
||||
static {
|
||||
final FileTypeConsumer consumer = new FileTypeConsumer() {
|
||||
public void consume(final FileType fileType, final String extensions) {
|
||||
ourStandardFileTypes.put(fileType.getName(), new StandardFileType(fileType, parse(extensions)));
|
||||
public void consume(final @NotNull FileType fileType, final String extensions) {
|
||||
register(fileType, parse(extensions));
|
||||
}
|
||||
|
||||
public void consume(final FileType fileType, final FileNameMatcher... matchers) {
|
||||
ourStandardFileTypes.put(fileType.getName(), new StandardFileType(fileType, Arrays.asList(matchers)));
|
||||
public void consume(final @NotNull FileType fileType, final FileNameMatcher... matchers) {
|
||||
register(fileType, Arrays.asList(matchers));
|
||||
}
|
||||
|
||||
public FileType getStandardFileTypeByName(@NotNull final String name) {
|
||||
final StandardFileType type = ourStandardFileTypes.get(name);
|
||||
return type != null ? type.fileType : null;
|
||||
}
|
||||
|
||||
private void register(final FileType fileType, final List<FileNameMatcher> fileNameMatchers) {
|
||||
final StandardFileType type = ourStandardFileTypes.get(fileType.getName());
|
||||
|
||||
if (type != null) {
|
||||
for (FileNameMatcher matcher : fileNameMatchers) type.matchers.add(matcher);
|
||||
}
|
||||
else {
|
||||
ourStandardFileTypes.put(fileType.getName(), new StandardFileType(fileType, fileNameMatchers));
|
||||
}
|
||||
}
|
||||
};
|
||||
final FileTypeFactory[] fileTypeFactories = Extensions.getExtensions(FileTypeFactory.FILE_TYPE_FACTORY_EP);
|
||||
@@ -619,7 +635,7 @@ public class FileTypeManagerImpl extends FileTypeManagerEx implements NamedJDOME
|
||||
|
||||
private static List<FileNameMatcher> parse(@NonNls String semicolonDelimited) {
|
||||
if (semicolonDelimited == null) return Collections.emptyList();
|
||||
StringTokenizer tokenizer = new StringTokenizer(semicolonDelimited, ";", false);
|
||||
StringTokenizer tokenizer = new StringTokenizer(semicolonDelimited, FileTypeConsumer.EXTENSION_DELIMITER, false);
|
||||
ArrayList<FileNameMatcher> list = new ArrayList<FileNameMatcher>();
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
list.add(new ExtensionFileNameMatcher(tokenizer.nextToken().trim()));
|
||||
|
||||
Reference in New Issue
Block a user