NavigationGutterIconBuilder#setTooltipText Can you copy the content?

已回答

Currently losing focus will automatically disappear and cannot be selected.

Because I made the document on it, it would be great if I could copy the content, maybe my idea is naive.

0
Avatar
Permanently deleted user

Or I can listen to the NavigationGutterIcon click event and display it using a dialog box,
But when I click the icon, the default is to jump to PsiElement. Can this be changed?

0

NavigationGutterIcon is not designed for that. As stated in my previous answer:

Such documentation should be handled with the DocumentationProvider implementation.

 

0
Avatar
Permanently deleted user

@Jakub Chrzanowski 

I tried using AbstractDocumentationProvider to place the document, but new problems appeared
1. The Ctrl-hover standard HTML tag cannot overwrite or coexist with the built-in QuickNavigateInfo,
2. There is a scroll bar if there is too much QuickNavigateInfo content.
3. How to generateDoc display?

my code:

import com.intellij.lang.documentation.AbstractDocumentationProvider;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.impl.source.html.HtmlTagImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import utils.VelocityFactory;
import window.Application;

import java.util.Arrays;

public class ComponentDocumentationProvider extends AbstractDocumentationProvider {
@Override
@Nullable
public String getQuickNavigateInfo(PsiElement element, PsiElement originalElement) {
if (element instanceof HtmlTagImpl) {
return "\"" + renderPropertyValue((HtmlTagImpl) element) + "\"" + getLocationString(element);
}
return null;
}

private static String getLocationString(PsiElement element) {
PsiFile file = element.getContainingFile();
return file != null ? " [" + file.getName() + "]" : "";
}

@NotNull
private static String renderPropertyValue(HtmlTagImpl htmlTag) {
String raw = htmlTag.getName();
return StringUtil.escapeXmlEntities(raw);
}

@Override
public String generateDoc(final PsiElement element, @Nullable final PsiElement originalElement) {
if (element instanceof HtmlTagImpl && Application.componentXmlParse.components != null && Application.componentXmlParse.components.size() > 0) {
HtmlTagImpl htmlTagImplElement = (HtmlTagImpl) element;
for (ComponentXmlParse.Component i : Application.componentXmlParse.components) {
String[] tags = i.getName().split(",");
if (Arrays.asList(tags).contains(htmlTagImplElement.getName())) {
return VelocityFactory.build("ignore/doc/infoPanel.html.vm", i);
}
}
}
return null;
}
}
0

1.

<lang.documentationProvider order="first" ... />

2. You can resize this window using a popup corner handler.

3. In Preferences > Keymap search for Quick Documentation

0
Avatar
Permanently deleted user

Jakub Chrzanowski thank you very much

0

请先登录再写评论。