diff --git a/org.eclipse.tm4e.core.tests/META-INF/MANIFEST.MF b/org.eclipse.tm4e.core.tests/META-INF/MANIFEST.MF index 745a654bc..cc5a3214d 100644 --- a/org.eclipse.tm4e.core.tests/META-INF/MANIFEST.MF +++ b/org.eclipse.tm4e.core.tests/META-INF/MANIFEST.MF @@ -4,7 +4,7 @@ Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tm4e.core.tests;singleton:=true -Bundle-Version: 0.5.0.qualifier +Bundle-Version: 0.5.1.qualifier Require-Bundle: org.apache.batik.css;bundle-version="1.7.0";resolution:=optional, org.apache.batik.util;bundle-version="1.7.0";resolution:=optional, com.google.gson;bundle-version="2.9.0";resolution:=optional, diff --git a/org.eclipse.tm4e.core.tests/pom.xml b/org.eclipse.tm4e.core.tests/pom.xml index 9cbb5f1b4..0a075744c 100644 --- a/org.eclipse.tm4e.core.tests/pom.xml +++ b/org.eclipse.tm4e.core.tests/pom.xml @@ -10,7 +10,7 @@ org.eclipse.tm4e.core.tests eclipse-test-plugin - 0.5.0-SNAPSHOT + 0.5.1-SNAPSHOT diff --git a/org.eclipse.tm4e.core.tests/src/main/java/org/eclipse/tm4e/core/grammar/internal/RawTestImpl.java b/org.eclipse.tm4e.core.tests/src/main/java/org/eclipse/tm4e/core/grammar/internal/RawTestImpl.java index 1671671fe..6df8da7e8 100644 --- a/org.eclipse.tm4e.core.tests/src/main/java/org/eclipse/tm4e/core/grammar/internal/RawTestImpl.java +++ b/org.eclipse.tm4e.core.tests/src/main/java/org/eclipse/tm4e/core/grammar/internal/RawTestImpl.java @@ -81,7 +81,7 @@ public Collection getInjections(final String scopeName) { grammar = registry.grammarForScopeName(getGrammarScopeName()); } if (grammar == null) { - throw new Exception("I HAVE NO GRAMMAR FOR TEST"); + throw new IllegalStateException("I HAVE NO GRAMMAR FOR TEST"); } IStateStack prevState = null; diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/StateStack.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/StateStack.java index 865d6f09f..0a8ae1166 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/StateStack.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/grammar/StateStack.java @@ -16,7 +16,7 @@ */ package org.eclipse.tm4e.core.internal.grammar; -import static org.eclipse.tm4e.core.internal.utils.NullSafetyHelper.*; +import static org.eclipse.tm4e.core.internal.utils.NullSafetyHelper.castNonNull; import java.util.ArrayList; import java.util.Collections; diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java index 45a7cb927..4d1018b08 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/oniguruma/OnigRegExp.java @@ -16,7 +16,6 @@ * - Fabio Zadrozny - Convert uniqueId to Object (for identity compare) * - Fabio Zadrozny - Fix recursion error on creation of OnigRegExp with unicode chars */ - package org.eclipse.tm4e.core.internal.oniguruma; import java.lang.System.Logger; @@ -44,13 +43,8 @@ final class OnigRegExp { /** * {@link WarnCallback} which is used if log level is at least Level.WARNING. */ - private static WarnCallback LOGGER_WARN_CALLBACK = new WarnCallback() { - @Override - public void warn(@Nullable String message) { - LOGGER.log(Level.WARNING, message); - } - }; - + private static final WarnCallback LOGGER_WARN_CALLBACK = message -> LOGGER.log(Level.WARNING, message); + @Nullable private OnigString lastSearchString; diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/AbstractSACParserFactory.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/AbstractSACParserFactory.java index 0911ab0fa..b3c0a3d1b 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/AbstractSACParserFactory.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/AbstractSACParserFactory.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.tm4e.core.internal.theme.css.sac; -import static java.lang.System.Logger.Level.*; +import static java.lang.System.Logger.Level.ERROR; import java.lang.System.Logger; @@ -41,7 +41,7 @@ public Parser makeParser() throws ClassNotFoundException, IllegalAccessException if (preferredParserName != null) { return makeParser(preferredParserName); } - } catch (final Throwable ex) { + } catch (final Exception | LinkageError ex) { LOGGER.log(ERROR, ex.getMessage(), ex); } return super.makeParser(); diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/ISACParserFactory.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/ISACParserFactory.java index 640cf9399..b57125855 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/ISACParserFactory.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/ISACParserFactory.java @@ -26,8 +26,6 @@ public interface ISACParserFactory { /** * Set the preferred SAC parser name to use when makeParser is called. - * - * @param preferredParserName */ void setPreferredParserName(@Nullable String preferredParserName); diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/SACParserFactory.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/SACParserFactory.java index eabb24f6c..af0690ca3 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/SACParserFactory.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/internal/theme/css/sac/SACParserFactory.java @@ -52,7 +52,7 @@ public Parser makeParser(final String name) throws ClassNotFoundException, Illeg assert parser != null; return parser; } catch (InvocationTargetException | NoSuchMethodException ex) { - throw (InstantiationException) ((new InstantiationException()).initCause(ex)); + throw (InstantiationException) new InstantiationException().initCause(ex); } } throw new IllegalAccessException( @@ -61,19 +61,13 @@ public Parser makeParser(final String name) throws ClassNotFoundException, Illeg /** * Register SAC parser name. - * - * @param parser */ private static void registerSACParser(final String parser) { registerSACParser(parser, parser); } /** - * register SAC parser with name name mapped with Class name - * classNameParser. - * - * @param name - * @param classNameParser + * Register SAC parser with name name mapped with Class name classNameParser. */ private static void registerSACParser(final String name, final String classNameParser) { parsers.put(name, classNameParser); diff --git a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/IRegistryOptions.java b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/IRegistryOptions.java index 2114ce896..dc8583b5a 100644 --- a/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/IRegistryOptions.java +++ b/org.eclipse.tm4e.core/src/main/java/org/eclipse/tm4e/core/registry/IRegistryOptions.java @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.List; -import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.tm4e.core.internal.theme.IRawTheme; @@ -46,7 +45,7 @@ default IGrammarSource getGrammarSource(@SuppressWarnings("unused") final String } @Nullable - default Collection<@NonNull String> getInjections(@SuppressWarnings("unused") final String scopeName) { + default Collection getInjections(@SuppressWarnings("unused") final String scopeName) { return null; } } diff --git a/org.eclipse.tm4e.core/src/test/java/org/eclipse/tm4e/core/grammar/TokenizationUtils.java b/org.eclipse.tm4e.core/src/test/java/org/eclipse/tm4e/core/grammar/TokenizationUtils.java index a09076ef4..5d3e6659f 100644 --- a/org.eclipse.tm4e.core/src/test/java/org/eclipse/tm4e/core/grammar/TokenizationUtils.java +++ b/org.eclipse.tm4e.core/src/test/java/org/eclipse/tm4e/core/grammar/TokenizationUtils.java @@ -13,7 +13,6 @@ package org.eclipse.tm4e.core.grammar; import java.io.BufferedReader; -import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.concurrent.atomic.AtomicReference; @@ -51,10 +50,8 @@ public static Stream> tokenizeText(final CharSeque * @param text the text to tokenize * * @return The stream of {@link ITokenizeLineResult}, each item covering 1 line of the text - * - * @throws IOException */ - public static Stream> tokenizeText(final InputStream text, final IGrammar grammar) throws IOException { + public static Stream> tokenizeText(final InputStream text, final IGrammar grammar) { final var reader = new BufferedReader(new InputStreamReader(text)); final var prevStack = new AtomicReference(); diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/JavaScript.tmLanguage.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/JavaScript.tmLanguage.json index 7bc39946d..e1ab8dff3 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/JavaScript.tmLanguage.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/JavaScript.tmLanguage.json @@ -1412,4 +1412,4 @@ }, "scopeName": "source.js", "uuid": "805375ec-d614-41f5-8993-5843fe63ea82" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/TypeScript.tmLanguage.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/TypeScript.tmLanguage.json index cb9231b92..79c020600 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/TypeScript.tmLanguage.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/TypeScript.tmLanguage.json @@ -3102,4 +3102,4 @@ } }, "version": "https://github.com/Microsoft/TypeScript-TmLanguage/commit/fea3b25eb632f689a02057a1715faab29343dda2" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/benchmark/GrammarBenchmark.Java.tmLanguage.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/benchmark/GrammarBenchmark.Java.tmLanguage.json index f0fcef2d0..3a828c8f7 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/benchmark/GrammarBenchmark.Java.tmLanguage.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/benchmark/GrammarBenchmark.Java.tmLanguage.json @@ -1027,4 +1027,4 @@ "scopeName": "source.java", "uuid": "2B449DF6-6B1D-11D9-94EC-000D93589AF6", "version": "https://github.com/textmate/java.tmbundle/commit/faffa518d0b22b68b4e5e6b4c939722522b97d40" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/csharp.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/csharp.json index 3621982a8..7bc52e186 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/csharp.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/csharp.json @@ -638,4 +638,4 @@ "name": "storage.modifier.cs" } } -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/css.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/css.json index 71a9eb0d4..ba77e1eb6 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/css.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/css.json @@ -626,4 +626,4 @@ } }, "scopeName": "source.css" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/styles.ng.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/styles.ng.json index 002301024..1c4dfefd0 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/styles.ng.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/styles.ng.json @@ -8,7 +8,7 @@ } ], "repository": { - + "object-member-ng-styles": { "begin": "styles\\s*:", "end": "(?=,|\\})", @@ -66,4 +66,4 @@ } }, "scopeName": "styles.ng" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/template.ng.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/template.ng.json index 769b4e60a..66d046313 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/template.ng.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/template.ng.json @@ -8,7 +8,7 @@ } ], "repository": { - + "object-member-ng-template": { "begin": "template\\s*:", "end": "(?=,|\\})", @@ -251,7 +251,7 @@ }, "match": "(?x)\\s*([_$a-zA-Z*#(\\[][-$.:\\w()\\[\\]]*)(?=\\s|=|/?>|/\\*|//)", "name": "meta.tag.attribute-name" - }, + }, "ng-tag-attributes": { "patterns": [ @@ -333,4 +333,4 @@ } }, "scopeName": "template.ng" -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/yaml.tmLanguage.json b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/yaml.tmLanguage.json index c3637dfc9..3814b594e 100644 --- a/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/yaml.tmLanguage.json +++ b/org.eclipse.tm4e.core/src/test/resources/org/eclipse/tm4e/core/yaml.tmLanguage.json @@ -618,4 +618,4 @@ ] } } -} \ No newline at end of file +} diff --git a/org.eclipse.tm4e.languageconfiguration/META-INF/MANIFEST.MF b/org.eclipse.tm4e.languageconfiguration/META-INF/MANIFEST.MF index 560bda2a0..2d7003470 100644 --- a/org.eclipse.tm4e.languageconfiguration/META-INF/MANIFEST.MF +++ b/org.eclipse.tm4e.languageconfiguration/META-INF/MANIFEST.MF @@ -4,13 +4,13 @@ Bundle-Name: %pluginName Bundle-Vendor: %providerName Bundle-Localization: plugin Bundle-SymbolicName: org.eclipse.tm4e.languageconfiguration;singleton:=true -Bundle-Version: 0.5.4.qualifier +Bundle-Version: 0.5.5.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-17 Require-Bundle: org.eclipse.jface.text, org.eclipse.ui.genericeditor, com.google.gson;bundle-version="2.9.0", - org.eclipse.tm4e.core;bundle-version="0.5.3", - org.eclipse.tm4e.ui;bundle-version="0.6.2", + org.eclipse.tm4e.core;bundle-version="0.5.4", + org.eclipse.tm4e.ui;bundle-version="0.6.4", org.eclipse.core.runtime, org.eclipse.core.resources, org.eclipse.ui, diff --git a/org.eclipse.tm4e.languageconfiguration/pom.xml b/org.eclipse.tm4e.languageconfiguration/pom.xml index c8de35043..b25eff574 100644 --- a/org.eclipse.tm4e.languageconfiguration/pom.xml +++ b/org.eclipse.tm4e.languageconfiguration/pom.xml @@ -10,5 +10,5 @@ org.eclipse.tm4e.languageconfiguration eclipse-plugin - 0.5.4-SNAPSHOT + 0.5.5-SNAPSHOT diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java index 0771372ea..44108cda4 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/LanguageConfigurationAutoEditStrategy.java @@ -31,9 +31,6 @@ import org.eclipse.tm4e.ui.internal.model.TMModelManager; import org.eclipse.tm4e.ui.internal.utils.ContentTypeHelper; import org.eclipse.tm4e.ui.internal.utils.ContentTypeInfo; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PlatformUI; import org.eclipse.ui.editors.text.EditorsUI; import org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants; import org.eclipse.ui.texteditor.ITextEditor; @@ -180,6 +177,7 @@ private static boolean isFollowedBy(final IDocument document, int offset, final } private void onEnter(final IDocument document, final DocumentCommand command, final @Nullable ITextEditor editor) { + final var contentTypes = this.contentTypes; if (contentTypes != null) { final var registry = LanguageConfigurationRegistryManager.getInstance(); for (final IContentType contentType : contentTypes) { @@ -223,8 +221,10 @@ private void onEnter(final IDocument document, final DocumentCommand command, fi break; } case Outdent: - final String indentation = TextUtils.getIndentationFromWhitespace(enterAction.indentation, getTabSize(editor), isInsertSpaces(editor)); - final String outdentedText = outdentString(normalizeIndentation(indentation + enterAction.appendText, editor), editor); + final String indentation = TextUtils.getIndentationFromWhitespace(enterAction.indentation, getTabSize(editor), + isInsertSpaces(editor)); + final String outdentedText = outdentString(normalizeIndentation(indentation + enterAction.appendText, editor), + editor); command.text = delim + outdentedText; command.shiftsCaret = false; @@ -254,8 +254,8 @@ private void onEnter(final IDocument document, final DocumentCommand command, fi return contentTypes; } - private String outdentString(final String str, @Nullable ITextEditor editor) { - if (str.startsWith("\t")) {//$NON-NLS-1$ + private String outdentString(final String str, final @Nullable ITextEditor editor) { + if (str.startsWith("\t")) { //$NON-NLS-1$ return str.substring(1); } if (isInsertSpaces(editor)) { @@ -269,36 +269,33 @@ private String outdentString(final String str, @Nullable ITextEditor editor) { return str; } - private String normalizeIndentation(final String str, @Nullable ITextEditor editor) { - int tabSize = getTabSize(editor); - boolean insertSpaces = isInsertSpaces(editor); + private String normalizeIndentation(final String str, final @Nullable ITextEditor editor) { + final int tabSize = getTabSize(editor); + final boolean insertSpaces = isInsertSpaces(editor); return TextUtils.normalizeIndentation(str, tabSize, insertSpaces); } - private int getTabSize(@Nullable ITextEditor editor) { - String name = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; + private int getTabSize(final @Nullable ITextEditor editor) { + final String name = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH; return getPreferenceStoreFor(name, editor).getInt(name); } - - private boolean isInsertSpaces(@Nullable ITextEditor editor) { - String name = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS; + + private boolean isInsertSpaces(final @Nullable ITextEditor editor) { + final String name = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS; return getPreferenceStoreFor(name, editor).getBoolean(name); } - private IPreferenceStore getPreferenceStoreFor(String name, @Nullable ITextEditor editor) { - IPreferenceStore editorPreferenceStore = editor != null ? editor.getAdapter(IPreferenceStore.class) : null; + private IPreferenceStore getPreferenceStoreFor(final String name, final @Nullable ITextEditor editor) { + final IPreferenceStore editorPreferenceStore = editor != null ? editor.getAdapter(IPreferenceStore.class) : null; if (editorPreferenceStore != null && editorPreferenceStore.contains(name)) { return editorPreferenceStore; } return EditorsUI.getPreferenceStore(); } - private void installViewer() { if (viewer == null) { - final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - final IEditorPart editorPart = page.getActiveEditor(); - viewer = editorPart.getAdapter(ITextViewer.class); + viewer = UI.getActiveTextViewer(); } } } diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/preferences/LanguageConfigurationPreferencePage.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/preferences/LanguageConfigurationPreferencePage.java index 3c07a6253..6bc510c40 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/preferences/LanguageConfigurationPreferencePage.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/preferences/LanguageConfigurationPreferencePage.java @@ -117,8 +117,6 @@ protected Control createContents(@Nullable final Composite ancestor) { /** * Create grammar list content. - * - * @param parent */ private void createDefinitionsListContent(final Composite parent) { final var description = new Label(parent, SWT.NONE); diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/ILanguageConfigurationRegistryManager.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/ILanguageConfigurationRegistryManager.java index 16c917639..5bb0af07b 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/ILanguageConfigurationRegistryManager.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/ILanguageConfigurationRegistryManager.java @@ -34,8 +34,6 @@ public interface ILanguageConfigurationRegistryManager { * Add language configuration definition to the registry. * * NOTE: you must call save() method if you wish to save in the preferences. - * - * @param definition */ void registerLanguageConfigurationDefinition(ILanguageConfigurationDefinition definition); @@ -43,15 +41,11 @@ public interface ILanguageConfigurationRegistryManager { * Remove language configuration definition from the registry. * * NOTE: you must call save() method if you wish to save in the preferences. - * - * @param definition */ void unregisterLanguageConfigurationDefinition(ILanguageConfigurationDefinition definition); /** * Save the language configuration definitions. - * - * @throws BackingStoreException */ void save() throws BackingStoreException; diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/LanguageConfigurationRegistryManager.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/LanguageConfigurationRegistryManager.java index cf2c1486b..af04f08f2 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/LanguageConfigurationRegistryManager.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/registry/LanguageConfigurationRegistryManager.java @@ -213,6 +213,7 @@ public CompleteEnterAction getEnterAction(final IDocument document, final int of return new CompleteEnterAction(enterResult, indentation); } catch (final BadLocationException e1) { + // ignore } return null; } diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/TextUtils.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/TextUtils.java index 48a57d09c..0102b5b20 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/TextUtils.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/TextUtils.java @@ -22,13 +22,10 @@ public final class TextUtils { /** * Returns true if text of the command is an enter and false otherwise. * - * @param d - * @param c - * * @return true if text of the command is an enter and false otherwise. */ - public static boolean isEnter(final IDocument d, final DocumentCommand c) { - return c.length == 0 && c.text != null && TextUtilities.equals(d.getLegalLineDelimiters(), c.text) != -1; + public static boolean isEnter(final IDocument doc, final DocumentCommand cmd) { + return cmd.length == 0 && cmd.text != null && TextUtilities.equals(doc.getLegalLineDelimiters(), cmd.text) != -1; } public static String normalizeIndentation(final String str, final int tabSize, final boolean insertSpaces) { @@ -69,8 +66,8 @@ private static String normalizeIndentationFromWhitespace(final String str, final /** * Returns the start of the string at the offset in the text. If the string is - * not in the text at the offset, returns -1.
- * Ex:
+ * not in the text at the offset, returns -1.
+ * Ex:
* text = "apple banana", offset=8, string="banana" returns=6 */ public static int startIndexOfOffsetTouchingString(final String text, final int offset, final String string) { diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/UI.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/UI.java index 7fd19af36..cfc415744 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/UI.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/utils/UI.java @@ -29,33 +29,33 @@ public final class UI { @Nullable public static IWorkbenchPage getActivePage() { - var window = getActiveWindow(); + final var window = getActiveWindow(); return window == null ? null : window.getActivePage(); } @Nullable public static IWorkbenchPart getActivePart() { - var page = getActivePage(); + final var page = getActivePage(); return page == null ? null : page.getActivePart(); } @Nullable public static Shell getActiveShell() { - var window = getActiveWindow(); + final var window = getActiveWindow(); return window == null ? null : window.getShell(); } @Nullable public static ITextEditor getActiveTextEditor() { - var activePage = getActivePage(); + final var activePage = getActivePage(); if (activePage == null) { return null; } - var editorPart = activePage.getActiveEditor(); + final var editorPart = activePage.getActiveEditor(); if (editorPart instanceof ITextEditor textEditor) { return textEditor; } else if (editorPart instanceof MultiPageEditorPart multiPageEditorPart) { - Object page = multiPageEditorPart.getSelectedPage(); + final Object page = multiPageEditorPart.getSelectedPage(); if (page instanceof ITextEditor textEditor) { return textEditor; } @@ -65,7 +65,7 @@ public static ITextEditor getActiveTextEditor() { @Nullable public static ITextViewer getActiveTextViewer() { - ITextEditor editor = getActiveTextEditor(); + final var editor = getActiveTextEditor(); if (editor != null) { return editor.getAdapter(ITextViewer.class); } @@ -93,5 +93,4 @@ public static Display getDisplay() { private UI() { } - } diff --git a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/widgets/ColumnViewerComparator.java b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/widgets/ColumnViewerComparator.java index a9e6b4212..1be8af4df 100644 --- a/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/widgets/ColumnViewerComparator.java +++ b/org.eclipse.tm4e.languageconfiguration/src/main/java/org/eclipse/tm4e/languageconfiguration/internal/widgets/ColumnViewerComparator.java @@ -54,15 +54,14 @@ public void setColumn(final int column) { @Override public int compare(@Nullable final Viewer viewer, @Nullable final Object e1, @Nullable final Object e2) { - if (viewer instanceof final TableViewer tableViewer) { final IBaseLabelProvider baseLabel = tableViewer.getLabelProvider(); final String left = ((ITableLabelProvider) baseLabel).getColumnText(e1, fSortColumn); final String right = ((ITableLabelProvider) baseLabel).getColumnText(e2, fSortColumn); - final int sortResult = getComparator().compare(left != null ? left : "", right != null ? right : ""); //$NON-NLS-1$ //$NON-NLS-2$ + final int sortResult = getComparator() + .compare(left != null ? left : "", right != null ? right : ""); //$NON-NLS-1$ //$NON-NLS-2$ return sortResult * fSortOrder; } - return super.compare(viewer, e1, e2); } }