コード例 #1
0
  protected void updateTitle(@Nullable V variable, String value) {
    if (variable == null) return;

    final String variableText = variable.getText();
    final PsiElement identifier = variable.getNameIdentifier();
    if (identifier != null) {
      final int startOffsetInParent = identifier.getStartOffsetInParent();
      setPreviewText(
          variableText.substring(0, startOffsetInParent)
              + value
              + variableText.substring(startOffsetInParent + identifier.getTextLength()));
    } else {
      setPreviewText(variableText.replaceFirst(variable.getName(), value));
    }
    revalidate();
  }
コード例 #2
0
 protected void updateTitle(@Nullable V variable) {
   if (variable == null) return;
   setPreviewText(variable.getText());
   revalidate();
 }