mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[mod-command] Intention preview for string change
GitOrigin-RevId: c1026617c907a09043acb5aab30aab01a36b67cd
This commit is contained in:
committed by
intellij-monorepo-bot
parent
34479d8af2
commit
4143fe4c0a
@@ -223,6 +223,7 @@ set.inspection.option.fix=Set inspection option
|
||||
set.option.description.uncheck=Uncheck option:
|
||||
set.option.description.check=Check option:
|
||||
set.option.description.input=Update numerical option:
|
||||
set.option.description.string=Update string option:
|
||||
progress.title.submit.request=Submit
|
||||
progress.title.refresh=Refresh
|
||||
preview.cannot.perform.action=Cannot perform action:
|
||||
|
||||
+20
-7
@@ -207,16 +207,18 @@ public class ModCommandServiceImpl implements ModCommandService {
|
||||
OptNumber optNumber = ObjectUtils.tryCast(control, OptNumber.class);
|
||||
if (optNumber == null) return HtmlChunk.empty();
|
||||
LocMessage.PrefixSuffix prefixSuffix = optNumber.splitLabel().splitLabel();
|
||||
HtmlChunk.Element input = tag("input").attr("type", "text").attr("value", value)
|
||||
.attr("size", value.toString().length() + 1).attr("readonly", "true");
|
||||
HtmlChunk info = tag("table").child(tag("tr").children(
|
||||
tag("td").child(text(prefixSuffix.prefix())),
|
||||
tag("td").child(input),
|
||||
tag("td").child(text(prefixSuffix.suffix()))
|
||||
));
|
||||
HtmlChunk info = getValueChunk(value, prefixSuffix);
|
||||
return new HtmlBuilder().append(AnalysisBundle.message("set.option.description.input"))
|
||||
.br().br().append(info).br().toFragment();
|
||||
}
|
||||
if (newValue instanceof String value) {
|
||||
OptString optString = ObjectUtils.tryCast(control, OptString.class);
|
||||
if (optString == null) return HtmlChunk.empty();
|
||||
LocMessage.PrefixSuffix prefixSuffix = optString.splitLabel().splitLabel();
|
||||
HtmlChunk info = getValueChunk(value, prefixSuffix);
|
||||
return new HtmlBuilder().append(AnalysisBundle.message("set.option.description.string"))
|
||||
.br().br().append(info).br().toFragment();
|
||||
}
|
||||
if (newValue instanceof List<?> list) {
|
||||
OptStringList optList = ObjectUtils.tryCast(control, OptStringList.class);
|
||||
if (optList == null) return HtmlChunk.empty();
|
||||
@@ -226,4 +228,15 @@ public class ModCommandServiceImpl implements ModCommandService {
|
||||
}
|
||||
throw new IllegalStateException("Value of type " + newValue.getClass() + " is not supported");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static HtmlChunk getValueChunk(Object value, LocMessage.PrefixSuffix prefixSuffix) {
|
||||
HtmlChunk.Element input = tag("input").attr("type", "text").attr("value", String.valueOf(value))
|
||||
.attr("size", value.toString().length() + 1).attr("readonly", "true");
|
||||
return tag("table").child(tag("tr").children(
|
||||
tag("td").child(text(prefixSuffix.prefix())),
|
||||
tag("td").child(input),
|
||||
tag("td").child(text(prefixSuffix.suffix()))
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user