From 4b5562692dbeae3312fd87f21f00f35035d251ac Mon Sep 17 00:00:00 2001 From: bobbylight Date: Sat, 14 Jan 2023 13:13:50 -0500 Subject: [PATCH] Bumping Gradle, RSTA, and all other dependencies to latest --- AutoComplete/build.gradle | 2 +- .../autocomplete/CompletionCellRenderer.java | 89 ++++++++------- .../ParameterizedCompletionContext.java | 2 +- .../ui/autocomplete/TemplateCompletion.java | 1 + config/checkstyle/checkstyle.xml | 107 +++++++++--------- 5 files changed, 108 insertions(+), 93 deletions(-) diff --git a/AutoComplete/build.gradle b/AutoComplete/build.gradle index 427036e..e61ee96 100644 --- a/AutoComplete/build.gradle +++ b/AutoComplete/build.gradle @@ -11,7 +11,7 @@ assert current().isJava8Compatible() archivesBaseName = 'autocomplete' dependencies { - api 'com.fifesoft:rsyntaxtextarea:3.3.1' + api 'com.fifesoft:rsyntaxtextarea:3.3.2' } ext.isReleaseVersion = !project.version.endsWith('SNAPSHOT') diff --git a/AutoComplete/src/main/java/org/fife/ui/autocomplete/CompletionCellRenderer.java b/AutoComplete/src/main/java/org/fife/ui/autocomplete/CompletionCellRenderer.java index 6bc3d2f..a7b5fdb 100644 --- a/AutoComplete/src/main/java/org/fife/ui/autocomplete/CompletionCellRenderer.java +++ b/AutoComplete/src/main/java/org/fife/ui/autocomplete/CompletionCellRenderer.java @@ -135,6 +135,53 @@ public CompletionCellRenderer(DefaultListCellRenderer delegate) { } + /** + * Utility function to append a short description to a string buffer. + * Useful to ensure consistency when rendering completions that display + * a trailing description of the completion. + * + * @param sb The string buffer to append to. + * @param definition The text to append. + * @see #prepareForOtherCompletion(JList, Completion, int, boolean, boolean) + * @see #prepareForTemplateCompletion(JList, TemplateCompletion, int, boolean, boolean) + */ + protected void appendShortDescription(StringBuilder sb, String definition) { + sb.append(" - "); + if (!selected) { + sb.append(""); + } + sb.append(definition); + if (!selected) { + sb.append(""); + } + } + + + /** + * Utility function that appends a variable or function completion's type to a + * string buffer if {@link #getShowTypes()} is {@code true}. + * + * @param sb The string buffer to possibly append to. + * @param varOrFunctionCompletion The completion to examine. + * @see #prepareForFunctionCompletion(JList, FunctionCompletion, int, boolean, boolean) + * @see #prepareForVariableCompletion(JList, VariableCompletion, int, boolean, boolean) + */ + protected void appendTypeIfNecessary(StringBuilder sb, VariableCompletion varOrFunctionCompletion) { + + if (getShowTypes() && varOrFunctionCompletion.getType()!=null) { + + sb.append(" : "); + if (!selected) { + sb.append(""); + } + sb.append(varOrFunctionCompletion.getType()); + if (!selected) { + sb.append(""); + } + } + } + + /** * Creates the icon to use if no icon is found for a specific completion. * The default implementation returns a 16x16 empty icon. @@ -439,17 +486,7 @@ protected void prepareForFunctionCompletion(JList list, sb.append(paramListEnd); } - if (getShowTypes() && fc.getType()!=null) { - sb.append(" : "); - if (!selected) { - sb.append(""); - } - sb.append(fc.getType()); - if (!selected) { - sb.append(""); - } - } - + appendTypeIfNecessary(sb, fc); setText(sb.toString()); } @@ -489,14 +526,7 @@ protected void prepareForOtherCompletion(JList list, if (c instanceof BasicCompletion) { String definition = ((BasicCompletion)c).getShortDescription(); if (definition!=null) { - sb.append(" - "); - if (!selected) { - sb.append(""); - } - sb.append(definition); - if (!selected) { - sb.append(""); - } + appendShortDescription(sb, definition); } } @@ -522,14 +552,7 @@ protected void prepareForTemplateCompletion(JList list, String definition = tc.getShortDescription(); if (definition!=null) { - sb.append(" - "); - if (!selected) { - sb.append(""); - } - sb.append(definition); - if (!selected) { - sb.append(""); - } + appendShortDescription(sb, definition); } setText(sb.toString()); @@ -551,17 +574,7 @@ protected void prepareForVariableCompletion(JList list, StringBuilder sb = new StringBuilder(PREFIX); sb.append(vc.getName()); - - if (getShowTypes() && vc.getType()!=null) { - sb.append(" : "); - if (!selected) { - sb.append(""); - } - sb.append(vc.getType()); - if (!selected) { - sb.append(""); - } - } + appendTypeIfNecessary(sb, vc); setText(sb.toString()); diff --git a/AutoComplete/src/main/java/org/fife/ui/autocomplete/ParameterizedCompletionContext.java b/AutoComplete/src/main/java/org/fife/ui/autocomplete/ParameterizedCompletionContext.java index 801b726..f802da2 100644 --- a/AutoComplete/src/main/java/org/fife/ui/autocomplete/ParameterizedCompletionContext.java +++ b/AutoComplete/src/main/java/org/fife/ui/autocomplete/ParameterizedCompletionContext.java @@ -387,7 +387,7 @@ private static int getFirstHighlight(List highlights) { * Returns the highlight from a list that comes "last" in that list. Even * though most parameter highlights are ordered, sometimes they aren't * (e.g. the "cursor" parameter in a template completion is always last, - * even though it can be anywhere in the template. + * even though it can be anywhere in the template). * * @param highlights The list of highlights. Assumed to be non-empty. * @return The highlight that comes last in the document. diff --git a/AutoComplete/src/main/java/org/fife/ui/autocomplete/TemplateCompletion.java b/AutoComplete/src/main/java/org/fife/ui/autocomplete/TemplateCompletion.java index 97b377b..665c10f 100644 --- a/AutoComplete/src/main/java/org/fife/ui/autocomplete/TemplateCompletion.java +++ b/AutoComplete/src/main/java/org/fife/ui/autocomplete/TemplateCompletion.java @@ -150,6 +150,7 @@ public String getDefinitionString() { return definitionString; } + public String getShortDescription() { return shortDescription; } diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index 77366dc..1848ea3 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -1,7 +1,7 @@ - + + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> - + - - - + + + - - + + @@ -59,12 +60,12 @@ - + - - + + @@ -77,10 +78,10 @@ - - - - + + + + @@ -92,19 +93,19 @@ - - - + + + - + + + --> @@ -145,7 +146,7 @@ - + @@ -154,14 +155,14 @@ - + - - + + - - - + + + @@ -172,8 +173,8 @@ - - + + @@ -191,12 +192,12 @@ - - - - - - + + + + + + @@ -205,13 +206,13 @@ - - + + + + --> + @@ -221,9 +222,9 @@ - - + + @@ -235,9 +236,9 @@ - - - + + + @@ -251,7 +252,7 @@ - + @@ -260,8 +261,8 @@ - + - +