本文整理了Java中org.eclipse.jdt.internal.core.util.Util.isValidFolderNameForPackage()
方法的一些代码示例,展示了Util.isValidFolderNameForPackage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isValidFolderNameForPackage()
方法的具体详情如下:
包路径:org.eclipse.jdt.internal.core.util.Util
类名称:Util
方法名:isValidFolderNameForPackage
[英]Returns true if the given folder name is valid for a package, false if it is not.
[中]如果给定的文件夹名称对包有效,则返回true,否则返回false。
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: com.vaadin/vaadin-client-compiler-deps
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
/**
* Converts the given relative path into a package name.
* Returns null if the path is not a valid package name.
* @param pkgPath the package path
* @param sourceLevel the source level
* @param complianceLevel the compliance level
*/
public static String packageName(IPath pkgPath, String sourceLevel, String complianceLevel) {
StringBuffer pkgName = new StringBuffer(IPackageFragment.DEFAULT_PACKAGE_NAME);
for (int j = 0, max = pkgPath.segmentCount(); j < max; j++) {
String segment = pkgPath.segment(j);
if (!isValidFolderNameForPackage(segment, sourceLevel, complianceLevel)) {
return null;
}
pkgName.append(segment);
if (j < pkgPath.segmentCount() - 1) {
pkgName.append("." ); //$NON-NLS-1$
}
}
return pkgName.toString();
}
代码示例来源:origin: org.jibx.config.3rdparty.org.eclipse/org.eclipse.jdt.core
private boolean isValidPackageName() {
JavaProject javaProject = (JavaProject) getJavaProject();
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
if (Util.isValidFolderNameForPackage(pkgName[i], null, this.complianceLevel)) {
System.arraycopy(existing, 0, existing = new String[i+1], 0, i);
existing[i] = manager.intern(pkgName[i]);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
for (int i = existingLength; i < length; i++) {
if (Util.isValidFolderNameForPackage(pkgName[i], null, compliance)) {
System.arraycopy(existing, 0, existing = new String[i+1], 0, i);
existing[i] = manager.intern(pkgName[i]);
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
private boolean isValidPackageName(char[] packageName) {
if (this.validPackageNames.includes(packageName)) {
return true;
}
if (this.invalidPackageNames.includes(packageName)) {
return false;
}
char[][] names = CharOperation.splitOn('.', packageName);
for (int i = 0, length = names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
this.invalidPackageNames.add(packageName);
return false;
}
}
this.validPackageNames.add(packageName);
return true;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
private boolean isValidPackageName(char[] packageName) {
if (this.validPackageNames.includes(packageName)) {
return true;
}
if (this.invalidPackageNames.includes(packageName)) {
return false;
}
char[][] names = CharOperation.splitOn('.', packageName);
for (int i = 0, length = names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
this.invalidPackageNames.add(packageName);
return false;
}
}
this.validPackageNames.add(packageName);
return true;
}
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
private boolean isValidPackageName(char[] packageName) {
if (this.validPackageNames.includes(packageName)) {
return true;
}
if (this.invalidPackageNames.includes(packageName)) {
return false;
}
char[][] names = CharOperation.splitOn('.', packageName);
for (int i = 0, length = names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
this.invalidPackageNames.add(packageName);
return false;
}
}
this.validPackageNames.add(packageName);
return true;
}
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
private boolean isValidPackageName(char[] packageName) {
if (this.validPackageNames.includes(packageName)) {
return true;
}
if (this.invalidPackageNames.includes(packageName)) {
return false;
}
char[][] names = CharOperation.splitOn('.', packageName);
for (int i = 0, length = names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
this.invalidPackageNames.add(packageName);
return false;
}
}
this.validPackageNames.add(packageName);
return true;
}
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
private boolean isValidPackageName(char[] packageName) {
if (this.validPackageNames.includes(packageName)) {
return true;
}
if (this.invalidPackageNames.includes(packageName)) {
return false;
}
char[][] names = CharOperation.splitOn('.', packageName);
for (int i = 0, length = names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(new String(names[i]), this.sourceLevel, this.complianceLevel)) {
this.invalidPackageNames.add(packageName);
return false;
}
}
this.validPackageNames.add(packageName);
return true;
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.core
protected boolean internalIsValidPackageName() {
// if package fragment refers to folder in another IProject, then
// resource().getProject() is different than getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
代码示例来源:origin: org.eclipse.tycho/org.eclipse.jdt.core
protected boolean internalIsValidPackageName() {
// if package fragment refers to folder in another IProject, then
// resource().getProject() is different than getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.core
protected boolean internalIsValidPackageName() {
// if package fragment refers to folder in another IProject, then
// resource().getProject() is different than getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
代码示例来源:origin: com.google.code.maven-play-plugin.org.eclipse.jdt/org.eclipse.jdt.core
protected boolean internalIsValidPackageName() {
// if package fragment refers to folder in another IProject, then
// resource().getProject() is different than getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
代码示例来源:origin: trylimits/Eclipse-Postfix-Code-Completion
protected boolean internalIsValidPackageName() {
// if package fragment refers to folder in another IProject, then
// resource().getProject() is different than getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject javaProject = JavaCore.create(resource().getProject());
String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0, length = this.names.length; i < length; i++) {
if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel))
return false;
}
return true;
}
/**
内容来源于网络,如有侵权,请联系作者删除!