com.intellij.BundleBase Java Examples

The following examples show how to use com.intellij.BundleBase. 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: GotoActionModel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
private static String calcHit(@Nonnull OptionDescription value) {
  //if (value instanceof RegistryTextOptionDescriptor) {
  //  return value.getHit() + " = " + value.getValue();
  //}
  String hit = StringUtil.defaultIfEmpty(value.getHit(), value.getOption());
  return StringUtil.unescapeXmlEntities(StringUtil.notNullize(hit)).replace(BundleBase.MNEMONIC_STRING, "").replace("  ", " "); // avoid extra spaces from mnemonics and xml conversion
}
 
Example #4
Source File: SearchWebAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void update(@Nonnull AnActionEvent e) {
  Presentation presentation = e.getPresentation();
  DataContext dataContext = e.getDataContext();
  CopyProvider provider = e.getData(PlatformDataKeys.COPY_PROVIDER);
  boolean available = provider != null && provider.isCopyEnabled(dataContext) && provider.isCopyVisible(dataContext);
  presentation.setEnabled(available);
  presentation.setVisible(available);

  WebSearchEngine engine = myWebSearchOptions.getEngine();

  presentation.setText(BundleBase.format(ActionsBundle.message("action.$SearchWeb.0.text", engine.getPresentableName())));
  presentation.setDescription(BundleBase.format(ActionsBundle.message("action.$SearchWeb.0.description", engine.getPresentableName())));
}
 
Example #5
Source File: SearchWebAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Override
public void actionPerformed(@Nonnull AnActionEvent e) {
  DataContext dataContext = e.getDataContext();
  CopyProvider provider = dataContext.getData(PlatformDataKeys.COPY_PROVIDER);
  if (provider == null) {
    return;
  }
  provider.performCopy(dataContext);
  String content = CopyPasteManager.getInstance().getContents(DataFlavor.stringFlavor);
  if (StringUtil.isNotEmpty(content)) {
    WebSearchEngine engine = myWebSearchOptions.getEngine();
    BrowserUtil.browse(BundleBase.format(engine.getUrlTemplate(), URLUtil.encodeURIComponent(content)));
  }
}
 
Example #6
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 #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: 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 #9
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 #10
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 #11
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 #12
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 #13
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 #14
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 #15
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 #16
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));
}
 
Example #17
Source File: UIUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static String replaceMnemonicAmpersand(final String value) {
  return BundleBase.replaceMnemonicAmpersand(value);
}
 
Example #18
Source File: EmbeddedLinuxJVMBundle.java    From embeddedlinux-jvmdebugger-intellij with Apache License 2.0 2 votes vote down vote up
/**
 * @param key
 * @param params
 * @return
 */
public static String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, @NotNull Object... params) {
    return BundleBase.message(getBundle(), key, params);
}