当前位置: 首页>>代码示例>>Java>>正文


Java DocumentationManager类代码示例

本文整理汇总了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);
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:18,代码来源:LuaParameterInfoHandler.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ShowQuickDocInfoAction.java

示例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);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JavaDocExternalFilter.java

示例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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:JavaDocExternalFilter.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:ShowQuickDocInfoAction.java

示例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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:CtrlMouseHandler.java

示例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;
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:17,代码来源:ShowQuickDocInfoAction.java

示例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);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:ShowQuickDocInfoAction.java

示例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();
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:29,代码来源:SpringConfigurationMetadataProperty.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:JavaExternalDocumentationTest.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ShowImplementationsAction.java

示例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;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ShowQuickDocInfoAction.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CopyQuickDocAction.java

示例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


注:本文中的com.intellij.codeInsight.documentation.DocumentationManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。