本文整理匯總了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;
}