[textmate] API cleanup: remove unused deprecated API (IJPL-156972)

GitOrigin-RevId: 7157aa702cfcd633f36509cbee3ac551b4ef87cc
This commit is contained in:
Nikolay Chashnikov
2024-10-04 17:08:57 +02:00
committed by intellij-monorepo-bot
parent 4724d9248a
commit a98bbb7633
3 changed files with 0 additions and 97 deletions

View File

@@ -4,13 +4,10 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.textmate.Constants;
import org.jetbrains.plugins.textmate.language.PreferencesReadUtil;
import org.jetbrains.plugins.textmate.language.TextMateScopeComparator;
import org.jetbrains.plugins.textmate.language.syntax.lexer.TextMateScope;
import org.jetbrains.plugins.textmate.plist.Plist;
import java.util.*;
import java.util.stream.Collectors;
public final class PreferencesRegistryImpl implements PreferencesRegistry {
@NotNull private final Set<Preferences> myPreferences = new HashSet<>();
@@ -30,27 +27,6 @@ public final class PreferencesRegistryImpl implements PreferencesRegistry {
myPreferences.add(preferences);
}
/**
* Append table with new preferences
*
* @deprecated use {@link this#addPreferences(Preferences)} instead
*/
@Deprecated(forRemoval = true)
public synchronized void fillFromPList(@NotNull CharSequence scopeName, @NotNull Plist plist) {
final Set<TextMateBracePair> highlightingPairs = PreferencesReadUtil.readPairs(plist.getPlistValue(Constants.HIGHLIGHTING_PAIRS_KEY));
Set<TextMateBracePair> rawSmartTypingPairs = PreferencesReadUtil.readPairs(plist.getPlistValue(Constants.SMART_TYPING_PAIRS_KEY));
final Set<TextMateAutoClosingPair> smartTypingPairs = rawSmartTypingPairs != null ? rawSmartTypingPairs.stream().map(p -> {
return new TextMateAutoClosingPair(p.getLeft(), p.getRight(), null);
}).collect(Collectors.toSet()) : null;
final IndentationRules indentationRules = PreferencesReadUtil.loadIndentationRules(plist);
final Set<OnEnterRule> onEnterRules = Collections.emptySet(); // seems fine, since fillFromPList is deprecated anyway
fillHighlightingBraces(highlightingPairs);
fillSmartTypingBraces(smartTypingPairs);
if (highlightingPairs != null || smartTypingPairs != null || !indentationRules.isEmpty()) {
myPreferences.add(new Preferences(scopeName, highlightingPairs, smartTypingPairs, Collections.emptySet(), null, indentationRules, onEnterRules));
}
}
private synchronized void fillHighlightingBraces(Collection<TextMateBracePair> highlightingPairs) {
if (highlightingPairs != null) {
for (TextMateBracePair pair : highlightingPairs) {

View File

@@ -2,11 +2,8 @@ package org.jetbrains.plugins.textmate.language.preferences;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.textmate.Constants;
import org.jetbrains.plugins.textmate.language.TextMateScopeComparator;
import org.jetbrains.plugins.textmate.language.syntax.lexer.TextMateScope;
import org.jetbrains.plugins.textmate.plist.PListValue;
import org.jetbrains.plugins.textmate.plist.Plist;
import java.util.Collection;
import java.util.Collections;
@@ -22,24 +19,6 @@ public final class ShellVariablesRegistryImpl implements ShellVariablesRegistry
@NotNull private final Map<String, Collection<TextMateShellVariable>> myVariables = new ConcurrentHashMap<>();
/**
* Append table with new variables
*
* @deprecated use {@link this#addVariable(TextMateShellVariable)} instead
*/
@Deprecated(forRemoval = true)
public void fillVariablesFromPlist(@NotNull CharSequence scopeName, @NotNull Plist plist) {
final PListValue shellVariables = plist.getPlistValue(Constants.SHELL_VARIABLES_KEY);
if (shellVariables != null) {
for (PListValue variable : shellVariables.getArray()) {
Plist variablePlist = variable.getPlist();
String name = variablePlist.getPlistValue(Constants.NAME_KEY, "").getString();
String value = variablePlist.getPlistValue(Constants.VALUE_KEY, "").getString();
addVariable(new TextMateShellVariable(scopeName, name, value));
}
}
}
public void addVariable(@NotNull TextMateShellVariable variable) {
if (!variable.name.isEmpty()) {
myVariables.computeIfAbsent(variable.name, ADD_VARIABLE_FACTORY).add(variable);

View File

@@ -1,52 +0,0 @@
package org.jetbrains.plugins.textmate.bundles;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.textmate.Constants;
import org.jetbrains.plugins.textmate.plist.Plist;
import org.jetbrains.plugins.textmate.plist.PlistReader;
import java.io.File;
import java.io.IOException;
/**
* @deprecated use `TextMateService#readBundle` or `TextMateBundleReader`
*/
@Deprecated(forRemoval = true)
public class BundleFactory {
private final PlistReader myPlistReader;
public BundleFactory(PlistReader plistReader) {
myPlistReader = plistReader;
}
/**
* Create bundle object from directory.
* Return {@code null} if bundle type can't be defined or
* if IO exception occurred while reading directory.
*
* @return Bundle object or null
* @deprecated use `TextMateService#readBundle#readGrammars` or `TextMateBundleReader`
*/
@Deprecated(forRemoval = true)
@Nullable
public Bundle fromDirectory(@NotNull File directory) throws IOException {
final BundleType type = BundleType.detectBundleType(directory.toPath());
return switch (type) {
case TEXTMATE -> fromTextMateBundle(directory);
case SUBLIME -> new Bundle(directory.getName(), directory.getPath(), type);
case VSCODE -> new VSCBundle(directory.getName(), directory.getPath());
default -> null;
};
}
private Bundle fromTextMateBundle(File directory) throws IOException {
File infoPlist = new File(directory, Constants.BUNDLE_INFO_PLIST_NAME);
if (infoPlist.exists() && infoPlist.isFile()) {
final Plist plist = myPlistReader.read(infoPlist);
final String bundleName = plist.getPlistValue(Constants.NAME_KEY, directory.getName()).getString();
return new Bundle(bundleName, directory.getPath(), BundleType.TEXTMATE);
}
return null;
}
}