Skip to content

Commit

Permalink
fix: allow importing *.plist files via Grammar Import Wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Feb 13, 2024
1 parent c1722a3 commit e68b041
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import static org.eclipse.tm4e.core.internal.utils.NullSafetyHelper.lazyNonNull;

import java.nio.file.Paths;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
Expand Down Expand Up @@ -57,6 +59,7 @@ final class SelectGrammarWizardPage extends AbstractWizardPage {
private static final String PAGE_NAME = SelectGrammarWizardPage.class.getName();

private static final String[] TEXTMATE_GRAMMAR_FILE_FILTERS = {
"*.plist",
"*.tmLanguage",
"*.json",
"*.YAML-tmLanguage",
Expand Down Expand Up @@ -97,7 +100,7 @@ protected void createBody(final Composite ancestor) {
@Override
public void widgetSelected(final @Nullable SelectionEvent e) {
final var dialog = new FileDialog(parent.getShell());
dialog.setFilterExtensions(TEXTMATE_GRAMMAR_FILE_FILTERS);
dialog.setFilterExtensions(new String[] { Stream.of(TEXTMATE_GRAMMAR_FILE_FILTERS).collect(Collectors.joining(";")) });
dialog.setFilterPath(grammarFileText.getText());
final String result = dialog.open();
if (result != null && !result.isEmpty()) {
Expand All @@ -124,7 +127,7 @@ private boolean isGrammarFile(final IFile file) {
return false;
ext = "*." + ext.toLowerCase();
for (final var pattern : TEXTMATE_GRAMMAR_FILE_FILTERS) {
if (pattern.equals(ext))
if (pattern.toLowerCase().equals(ext))
return true;
}
return false;
Expand Down

0 comments on commit e68b041

Please sign in to comment.