org.eclipse.jface.util.Util.replaceAll()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中org.eclipse.jface.util.Util.replaceAll()方法的一些代码示例,展示了Util.replaceAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.replaceAll()方法的具体详情如下:
包路径:org.eclipse.jface.util.Util
类名称:Util
方法名:replaceAll

Util.replaceAll介绍

[英]Foundation replacement for String#replaceAll(String, String), but without support for regular expressions.
[中]基金会替换[[ $ 0 $] ],但不支持正则表达式。

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Convenience method for escaping all mnemonics in the given string. For
 * example, <code>escapeMnemonics("a & b & c")</code> will return
 * <code>"a && b && c"</code>.
 *
 * @param text
 *            the text
 * @return the text with mnemonics escaped
 * @since 3.6
 */
public static final String escapeMnemonics(String text) {
  return Util.replaceAll(text, "&", "&&"); //$NON-NLS-1$//$NON-NLS-2$
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Convenience method for escaping all mnemonics in the given string. For
 * example, <code>escapeMnemonics("a & b & c")</code> will return
 * <code>"a && b && c"</code>.
 *
 * @param text
 *            the text
 * @return the text with mnemonics escaped
 * @since 3.6
 */
public static String escapeMnemonics(String text) {
  return Util.replaceAll(text, "&", "&&"); //$NON-NLS-1$//$NON-NLS-2$
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Trims sequences of '*' characters
 *
 * @param pattern
 *            string to be trimmed
 * @return trimmed pattern
 */
private String trimWildcardCharacters(String pattern) {
  return Util.replaceAll(pattern, "\\*+", "\\*"); //$NON-NLS-1$ //$NON-NLS-2$		}
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Foundation replacement for String.replaceAll(*).
 *
 * @param src the starting string.
 * @param find the string to find.
 * @param replacement the string to replace.
 * @return The new string.
 * @since 3.3
 */
public static String replaceAll(String src, String find, String replacement) {
  return org.eclipse.jface.util.Util.replaceAll(src, find, replacement);
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

/**
 * Convenience method for escaping all mnemonics in the given string. For
 * example, <code>escapeMnemonics("a & b & c")</code> will return
 * <code>"a && b && c"</code>.
 * 
 * @param text
 *            the text
 * @return the text with mnemonics escaped
 * @since 1.3
 */
public static final String escapeMnemonics(String text) {
  return Util.replaceAll(text, "&", "&&"); //$NON-NLS-1$//$NON-NLS-2$
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

/**
 * Prepare command for launching system explorer to show a path
 *
 * @param path
 *            the path to show
 * @return the command that shows the path
 */
private String formShowInSytemExplorerCommand(File path) throws IOException {
  String command = IDEWorkbenchPlugin.getDefault().getPreferenceStore()
      .getString(IDEInternalPreferences.WORKBENCH_SYSTEM_EXPLORER);
  command = Util.replaceAll(command, VARIABLE_RESOURCE, quotePath(path.getCanonicalPath()));
  command = Util.replaceAll(command, VARIABLE_RESOURCE_URI, path.getCanonicalFile().toURI().toString());
  File parent = path.getParentFile();
  if (parent != null) {
    command = Util.replaceAll(command, VARIABLE_FOLDER, quotePath(parent.getCanonicalPath()));
  }
  return command;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private String[] resolveParameterTypes(IMethod method) {
    final String[] oldParameterTypes= method.getParameterTypes();
    final String[] newparams= new String[oldParameterTypes.length];
    final String[] possibleOldSigs= new String[2];
    //using type signature, since there is no package signature
    possibleOldSigs[0]= Signature.createTypeSignature(fPackage.getElementName(), false);
    possibleOldSigs[1]= Signature.createTypeSignature(fPackage.getElementName(), true);
    final String[] possibleNewSigs= new String[2];
    possibleNewSigs[0]= Signature.createTypeSignature(getNewElementName(), false);
    possibleNewSigs[1]= Signature.createTypeSignature(getNewElementName(), true);
    // Textually replace all occurrences
    // This handles stuff like Map<SomeClass, some.package.SomeClass>
    for (int i= 0; i < oldParameterTypes.length; i++) {
      newparams[i]= oldParameterTypes[i];
      for (int j= 0; j < possibleOldSigs.length; j++) {
        newparams[i]= Util.replaceAll(newparams[i], possibleOldSigs[j], possibleNewSigs[j]);
      }
    }
    return newparams;
  }
}.transplantHandle(original);

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private String[] resolveParameterTypes(IMethod method) {
    final String[] oldParameterTypes= method.getParameterTypes();
    final String[] newparams= new String[oldParameterTypes.length];
    final String[] possibleOldSigs= new String[2];
    //using type signature, since there is no package signature
    possibleOldSigs[0]= Signature.createTypeSignature(fPackage.getElementName(), false);
    possibleOldSigs[1]= Signature.createTypeSignature(fPackage.getElementName(), true);
    final String[] possibleNewSigs= new String[2];
    possibleNewSigs[0]= Signature.createTypeSignature(getNewElementName(), false);
    possibleNewSigs[1]= Signature.createTypeSignature(getNewElementName(), true);
    // Textually replace all occurrences
    // This handles stuff like Map<SomeClass, some.package.SomeClass>
    for (int i= 0; i < oldParameterTypes.length; i++) {
      newparams[i]= oldParameterTypes[i];
      for (int j= 0; j < possibleOldSigs.length; j++) {
        newparams[i]= Util.replaceAll(newparams[i], possibleOldSigs[j], possibleNewSigs[j]);
      }
    }
    return newparams;
  }
}.transplantHandle(original);

相关文章