Package com.intellij.codeInsight.lookup

Examples of com.intellij.codeInsight.lookup.LookupEx


  @Override
  public PsiElement getCustomDocumentationElement(@NotNull Editor editor, @NotNull PsiFile file, @Nullable PsiElement contextElement) {

    // Check whether there is a completion item which is currently active and give a Symbol element
    // containing the lookup name back.
    final LookupEx activeLookup = LookupManager.getActiveLookup(editor);
    if ((activeLookup != null) && activeLookup.isFocused()) {
      final PsiElement elementAt = file.findElementAt(editor.getCaretModel().getOffset() - 1);
      if (elementAt != null) {
        Symbol lookup = new SymbolImpl(elementAt.getNode());
        final LookupElement currentItem = activeLookup.getCurrentItem();
        final String lookupString = currentItem != null ? currentItem.getLookupString() : "";
        lookup.setName(lookupString);
        return lookup;
      }
    }
View Full Code Here


   */
  @Nullable
  @Override
  public PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element) {
    if (element != null) {
      final LookupEx activeLookup = LookupManager.getActiveLookup(FileEditorManager.getInstance(element.getProject()).getSelectedTextEditor());
      if (activeLookup != null) {
        if (activeLookup.isFocused()) {
          MathematicaPsiElementFactory elementFactory = new MathematicaPsiElementFactory(psiManager.getProject());
          try {
            return elementFactory.createSymbol(object.toString());
          } catch (Exception e) {
            return null;
View Full Code Here

  }

  protected void doTest(CompletionType type, int invocationCount, @Nullable final String toComplete) {
    configure();
    myFixture.complete(type, invocationCount);
    final LookupEx lookup = LookupManager.getActiveLookup(myFixture.getEditor());
    assertFalse(toComplete != null && lookup == null);
    if (lookup != null && toComplete != null) {
      final LookupElement[] elements = myFixture.getLookupElements();
      assertNotNull("no lookups", elements);
      final LookupElement element = ContainerUtil.find(elements, new Condition<LookupElement>() {
        @Override
        public boolean value(LookupElement element) {
          return StringUtil.equals(element.getLookupString(), toComplete);
        }
      });
      assertNotNull("Can't find '" + toComplete + "' variant", element);
      lookup.setCurrentItem(element);
    }
    if (lookup != null) {
      myFixture.type('\n');
    }
    myFixture.checkResultByFile(getTestName(true) + ".after" + getTestFileExtension());
View Full Code Here

TOP

Related Classes of com.intellij.codeInsight.lookup.LookupEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.