org.eclipse.jdt.internal.core.util.Util.indexOfJavaLikeExtension()方法的使用及代码示例

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

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

Util.indexOfJavaLikeExtension介绍

暂无

代码示例

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

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

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

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

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

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

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Returns true if the given name ends with one of the known java like extension.
 * (implementation is not creating extra strings)
 */
public final static boolean isJavaLikeFileName(String name) {
  if (name == null) return false;
  return indexOfJavaLikeExtension(name) != -1;
}

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

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

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

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

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

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps

/**
 * Returns the substring of the given file name, ending at the start of a
 * Java like extension. The entire file name is returned if it doesn't end
 * with a Java like extension.
 */
public static String getNameWithoutJavaLikeExtension(String fileName) {
  int index = indexOfJavaLikeExtension(fileName);
  if (index == -1)
    return fileName;
  return fileName.substring(0, index);
}

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

String extractTypeName() {
  // answer a String with the qualified type name for the source file in the form: 'p1/p2/A'
  IPath fullPath = this.resource.getFullPath();
  int resourceSegmentCount = fullPath.segmentCount();
  int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  resourceSegmentCount--; // deal with the last segment separately
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
    charCount += fullPath.segment(i).length();
  String lastSegment = fullPath.segment(resourceSegmentCount);
  int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  charCount += extensionIndex;

  char[] result = new char[charCount];
  int offset = 0;
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++) {
    String segment = fullPath.segment(i);
    int size = segment.length();
    segment.getChars(0, size, result, offset);
    offset += size;
    result[offset++] = '/';
  }
  lastSegment.getChars(0, extensionIndex, result, offset);
  return new String(result);
}

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

String extractTypeName() {
  // answer a String with the qualified type name for the source file in the form: 'p1/p2/A'
  IPath fullPath = this.resource.getFullPath();
  int resourceSegmentCount = fullPath.segmentCount();
  int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  resourceSegmentCount--; // deal with the last segment separately
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
    charCount += fullPath.segment(i).length();
  String lastSegment = fullPath.segment(resourceSegmentCount);
  int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  charCount += extensionIndex;

  char[] result = new char[charCount];
  int offset = 0;
  for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++) {
    String segment = fullPath.segment(i);
    int size = segment.length();
    segment.getChars(0, size, result, offset);
    offset += size;
    result[offset++] = '/';
  }
  lastSegment.getChars(0, extensionIndex, result, offset);
  return new String(result);
}

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

private char[] getQualifiedName() {
  if (this.openable instanceof CompilationUnit) {
    // get file name
    String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
    // get main type name
    char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
    CompilationUnit cu = (CompilationUnit) this.openable;
    return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  } else if (this.openable instanceof ClassFile) {
    String fileName = getSourceFileName();
    if (fileName == NO_SOURCE_FILE_NAME)
      return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();

    // Class file may have a source file name with ".java" extension (see bug 73784)
    int index = Util.indexOfJavaLikeExtension(fileName);
    String simpleName = index==-1 ? fileName : fileName.substring(0, index);
    PackageFragment pkg = (PackageFragment) this.openable.getParent();
    return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  }
  return null;
}
PossibleMatch getSimilarMatch() {

代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core

private char[] getQualifiedName() {
  if (this.openable instanceof CompilationUnit) {
    // get file name
    String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
    // get main type name
    char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
    CompilationUnit cu = (CompilationUnit) this.openable;
    return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  } else if (this.openable instanceof ClassFile) {
    String fileName = getSourceFileName();
    if (fileName == NO_SOURCE_FILE_NAME)
      return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();

    // Class file may have a source file name with ".java" extension (see bug 73784)
    int index = Util.indexOfJavaLikeExtension(fileName);
    String simpleName = index==-1 ? fileName : fileName.substring(0, index);
    PackageFragment pkg = (PackageFragment) this.openable.getParent();
    return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  }
  return null;
}
PossibleMatch getSimilarMatch() {

代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core

private char[] getQualifiedName() {
  if (this.openable instanceof CompilationUnit) {
    // get file name
    String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
    // get main type name
    char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
    CompilationUnit cu = (CompilationUnit) this.openable;
    return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  } else if (this.openable instanceof ClassFile) {
    String fileName = getSourceFileName();
    if (fileName == NO_SOURCE_FILE_NAME)
      return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();

    // Class file may have a source file name with ".java" extension (see bug 73784)
    int index = Util.indexOfJavaLikeExtension(fileName);
    String simpleName = index==-1 ? fileName : fileName.substring(0, index);
    PackageFragment pkg = (PackageFragment) this.openable.getParent();
    return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  }
  return null;
}
PossibleMatch getSimilarMatch() {

代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion

private char[] getQualifiedName() {
  if (this.openable instanceof CompilationUnit) {
    // get file name
    String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
    // get main type name
    char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
    CompilationUnit cu = (CompilationUnit) this.openable;
    return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  } else if (this.openable instanceof ClassFile) {
    String fileName = getSourceFileName();
    if (fileName == NO_SOURCE_FILE_NAME)
      return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();

    // Class file may have a source file name with ".java" extension (see bug 73784)
    int index = Util.indexOfJavaLikeExtension(fileName);
    String simpleName = index==-1 ? fileName : fileName.substring(0, index);
    PackageFragment pkg = (PackageFragment) this.openable.getParent();
    return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  }
  return null;
}
PossibleMatch getSimilarMatch() {

相关文章

微信公众号

最新文章

更多

Util类方法