本文整理汇总了Java中org.eclipse.core.resources.IResource.getFileExtension方法的典型用法代码示例。如果您正苦于以下问题:Java IResource.getFileExtension方法的具体用法?Java IResource.getFileExtension怎么用?Java IResource.getFileExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.resources.IResource
的用法示例。
在下文中一共展示了IResource.getFileExtension方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
if (resource.getFileExtension() != null){
switch (delta.getKind()) {
case IResourceDelta.ADDED:
if(resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
case IResourceDelta.REMOVED:
if(resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
case IResourceDelta.CHANGED:
if( resource.getFileExtension().equals("java")){
executeBuild = true;
return false;
}
break;
}
}
return true;
}
示例2: testCreateFileDeleteIfExistsStringStringStringIProgressMonitor
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
@Test
public void testCreateFileDeleteIfExistsStringStringStringIProgressMonitor() throws Exception {
IJavaProject project = ProjectHelper.getOrCreateSimpleGW4EProject(PROJECT_NAME, true, true);
IFile impl = (IFile) ResourceManager
.getResource(project.getProject().getFullPath().append("src/test/java/SimpleImpl.java").toString());
int[] count = new int[1];
count[0] = 0;
IResourceVisitor visitor = new IResourceVisitor() {
@Override
public boolean visit(IResource resource) throws CoreException {
if (resource.getFileExtension() != null && resource.getFileExtension().equalsIgnoreCase("java")) {
count[0] = count[0] + 1;
}
return true;
}
};
impl.getParent().accept(visitor);
assertTrue(count[0] == 1);
ResourceManager.createFileDeleteIfExists(impl.getParent().getFullPath().toString(), "SimpleImpl.java", "",
new NullProgressMonitor());
String s = IOHelper.getContent(impl);
assertTrue(s.length() == 0);
count[0] = 0;
impl.getParent().accept(visitor);
assertTrue(count[0] == 2);
}
示例3: visit
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
@Override
public boolean visit(IResource resource) throws CoreException {
boolean mustVisitChild = true;
if(resource instanceof IFile){
String resourceExtension = resource.getFileExtension();
if(resourceExtension == null){
resourceExtension = "";
}
if(_searchedFileExtensions.contains(resourceExtension)){
_files.add((IFile) resource);
}
mustVisitChild = false;
}
return mustVisitChild;
}
示例4: loadModels
import org.eclipse.core.resources.IResource; //导入方法依赖的package包/类
private static List<String> loadModels(IContainer container) throws CoreException {
List<String> files = new ArrayList<String>();
IResource[] members = container.members();
for (IResource member : members) {
if (member instanceof IContainer) {
files.addAll(loadModels((IContainer) member));
} else if (member instanceof IFile) {
if (member.getFileExtension() != null && member.getFileExtension().equals("xmontiarc")) {
String path = member.getFullPath().toOSString();
files.add(path);
}
}
}
return files;
}