本文整理汇总了Java中org.eclipse.jdt.internal.core.util.Util.isValidClassFileName方法的典型用法代码示例。如果您正苦于以下问题:Java Util.isValidClassFileName方法的具体用法?Java Util.isValidClassFileName怎么用?Java Util.isValidClassFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.core.util.Util
的用法示例。
在下文中一共展示了Util.isValidClassFileName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isResFilteredFromOutput
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private boolean isResFilteredFromOutput(RootInfo rootInfo, OutputsInfo info, IResource res, int elementType) {
if (info != null) {
JavaProject javaProject = null;
String sourceLevel = null;
String complianceLevel = null;
IPath resPath = res.getFullPath();
for (int i = 0; i < info.outputCount; i++) {
if (info.paths[i].isPrefixOf(resPath)) {
if (info.traverseModes[i] != IGNORE) {
// case of bin=src
if (info.traverseModes[i] == SOURCE && elementType == IJavaElement.CLASS_FILE) {
return true;
}
// case of .class file under project and no source folder
// proj=bin
if (elementType == IJavaElement.JAVA_PROJECT && res instanceof IFile) {
if (sourceLevel == null) {
// Get java project to use its source and compliance levels
javaProject = rootInfo == null ?
(JavaProject)createElement(res.getProject(), IJavaElement.JAVA_PROJECT, null) :
rootInfo.project;
if (javaProject != null) {
sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
}
}
if (Util.isValidClassFileName(res.getName(), sourceLevel, complianceLevel)) {
return true;
}
}
} else {
return true;
}
}
}
}
return false;
}
示例2: isResFilteredFromOutput
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
private boolean isResFilteredFromOutput(
RootInfo rootInfo, OutputsInfo info, IResource res, int elementType) {
if (info != null) {
JavaProject javaProject = null;
String sourceLevel = null;
String complianceLevel = null;
IPath resPath = res.getFullPath();
for (int i = 0; i < info.outputCount; i++) {
if (info.paths[i].isPrefixOf(resPath)) {
if (info.traverseModes[i] != IGNORE) {
// case of bin=src
if (info.traverseModes[i] == SOURCE && elementType == IJavaElement.CLASS_FILE) {
return true;
}
// case of .class file under project and no source folder
// proj=bin
if (elementType == IJavaElement.JAVA_PROJECT && res instanceof IFile) {
// if (sourceLevel == null) {
// // Get java project to use its source and compliance levels
// javaProject = rootInfo == null ?
// (JavaProject)createElement(res.getProject(), IJavaElement.JAVA_PROJECT,
// null) :
// rootInfo.project;
// if (javaProject != null) {
// sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true);
// complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE,
// true);
// }
// }
if (Util.isValidClassFileName(res.getName(), sourceLevel, complianceLevel)) {
return true;
}
}
} else {
return true;
}
}
}
}
return false;
}
示例3: computeFolderNonJavaResources
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
* Starting at this folder, create non-java resources for this package fragment root
* and add them to the non-java resources collection.
*
* @exception JavaModelException The resource associated with this package fragment does not exist
*/
static Object[] computeFolderNonJavaResources(IPackageFragmentRoot root, IContainer folder, char[][] inclusionPatterns, char[][] exclusionPatterns) throws JavaModelException {
IResource[] nonJavaResources = new IResource[5];
int nonJavaResourcesCounter = 0;
try {
IResource[] members = folder.members();
int length = members.length;
if (length > 0) {
// if package fragment root refers to folder in another IProject, then
// folder.getProject() is different than root.getJavaProject().getProject()
// use the other java project's options to verify the name
IJavaProject otherJavaProject = JavaCore.create(folder.getProject());
String sourceLevel = otherJavaProject.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = otherJavaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true);
JavaProject javaProject = (JavaProject) root.getJavaProject();
IClasspathEntry[] classpath = javaProject.getResolvedClasspath();
nextResource: for (int i = 0; i < length; i++) {
IResource member = members[i];
switch (member.getType()) {
case IResource.FILE :
String fileName = member.getName();
// ignore .java files that are not excluded
if (Util.isValidCompilationUnitName(fileName, sourceLevel, complianceLevel) && !Util.isExcluded(member, inclusionPatterns, exclusionPatterns))
continue nextResource;
// ignore .class files
if (Util.isValidClassFileName(fileName, sourceLevel, complianceLevel))
continue nextResource;
// ignore .zip or .jar file on classpath
if (isClasspathEntry(member.getFullPath(), classpath))
continue nextResource;
break;
case IResource.FOLDER :
// ignore valid packages or excluded folders that correspond to a nested pkg fragment root
if (Util.isValidFolderNameForPackage(member.getName(), sourceLevel, complianceLevel)
&& (!Util.isExcluded(member, inclusionPatterns, exclusionPatterns)
|| isClasspathEntry(member.getFullPath(), classpath)))
continue nextResource;
break;
}
if (nonJavaResources.length == nonJavaResourcesCounter) {
// resize
System.arraycopy(nonJavaResources, 0, (nonJavaResources = new IResource[nonJavaResourcesCounter * 2]), 0, nonJavaResourcesCounter);
}
nonJavaResources[nonJavaResourcesCounter++] = member;
}
}
if (ExternalFoldersManager.isInternalPathForExternalFolder(folder.getFullPath())) {
IJarEntryResource[] jarEntryResources = new IJarEntryResource[nonJavaResourcesCounter];
for (int i = 0; i < nonJavaResourcesCounter; i++) {
jarEntryResources[i] = new NonJavaResource(root, nonJavaResources[i]);
}
return jarEntryResources;
} else if (nonJavaResources.length != nonJavaResourcesCounter) {
System.arraycopy(nonJavaResources, 0, (nonJavaResources = new IResource[nonJavaResourcesCounter]), 0, nonJavaResourcesCounter);
}
return nonJavaResources;
} catch (CoreException e) {
throw new JavaModelException(e);
}
}
示例4: buildStructure
import org.eclipse.jdt.internal.core.util.Util; //导入方法依赖的package包/类
/**
* @see Openable
*/
protected boolean buildStructure(OpenableElementInfo info, IProgressMonitor pm, Map newElements, IResource underlyingResource) throws JavaModelException {
// add compilation units/class files from resources
HashSet vChildren = new HashSet();
int kind = getKind();
try {
PackageFragmentRoot root = getPackageFragmentRoot();
char[][] inclusionPatterns = root.fullInclusionPatternChars();
char[][] exclusionPatterns = root.fullExclusionPatternChars();
IResource[] members = ((IContainer) underlyingResource).members();
int length = members.length;
if (length > 0) {
IJavaProject project = getJavaProject();
String sourceLevel = project.getOption(JavaCore.COMPILER_SOURCE, true);
String complianceLevel = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
for (int i = 0; i < length; i++) {
IResource child = members[i];
if (child.getType() != IResource.FOLDER
&& !Util.isExcluded(child, inclusionPatterns, exclusionPatterns)) {
IJavaElement childElement;
if (kind == IPackageFragmentRoot.K_SOURCE && Util.isValidCompilationUnitName(child.getName(), sourceLevel, complianceLevel)) {
childElement = new CompilationUnit(this, child.getName(), DefaultWorkingCopyOwner.PRIMARY);
vChildren.add(childElement);
} else if (kind == IPackageFragmentRoot.K_BINARY && Util.isValidClassFileName(child.getName(), sourceLevel, complianceLevel)) {
childElement = getClassFile(child.getName());
vChildren.add(childElement);
}
}
}
}
} catch (CoreException e) {
throw new JavaModelException(e);
}
if (kind == IPackageFragmentRoot.K_SOURCE) {
// add primary compilation units
ICompilationUnit[] primaryCompilationUnits = getCompilationUnits(DefaultWorkingCopyOwner.PRIMARY);
for (int i = 0, length = primaryCompilationUnits.length; i < length; i++) {
ICompilationUnit primary = primaryCompilationUnits[i];
vChildren.add(primary);
}
}
IJavaElement[] children = new IJavaElement[vChildren.size()];
vChildren.toArray(children);
info.setChildren(children);
return true;
}