當前位置: 首頁>>代碼示例>>Java>>正文


Java IResource.getFileExtension方法代碼示例

本文整理匯總了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;
}
 
開發者ID:VisuFlow,項目名稱:visuflow-plugin,代碼行數:27,代碼來源:JimpleBuilder.java

示例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);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:30,代碼來源:ResourceManagerTest.java

示例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;
}
 
開發者ID:eclipse,項目名稱:gemoc-studio,代碼行數:16,代碼來源:FileFinderVisitor.java

示例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;
}
 
開發者ID:awortmann,項目名稱:xmontiarc,代碼行數:16,代碼來源:DesignerHelper.java


注:本文中的org.eclipse.core.resources.IResource.getFileExtension方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。