本文整理汇总了Java中com.intellij.codeInsight.documentation.DocumentationManager类的典型用法代码示例。如果您正苦于以下问题:Java DocumentationManager类的具体用法?Java DocumentationManager怎么用?Java DocumentationManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentationManager类属于com.intellij.codeInsight.documentation包,在下文中一共展示了DocumentationManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: showParameterInfo
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
public void showParameterInfo(@NotNull LuaPsiElement place, CreateParameterInfoContext context) {
if (!(place instanceof LuaFunctionCallExpression))
return;
final LuaReferenceElement functionNameElement = ((LuaFunctionCallExpression) place).getFunctionNameElement();
if (functionNameElement == null) return;
String text = DocumentationManager.getProviderFromElement(place).
getQuickNavigateInfo(functionNameElement.resolve(), place);
if (text == null) return;
Object[] o = {text};
context.setItemsToShow(o);
context.showHint(place, place.getTextRange().getStartOffset(), this);
}
示例2: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
final Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
final PsiElement element = CommonDataKeys.PSI_ELEMENT.getData(dataContext);
if (project != null && editor != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_FEATURE);
final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).getActiveLookup();
if (lookup != null) {
//dumpLookupElementWeights(lookup);
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_LOOKUP_FEATURE);
}
actionPerformedImpl(project, editor);
}
else if (project != null && element != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_CTRLN_FEATURE);
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
DocumentationManager.getInstance(project).showJavaDocInfo(element, null);
}
}, getCommandName(), null);
}
}
示例3: testExtensionPointDocumentation
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
public void testExtensionPointDocumentation() {
myFixture.configureByFiles("extensionPointDocumentation.xml", "bar/MyExtensionPoint.java");
final PsiElement docElement =
DocumentationManager.getInstance(getProject()).findTargetElement(myFixture.getEditor(),
myFixture.getFile());
DocumentationProvider provider = DocumentationManager.getProviderFromElement(docElement);
String epDefinition = "[" + myModule.getName() + "] foo<br/>" +
"<b>bar</b> (extensionPointDocumentation.xml)<br/>" +
"<a href=\"psi_element://bar.MyExtensionPoint\"><code>MyExtensionPoint</code></a>";
assertEquals(epDefinition,
provider.getQuickNavigateInfo(docElement, null));
assertEquals("<em>EP Definition</em><br/>" +
epDefinition +
"<br/><br/>" +
"<em>EP Implementation</em>" +
"<html><head> <style type=\"text/css\"> #error { background-color: #eeeeee; margin-bottom: 10px; } p { margin: 5px 0; } </style></head>" +
"<body><small><b>bar</b></small><PRE>public interface <b>MyExtensionPoint</b></PRE>\n" +
" MyExtensionPoint JavaDoc.</body></html>",
provider.generateDoc(docElement, null));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:ExtensionPointDocumentationProviderTest.java
示例4: convertReference
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
protected String convertReference(String root, String href) {
if (BrowserUtil.isAbsoluteURL(href)) {
return href;
}
if (StringUtil.startsWithChar(href, '#')) {
return DOC_ELEMENT_PROTOCOL + root + href;
}
String nakedRoot = ourHTMLFilesuffix.matcher(root).replaceAll("/");
String stripped = ourHTMLsuffix.matcher(href).replaceAll("");
int len = stripped.length();
do stripped = ourParentFolderprefix.matcher(stripped).replaceAll(""); while (len > (len = stripped.length()));
final String elementRef = stripped.replaceAll("/", ".");
final String classRef = ourAnchorsuffix.matcher(elementRef).replaceAll("");
return
(JavaPsiFacade.getInstance(myProject).findClass(classRef, GlobalSearchScope.allScope(myProject)) != null)
? DocumentationManager.PSI_ELEMENT_PROTOCOL + elementRef
: DOC_ELEMENT_PROTOCOL + doAnnihilate(nakedRoot + href);
}
示例5: getExternalDocInfoForElement
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
@Nullable
public String getExternalDocInfoForElement(final String docURL, final PsiElement element) throws Exception {
String externalDoc = super.getExternalDocInfoForElement(docURL, element);
if (externalDoc != null) {
if (element instanceof PsiMethod) {
final String className = ApplicationManager.getApplication().runReadAction(
new NullableComputable<String>() {
@Override
@Nullable
public String compute() {
PsiClass aClass = ((PsiMethod)element).getContainingClass();
return aClass == null ? null : aClass.getQualifiedName();
}
}
);
Matcher matcher = ourMethodHeading.matcher(externalDoc);
final StringBuilder buffer = new StringBuilder();
DocumentationManager.createHyperlink(buffer, className, className, false);
//noinspection HardCodedStringLiteral
return matcher.replaceFirst("<H3>" + buffer.toString() + "</H3>");
}
}
return externalDoc;
}
示例6: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
DataContext dataContext = e.getDataContext();
final Project project = PlatformDataKeys.PROJECT.getData(dataContext);
final Editor editor = PlatformDataKeys.EDITOR.getData(dataContext);
final PsiElement element = LangDataKeys.PSI_ELEMENT.getData(dataContext);
if (project != null && editor != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_FEATURE);
final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).getActiveLookup();
if (lookup != null) {
//dumpLookupElementWeights(lookup);
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_LOOKUP_FEATURE);
}
actionPerformedImpl(project, editor);
}
else if (project != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.quickjavadoc.ctrln");
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
DocumentationManager.getInstance(project).showJavaDocInfo(element, null);
}
}, getCommandName(), null);
}
}
示例7: hyperlinkUpdate
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
public void hyperlinkUpdate(@NotNull HyperlinkEvent e) {
if (e.getEventType() != HyperlinkEvent.EventType.ACTIVATED) {
return;
}
String description = e.getDescription();
if (StringUtil.isEmpty(description) || !description.startsWith(DocumentationManager.PSI_ELEMENT_PROTOCOL)) {
return;
}
String elementName = e.getDescription().substring(DocumentationManager.PSI_ELEMENT_PROTOCOL.length());
final PsiElement targetElement = myProvider.getDocumentationElementForLink(PsiManager.getInstance(myProject), elementName, myContext);
if (targetElement != null) {
LightweightHint hint = myHint;
if (hint != null) {
hint.hide(true);
}
myDocumentationManager.showJavaDocInfo(targetElement, myContext, true, null);
}
}
示例8: getHandler
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Nonnull
@Override
protected CodeInsightActionHandler getHandler() {
return new CodeInsightActionHandler() {
@RequiredDispatchThread
@Override
public void invoke(@Nonnull Project project, @Nonnull Editor editor, @Nonnull PsiFile file) {
DocumentationManager.getInstance(project).showJavaDocInfo(editor, file, LookupManager.getActiveLookup(editor) == null);
}
@Override
public boolean startInWriteAction() {
return false;
}
};
}
示例9: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@RequiredDispatchThread
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
final Editor editor = e.getData(CommonDataKeys.EDITOR);
final PsiElement element = e.getData(CommonDataKeys.PSI_ELEMENT);
if (project != null && editor != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_FEATURE);
final LookupImpl lookup = (LookupImpl)LookupManager.getInstance(project).getActiveLookup();
if (lookup != null) {
//dumpLookupElementWeights(lookup);
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_LOOKUP_FEATURE);
}
actionPerformedImpl(project, editor);
}
else if (project != null && element != null) {
FeatureUsageTracker.getInstance().triggerFeatureUsed(CODEASSISTS_QUICKJAVADOC_CTRLN_FEATURE);
CommandProcessor.getInstance().executeCommand(project, new Runnable() {
@Override
public void run() {
DocumentationManager.getInstance(project).showJavaDocInfo(element, null);
}
}, getCommandName(), null);
}
}
示例10: getDocumentationForValue
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
public String getDocumentationForValue(MetadataNode propertyNode, String value) {
StringBuilder builder =
new StringBuilder().append("<b>").append(propertyNode.getFullPath()).append("</b>");
if (type != null) {
StringBuilder buffer = new StringBuilder();
DocumentationManager
.createHyperlink(buffer, typeForDocumentationNavigation(type), type, false);
String typeInJavadocFormat = buffer.toString();
builder.append(" (").append(typeInJavadocFormat).append(")");
}
String trimmedValue = unescapeValue(value);
builder.append("<p>").append(trimmedValue).append("</p>");
Set<Suggestion> choices = getValueSuggestions(propertyNode, classLoader);
if (choices != null) {
choices.stream().filter(choice -> choice.getSuggestion().equals(trimmedValue)).findFirst()
.ifPresent(suggestion -> {
if (suggestion.getDescription() != null) {
builder.append("<p>").append(suggestion.getDescription()).append("</p>");
}
});
}
return builder.toString();
}
示例11: getDocumentationText
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
public static String getDocumentationText(@NotNull PsiFile psiFile, int caretPosition) throws InterruptedException {
Project project = psiFile.getProject();
Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile);
assertNotNull(document);
Editor editor = EditorFactory.getInstance().createEditor(document, project);
try {
if (caretPosition >= 0) {
editor.getCaretModel().moveToOffset(caretPosition);
}
DocumentationManager documentationManager = DocumentationManager.getInstance(project);
MockDocumentationComponent documentationComponent = new MockDocumentationComponent(documentationManager);
try {
documentationManager.setDocumentationComponent(documentationComponent);
documentationManager.showJavaDocInfo(editor, psiFile, false);
waitTillDone(documentationManager.getLastAction());
return documentationComponent.getText();
}
finally {
JBPopup hint = documentationComponent.getHint();
if (hint != null) Disposer.dispose(hint);
Disposer.dispose(documentationComponent);
}
}
finally {
EditorFactory.getInstance().releaseEditor(editor);
}
}
示例12: getElement
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
protected static PsiElement getElement(@NotNull Project project, PsiFile file, Editor editor, PsiElement element) {
if (element == null && editor != null) {
element = TargetElementUtil.findTargetElement(editor, TargetElementUtil.getInstance().getAllAccepted());
final PsiElement adjustedElement =
TargetElementUtil.getInstance().adjustElement(editor, TargetElementUtil.getInstance().getAllAccepted(), element, null);
if (adjustedElement != null) {
element = adjustedElement;
}
else if (file != null) {
element = DocumentationManager.getInstance(project).getElementFromLookup(editor, file);
}
}
return element;
}
示例13: getHandler
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@NotNull
@Override
protected CodeInsightActionHandler getHandler() {
return new CodeInsightActionHandler() {
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
DocumentationManager.getInstance(project).showJavaDocInfo(editor, file, LookupManager.getActiveLookup(editor) == null);
}
@Override
public boolean startInWriteAction() {
return false;
}
};
}
示例14: actionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
String selected = e.getData(DocumentationManager.SELECTED_QUICK_DOC_TEXT);
if (selected == null || selected.isEmpty()) {
return;
}
CopyPasteManager.getInstance().setContents(new StringSelection(selected));
}
示例15: doActionPerformed
import com.intellij.codeInsight.documentation.DocumentationManager; //导入依赖的package包/类
@Override
protected void doActionPerformed(@NotNull DataContext context, @NotNull PsiElement docAnchor, @NotNull PsiElement originalElement) {
Project project = CommonDataKeys.PROJECT.getData(context);
if (project == null) {
return;
}
DocumentationManager docManager = DocumentationManager.getInstance(project);
docManager.setAllowContentUpdateFromContext(false);
docManager.showJavaDocInfoAtToolWindow(docAnchor, originalElement);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ShowQuickDocAtPinnedWindowFromTooltipAction.java