Skip to content

The Unified and Autonomous Development Platform

midwork

robin shinef4483e531d50
diff --git a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/InputCompletion.java b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/InputCompletion.java
index 4120471104..9a60597628 100644
--- a/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/InputCompletion.java
+++ b/commons.antlr/src/main/java/com/pmease/commons/antlr/codeassist/InputCompletion.java
@@ -1,70 +1,77 @@
-package com.pmease.commons.antlr.codeassist;
-
-import java.io.Serializable;
-
-import javax.annotation.Nullable;
-
-import com.pmease.commons.util.Range;
-
-public class InputCompletion implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private final int replaceBegin;
-
- private final int replaceEnd;
-
- private final String replaceContent;
-
- private final int caret;
-
- private final String description;
-
- private final Range matchRange;
-
- public InputCompletion(int replaceBegin, int replaceEnd, String replaceContent,
- int caret, @Nullable String description, @Nullable Range matchRange) {
- this.replaceBegin = replaceBegin;
- this.replaceEnd = replaceEnd;
- this.replaceContent = replaceContent;
- this.caret = caret;
- this.description = description;
- this.matchRange = matchRange;
- }
-
- public InputCompletion(InputCompletion completion) {
- this(completion.getReplaceBegin(), completion.getReplaceEnd(), completion.getReplaceContent(),
- completion.getCaret(), completion.getDescription(), completion.getMatchRange());
- }
-
- public int getReplaceBegin() {
- return replaceBegin;
- }
-
- public int getReplaceEnd() {
- return replaceEnd;
- }
-
- public String getReplaceContent() {
- return replaceContent;
- }
-
- public int getCaret() {
- return caret;
- }
-
- public String getDescription() {
- return description;
- }
-
- public Range getMatchRange() {
- return matchRange;
- }
-
- public InputStatus complete(InputStatus inputStatus) {
- String beforeContent = inputStatus.getContent().substring(0, replaceBegin);
- String afterContent = inputStatus.getContent().substring(replaceEnd, inputStatus.getContent().length());
- return new InputStatus(beforeContent + replaceContent + afterContent, caret);
- }
-
-}
+package com.pmease.commons.antlr.codeassist;
+
+import java.io.Serializable;
+
+import javax.annotation.Nullable;
+
+import com.pmease.commons.util.Range;
+
+public class InputCompletion implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private final int replaceBegin;
+
+ private final int replaceEnd;
+
+ private final String replaceContent;
+
+ private final int caret;
+
+ private final String label;
+
+ private final String description;
+
+ private final Range matchRange;
+
+ public InputCompletion(int replaceBegin, int replaceEnd, String replaceContent,
+ int caret, @Nullable String label, @Nullable String description, @Nullable Range matchRange) {
+ this.replaceBegin = replaceBegin;
+ this.replaceEnd = replaceEnd;
+ this.replaceContent = replaceContent;
+ this.caret = caret;
+ this.label = label;
+ this.description = description;
+ this.matchRange = matchRange;
+ }
+
+ public InputCompletion(InputCompletion completion) {
+ this(completion.getReplaceBegin(), completion.getReplaceEnd(), completion.getReplaceContent(),
+ completion.getCaret(), completion.getLabel(), completion.getDescription(), completion.getMatchRange());
+ }
+
+ public int getReplaceBegin() {
+ return replaceBegin;
+ }
+
+ public int getReplaceEnd() {
+ return replaceEnd;
+ }
+
+ public String getReplaceContent() {
+ return replaceContent;
+ }
+
+ public int getCaret() {
+ return caret;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Range getMatchRange() {
+ return matchRange;
+ }
+
+ public InputStatus complete(InputStatus inputStatus) {
+ String beforeContent = inputStatus.getContent().substring(0, replaceBegin);
+ String afterContent = inputStatus.getContent().substring(replaceEnd, inputStatus.getContent().length());
+ return new InputStatus(beforeContent + replaceContent + afterContent, caret);
+ }
+
+}
diff --git a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/inputassist/AssistPanel.java b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/inputassist/AssistPanel.java
index 2aa21b41ab..63d23ecf14 100644
--- a/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/inputassist/AssistPanel.java
+++ b/commons.wicket/src/main/java/com/pmease/commons/wicket/behavior/inputassist/AssistPanel.java
@@ -95,6 +95,9 @@ class AssistPanel extends Panel {
WebMarkupContainer item = new WebMarkupContainer(itemId);
WebMarkupContainer link = new WebMarkupContainer("link");
Range matchRange = suggestion.getMatchRange();
+ String label = suggestion.getLabel();
+ if (label == null)
+ label = suggestion.getReplaceContent();
if (matchRange != null) {
String content = suggestion.getReplaceContent();
String prefix = StringEscapeUtils.escapeHtml4(content.substring(0, matchRange.getFrom()));