Java Code Examples for com.intellij.codeInsight.lookup.LookupElement#putUserData()

The following examples show how to use com.intellij.codeInsight.lookup.LookupElement#putUserData() . 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: CSharpCompletionUtil.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
public static void elementToLookup(@Nonnull CompletionResultSet resultSet,
		@Nonnull IElementType elementType,
		@Nullable NotNullPairFunction<LookupElementBuilder, IElementType, LookupElement> decorator,
		@Nullable Condition<IElementType> condition)
{
	if(condition != null && !condition.value(elementType))
	{
		return;
	}

	String keyword = ourCache.get(elementType);
	LookupElementBuilder builder = LookupElementBuilder.create(elementType, keyword);
	builder = builder.bold();
	LookupElement item = builder;
	if(decorator != null)
	{
		item = decorator.fun(builder, elementType);
	}

	item.putUserData(KEYWORD_ELEMENT_TYPE, elementType);
	resultSet.addElement(item);
}
 
Example 2
Source File: StatisticsWeigher.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void clearBaseStatisticsInfo(LookupElement item) {
  item.putUserData(BASE_STATISTICS_INFO, null);
}