diff --git a/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java b/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java index 7b79f172ceea..abd5f65ee242 100644 --- a/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java +++ b/plugins/textmate/src/org/jetbrains/plugins/textmate/TextMateServiceImpl.java @@ -47,7 +47,9 @@ import static org.jetbrains.plugins.textmate.bundles.BundleReaderKt.readTextMate import static org.jetbrains.plugins.textmate.bundles.VSCBundleReaderKt.readVSCBundle; public final class TextMateServiceImpl extends TextMateService { - public static final String BUNDLED_BUNDLES_PATH = PluginPathManager.getPluginHome("textmate") + "/lib/bundles"; + public static String getBundledBundlePath() { + return PluginPathManager.getPluginHome("textmate") + "/lib/bundles"; + } private boolean ourBuiltinBundlesDisabled; @@ -88,11 +90,12 @@ public final class TextMateServiceImpl extends TextMateService { } Map newExtensionsMapping = new HashMap<>(); + String bundledBundlePath = getBundledBundlePath(); for (BundleConfigBean bundleConfigBean : settings.getBundles()) { if (bundleConfigBean.isEnabled()) { VirtualFile bundleFile = LocalFileSystem.getInstance().findFileByPath(bundleConfigBean.getPath()); boolean result = registerBundle(bundleFile, newExtensionsMapping); - if (!result && (bundleFile != null || !bundleConfigBean.getPath().startsWith(BUNDLED_BUNDLES_PATH))) { + if (!result && (bundleFile != null || !bundleConfigBean.getPath().startsWith(bundledBundlePath))) { String bundleName = bundleConfigBean.getName(); String errorMessage = bundleFile != null ? TextMateBundle.message("textmate.cant.register.bundle", bundleName) : TextMateBundle.message("textmate.cant.find.bundle", bundleName); @@ -133,7 +136,7 @@ public final class TextMateServiceImpl extends TextMateService { } private static void loadBuiltinBundles(TextMateSettings settings) { - File bundles = new File(BUNDLED_BUNDLES_PATH); + File bundles = new File(getBundledBundlePath()); File[] files = bundles.listFiles(); if (files == null) { LOG.warn("Builtin bundles not found at " + bundles); @@ -146,7 +149,10 @@ public final class TextMateServiceImpl extends TextMateService { List oldBundles = state.getBundles(); List newBundles = new ArrayList<>(oldBundles); for (File file : files) { - if (file.getName().startsWith(".")) continue; + if (file.getName().startsWith(".")) { + continue; + } + String path = FileUtil.toSystemIndependentName(file.getPath()); BundleConfigBean existing = ContainerUtil.find(oldBundles, (BundleConfigBean bundle) -> bundle.getPath().equals(path)); if (existing != null) { diff --git a/plugins/textmate/src/org/jetbrains/plugins/textmate/configuration/TextMateBundlesListPanel.java b/plugins/textmate/src/org/jetbrains/plugins/textmate/configuration/TextMateBundlesListPanel.java index 3383db419a16..a9fa87f857f9 100644 --- a/plugins/textmate/src/org/jetbrains/plugins/textmate/configuration/TextMateBundlesListPanel.java +++ b/plugins/textmate/src/org/jetbrains/plugins/textmate/configuration/TextMateBundlesListPanel.java @@ -21,15 +21,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.jetbrains.plugins.textmate.TextMateBundle; import org.jetbrains.plugins.textmate.TextMateService; +import org.jetbrains.plugins.textmate.TextMateServiceImpl; import org.jetbrains.plugins.textmate.bundles.TextMateBundleReader; import javax.swing.*; import java.util.*; -import static com.intellij.ui.ToolbarDecorator.createDecorator; -import static org.jetbrains.plugins.textmate.TextMateServiceImpl.BUNDLED_BUNDLES_PATH; - -public class TextMateBundlesListPanel implements Disposable { +public final class TextMateBundlesListPanel implements Disposable { private static final String TEXTMATE_LAST_ADDED_BUNDLE = "textmate.last.added.bundle"; private final CheckBoxList myBundlesList; @@ -58,7 +56,7 @@ public class TextMateBundlesListPanel implements Disposable { private static boolean isBuiltin(BundleConfigBean bean) { String path = bean != null ? bean.getPath() : null; - return path != null && path.startsWith(BUNDLED_BUNDLES_PATH); + return path != null && path.startsWith(TextMateServiceImpl.getBundledBundlePath()); } public @NotNull Collection getState() { @@ -77,7 +75,7 @@ public class TextMateBundlesListPanel implements Disposable { } public JPanel createMainComponent() { - return createDecorator(myBundlesList) + return ToolbarDecorator.createDecorator(myBundlesList) .setRemoveAction(new AnActionButtonRunnable() { @Override public void run(AnActionButton button) {