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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. String extractTypeName() {
  2. // answer a String with the qualified type name for the source file in the form: 'p1/p2/A'
  3. IPath fullPath = this.resource.getFullPath();
  4. int resourceSegmentCount = fullPath.segmentCount();
  5. int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  6. int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  7. resourceSegmentCount--; // deal with the last segment separately
  8. for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
  9. charCount += fullPath.segment(i).length();
  10. String lastSegment = fullPath.segment(resourceSegmentCount);
  11. int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  12. charCount += extensionIndex;
  13. char[] result = new char[charCount];
  14. int offset = 0;
  15. for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++) {
  16. String segment = fullPath.segment(i);
  17. int size = segment.length();
  18. segment.getChars(0, size, result, offset);
  19. offset += size;
  20. result[offset++] = '/';
  21. }
  22. lastSegment.getChars(0, extensionIndex, result, offset);
  23. return new String(result);
  24. }

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

  1. String extractTypeName() {
  2. // answer a String with the qualified type name for the source file in the form: 'p1/p2/A'
  3. IPath fullPath = this.resource.getFullPath();
  4. int resourceSegmentCount = fullPath.segmentCount();
  5. int sourceFolderSegmentCount = this.sourceLocation.sourceFolder.getFullPath().segmentCount();
  6. int charCount = (resourceSegmentCount - sourceFolderSegmentCount - 1);
  7. resourceSegmentCount--; // deal with the last segment separately
  8. for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++)
  9. charCount += fullPath.segment(i).length();
  10. String lastSegment = fullPath.segment(resourceSegmentCount);
  11. int extensionIndex = Util.indexOfJavaLikeExtension(lastSegment);
  12. charCount += extensionIndex;
  13. char[] result = new char[charCount];
  14. int offset = 0;
  15. for (int i = sourceFolderSegmentCount; i < resourceSegmentCount; i++) {
  16. String segment = fullPath.segment(i);
  17. int size = segment.length();
  18. segment.getChars(0, size, result, offset);
  19. offset += size;
  20. result[offset++] = '/';
  21. }
  22. lastSegment.getChars(0, extensionIndex, result, offset);
  23. return new String(result);
  24. }

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

  1. private char[] getQualifiedName() {
  2. if (this.openable instanceof CompilationUnit) {
  3. // get file name
  4. String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
  5. // get main type name
  6. char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
  7. CompilationUnit cu = (CompilationUnit) this.openable;
  8. return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  9. } else if (this.openable instanceof ClassFile) {
  10. String fileName = getSourceFileName();
  11. if (fileName == NO_SOURCE_FILE_NAME)
  12. return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();
  13. // Class file may have a source file name with ".java" extension (see bug 73784)
  14. int index = Util.indexOfJavaLikeExtension(fileName);
  15. String simpleName = index==-1 ? fileName : fileName.substring(0, index);
  16. PackageFragment pkg = (PackageFragment) this.openable.getParent();
  17. return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  18. }
  19. return null;
  20. }
  21. PossibleMatch getSimilarMatch() {

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

  1. private char[] getQualifiedName() {
  2. if (this.openable instanceof CompilationUnit) {
  3. // get file name
  4. String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
  5. // get main type name
  6. char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
  7. CompilationUnit cu = (CompilationUnit) this.openable;
  8. return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  9. } else if (this.openable instanceof ClassFile) {
  10. String fileName = getSourceFileName();
  11. if (fileName == NO_SOURCE_FILE_NAME)
  12. return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();
  13. // Class file may have a source file name with ".java" extension (see bug 73784)
  14. int index = Util.indexOfJavaLikeExtension(fileName);
  15. String simpleName = index==-1 ? fileName : fileName.substring(0, index);
  16. PackageFragment pkg = (PackageFragment) this.openable.getParent();
  17. return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  18. }
  19. return null;
  20. }
  21. PossibleMatch getSimilarMatch() {

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

  1. private char[] getQualifiedName() {
  2. if (this.openable instanceof CompilationUnit) {
  3. // get file name
  4. String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
  5. // get main type name
  6. char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
  7. CompilationUnit cu = (CompilationUnit) this.openable;
  8. return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  9. } else if (this.openable instanceof ClassFile) {
  10. String fileName = getSourceFileName();
  11. if (fileName == NO_SOURCE_FILE_NAME)
  12. return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();
  13. // Class file may have a source file name with ".java" extension (see bug 73784)
  14. int index = Util.indexOfJavaLikeExtension(fileName);
  15. String simpleName = index==-1 ? fileName : fileName.substring(0, index);
  16. PackageFragment pkg = (PackageFragment) this.openable.getParent();
  17. return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  18. }
  19. return null;
  20. }
  21. PossibleMatch getSimilarMatch() {

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

  1. private char[] getQualifiedName() {
  2. if (this.openable instanceof CompilationUnit) {
  3. // get file name
  4. String fileName = this.openable.getElementName(); // working copy on a .class file may not have a resource, so use the element name
  5. // get main type name
  6. char[] mainTypeName = Util.getNameWithoutJavaLikeExtension(fileName).toCharArray();
  7. CompilationUnit cu = (CompilationUnit) this.openable;
  8. return cu.getType(new String(mainTypeName)).getFullyQualifiedName().toCharArray();
  9. } else if (this.openable instanceof ClassFile) {
  10. String fileName = getSourceFileName();
  11. if (fileName == NO_SOURCE_FILE_NAME)
  12. return ((ClassFile) this.openable).getType().getFullyQualifiedName('.').toCharArray();
  13. // Class file may have a source file name with ".java" extension (see bug 73784)
  14. int index = Util.indexOfJavaLikeExtension(fileName);
  15. String simpleName = index==-1 ? fileName : fileName.substring(0, index);
  16. PackageFragment pkg = (PackageFragment) this.openable.getParent();
  17. return Util.concatWith(pkg.names, simpleName, '.').toCharArray();
  18. }
  19. return null;
  20. }
  21. PossibleMatch getSimilarMatch() {

相关文章

Util类方法