Java Code Examples for com.intellij.codeInsight.lookup.LookupElementPresentation#setItemText()

The following examples show how to use com.intellij.codeInsight.lookup.LookupElementPresentation#setItemText() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuildLookupElement.java    From intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
  presentation.setItemText(getItemText());
  presentation.setTailText(getTailText());
  presentation.setTypeText(getTypeText());
  presentation.setIcon(getIcon());
}
 
Example 2
Source File: ExistFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);
    ImageIcon icon = new ImageIcon(this.getClass().getResource("/com/yiistorm/images/yii.png"));
    presentation.setIcon(icon);
    presentation.setTypeText(createTitle);
    presentation.setTypeGrayed(false);
}
 
Example 3
Source File: FilePathCompletionContributor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
  final String relativePath = getRelativePath();

  final StringBuilder sb = new StringBuilder();
  if (myInfo != null) {
    sb.append(" (").append(myInfo);
  }

  if (relativePath != null && !relativePath.equals(myName)) {
    if (myInfo != null) {
      sb.append(", ");
    }
    else {
      sb.append(" (");
    }

    sb.append(relativePath);
  }

  if (sb.length() > 0) {
    sb.append(')');
  }

  presentation.setItemText(myName);

  if (sb.length() > 0) {
    presentation.setTailText(sb.toString(), true);
  }

  presentation.setIcon(myIcon);
}
 
Example 4
Source File: NewFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(this.lookupString);
    presentation.setIcon(PlatformIcons.ADD_ICON);
    presentation.setTypeText(createTitle);
    presentation.setTailText(".php");
    presentation.setTypeGrayed(false);
}
 
Example 5
Source File: SymfonyBundleFileLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(this.bundleFile.getSymfonyBundle().getName());
    presentation.setTypeGrayed(true);
    presentation.setIcon(IconUtil.getIcon(this.bundleFile.getVirtualFile(), 0, this.bundleFile.getProject()));

}
 
Example 6
Source File: TranslatorLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(domain);
    presentation.setTypeGrayed(true);

    if(this.isWeak) {
        presentation.setIcon(Symfony2Icons.TRANSLATION_WEAK);
    } else {
        presentation.setIcon(Symfony2Icons.TRANSLATION);
    }
}
 
Example 7
Source File: TabNineCompletionContributor.java    From tabnine-intellij with MIT License 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    if (this.detail != null) {
        presentation.setTypeText(this.detail);
    }
    presentation.setItemTextBold(true);
    presentation.setStrikeout(this.deprecated);
    presentation.setItemText(this.newPrefix);
}
 
Example 8
Source File: MessageLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);


    presentation.setIcon(icon);
    presentation.setTypeText(langTitle);
    presentation.setTypeGrayed(false);
}
 
Example 9
Source File: ExistLangFileLookupElement.java    From yiistorm with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(title);
    ImageIcon icon = new ImageIcon(this.getClass().getResource("/com/yiistorm/images/yii.png"));
    presentation.setIcon(icon);
    presentation.setTypeText(createTitle);
    presentation.setTypeGrayed(false);
}
 
Example 10
Source File: TranslationLookupElement.java    From idea-php-typo3-plugin with MIT License 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(translation.getIndex() + "  ");
    presentation.setTailText(getLookupString(), true);
    presentation.setIcon(TYPO3CMSIcons.TYPO3_ICON);
    presentation.setTypeText("EXT:" + translation.getExtension());
    presentation.setTypeGrayed(true);
}
 
Example 11
Source File: RouteLookupElement.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(route.getController());
    presentation.setTypeGrayed(true);
    presentation.setIcon(!this.isWeak ? Symfony2Icons.ROUTE : Symfony2Icons.ROUTE_WEAK);

    formatTail(presentation);
}
 
Example 12
Source File: Suggestion.java    From intellij-spring-assistant with MIT License 5 votes vote down vote up
public void renderElement(LookupElement element, LookupElementPresentation presentation) {
  Suggestion suggestion = (Suggestion) element.getObject();
  if (suggestion.icon != null) {
    presentation.setIcon(suggestion.icon);
  }

  presentation.setStrikeout(suggestion.deprecationLevel != null);
  if (suggestion.deprecationLevel != null) {
    if (suggestion.deprecationLevel == SpringConfigurationMetadataDeprecationLevel.error) {
      presentation.setItemTextForeground(RED);
    } else {
      presentation.setItemTextForeground(YELLOW);
    }
  }

  String lookupString = element.getLookupString();
  presentation.setItemText(lookupString);
  if (!lookupString.equals(suggestion.suggestionToDisplay)) {
    presentation.setItemTextBold(true);
  }

  String shortDescription;
  if (suggestion.defaultValue != null) {
    shortDescription = shortenTextWithEllipsis(suggestion.defaultValue, 60, 0, true);
    TextAttributes attrs =
        EditorColorsManager.getInstance().getGlobalScheme().getAttributes(SCALAR_TEXT);
    presentation.setTailText("=" + shortDescription, attrs.getForegroundColor());
  }

  if (suggestion.description != null) {
    presentation
        .appendTailText(" (" + getFirstSentenceWithoutDot(suggestion.description) + ")",
            true);
  }

  if (suggestion.shortType != null) {
    presentation.setTypeText(suggestion.shortType);
  }
}
 
Example 13
Source File: LSIncompleteCompletionProposal.java    From intellij-quarkus with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(item.getLabel());
    if (isDeprecated()) {
        presentation.setStrikeout(true);
    }
}
 
Example 14
Source File: TableLookupElement.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {

    presentation.setItemText(getLookupString());
    presentation.setIcon(AllIcons.Nodes.DataTables);
}
 
Example 15
Source File: ResourceLookupElement.java    From idea-php-typo3-plugin with MIT License 4 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(resourceIdentifier);
    presentation.setIcon(AllIcons.FileTypes.Any_type);
}
 
Example 16
Source File: ServiceLookupElement.java    From silex-idea-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {

        presentation.setItemText(getLookupString());
        presentation.setTypeText(service.getClassName().substring(1));
        presentation.setIcon(Icons.Service);
    }
 
Example 17
Source File: ContainerLookupElement.java    From silex-idea-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {

        presentation.setItemText(getLookupString());
        presentation.setTypeText("Pimple");
        presentation.setIcon(Icons.Container);
    }
 
Example 18
Source File: PhpClassAnnotationLookupElement.java    From idea-php-annotation-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(tailText != null ? tailText : this.phpClass.getPresentableFQN());
    presentation.setIcon(this.phpClass.getIcon());
    presentation.setStrikeout(this.phpClass.isDeprecated());
}
 
Example 19
Source File: PhpAnnotationPropertyLookupElement.java    From idea-php-annotation-plugin with MIT License 4 votes vote down vote up
public void renderElement(LookupElementPresentation presentation) {
    presentation.setItemText(getLookupString());
    presentation.setTypeText(ucfirst(this.annotationProperty.getAnnotationPropertyEnum().toString()));
    presentation.setTypeGrayed(true);
    presentation.setIcon(PhpIcons.FIELD_ICON);
}
 
Example 20
Source File: JsonLookupElement.java    From idea-php-toolbox with MIT License 4 votes vote down vote up
@Override
public void renderElement(LookupElementPresentation presentation) {
    JsonParseUtil.decorateLookupElement(presentation, jsonLookupElement);
    presentation.setItemText(jsonLookupElement.getLookupString());
}