Java Code Examples for com.intellij.BundleBase#format()

The following examples show how to use com.intellij.BundleBase#format() . 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: ProblemsHolder.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static String unresolvedReferenceMessage(@Nonnull PsiReference reference) {
  String message;
  if (reference instanceof EmptyResolveMessageProvider) {
    String pattern = ((EmptyResolveMessageProvider)reference).getUnresolvedMessagePattern();
    try {
      message = BundleBase.format(pattern, reference.getCanonicalText()); // avoid double formatting
    }
    catch (IllegalArgumentException ex) {
      // unresolvedMessage provided by third-party reference contains wrong format string (e.g. {}), tolerate it
      message = pattern;
      LOG.info(pattern);
    }
  }
  else {
    message = CodeInsightBundle.message("error.cannot.resolve.default.message", reference.getCanonicalText());
  }
  return message;
}
 
Example 2
Source File: CreateUnresolvedMethodByLambdaTypeFix.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
@RequiredReadAction
public String getText()
{
	String arguments = buildArgumentTypeRefs();
	if(arguments == null)
	{
		return "invalid";
	}
	return BundleBase.format("Create method ''{0}({1})''", myReferenceName, arguments);
}
 
Example 3
Source File: CastNArgumentToTypeRefFix.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public String getText()
{
	DotNetExpression element = myExpressionPointer.getElement();
	if(element == null)
	{
		return "invalid";
	}
	return BundleBase.format("Cast ''{0}'' argument to ''{1}''", myParameterName, CSharpTypeRefPresentationUtil.buildTextWithKeyword
			(myExpectedTypeRef, element));
}
 
Example 4
Source File: CreateUnresolvedLikeMethodFix.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
@RequiredUIAccess
public String getText()
{
	String arguments = buildArgumentTypeRefs();
	if(arguments == null)
	{
		return "invalid";
	}
	return BundleBase.format(getTemplateText(), myReferenceName, arguments);
}
 
Example 5
Source File: ChangeVariableToTypeRefFix.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String getText()
{
	DotNetVariable element = myVariablePointer.getElement();
	if(element == null)
	{
		return "invalid";
	}
	return BundleBase.format("Change ''{0}'' type to ''{1}''", element.getName(), CSharpTypeRefPresentationUtil.buildTextWithKeyword
			(myToTypeRef, element));
}
 
Example 6
Source File: ChangeReturnToTypeRefFix.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public String getText()
{
	DotNetLikeMethodDeclaration element = myMethodPointer.getElement();
	if(element == null)
	{
		return "invalid";
	}
	return BundleBase.format("Make ''{0}'' return to ''{1}''", element.getName(), CSharpTypeRefPresentationUtil.buildTextWithKeyword
			(myToTypeRef, element));
}
 
Example 7
Source File: CastExpressionToTypeRef.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
@RequiredUIAccess
public String getText()
{
	DotNetExpression element = myExpressionPointer.getElement();
	if(element == null)
	{
		return "invalid";
	}
	return BundleBase.format("Cast to ''{0}''", CSharpTypeRefPresentationUtil.buildTextWithKeyword(myExpectedTypeRef, element));
}
 
Example 8
Source File: ConsuloBuildInLoggerAdapter.java    From consulo with Apache License 2.0 5 votes vote down vote up
private String buildMessage(String format, Object... args) {
  try {
    return BundleBase.format(format, args);
  }
  catch (Exception e) {
    return "Fail to build '" + format + "' args: " + Arrays.asList(args);
  }
}
 
Example 9
Source File: CreateUnresolvedEventFix.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getText()
{
	return BundleBase.format("Create event ''{0}''", myReferenceName);
}
 
Example 10
Source File: CreateUnresolvedFieldFix.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getText()
{
	return BundleBase.format("Create field ''{0}''", myReferenceName);
}
 
Example 11
Source File: CreateUnresolvedPropertyFix.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
@Override
public String getText()
{
	return BundleBase.format("Create property ''{0}''", myReferenceName);
}
 
Example 12
Source File: UsageType.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public String toString(@Nonnull UsageViewPresentation presentation) {
  String word = presentation.getUsagesWord();
  String usageWord = StringUtil.startsWithChar(myName, '{') ? StringUtil.capitalize(word) : word;
  return BundleBase.format(myName, usageWord);
}
 
Example 13
Source File: Executor.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nonnull
public String getActionText(@javax.annotation.Nullable String configurationName) {
  return BundleBase.format(getStartActionText(StringUtil.isEmpty(configurationName)), escapeMnemonicsInConfigurationName(configurationName));
}