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


Java IFile.move方法代碼示例

本文整理匯總了Java中org.eclipse.core.resources.IFile.move方法的典型用法代碼示例。如果您正苦於以下問題:Java IFile.move方法的具體用法?Java IFile.move怎麽用?Java IFile.move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.core.resources.IFile的用法示例。


在下文中一共展示了IFile.move方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSuperClassRenamed

import org.eclipse.core.resources.IFile; //導入方法依賴的package包/類
/**
 *
 * 01. Class0 uses Class1 in require statement and in isa function
 * 02. Class1 file is renamed
 * 05. Class0 should get error marker at require statement and at isa function
 * 06. Class1 is renamed back
 * 07. Class0 should have no error markers
 */
//@formatter:on
@Test
public void testSuperClassRenamed() throws Exception {
	logger.info("BuilderParticipantPluginUITest.testSuperClassRenamed");
	// create project and test files
	final IProject project = createJSProject("testSuperClassRenamed");
	IFolder folder = configureProjectWithXtext(project);

	IFolder moduleFolder = createFolder(folder, InheritanceTestFiles.inheritanceModule());

	IFile parentFile = createTestFile(moduleFolder, "Parent", InheritanceTestFiles.Parent());
	assertMarkers("Parent file should have no errors", parentFile, 0);
	IFile childFile = createTestFile(moduleFolder, "Child", InheritanceTestFiles.Child());
	assertMarkers("Child file should have no errors", childFile, 0);

	// open editors of test files
	IWorkbenchPage page = getActivePage();
	XtextEditor parentFileXtextEditor = openAndGetXtextEditor(parentFile, page);
	List<?> errors = getEditorErrors(parentFileXtextEditor);
	assertEquals("Editor of parent should have no errors", 0, errors.size());
	XtextEditor childFileXtextEditor = openAndGetXtextEditor(childFile, page);
	errors = getEditorErrors(childFileXtextEditor);
	assertEquals("Editor of child should have no errors", 0, errors.size());

	parentFileXtextEditor.close(true);

	parentFile.move(new Path("Parent2" + F_EXT), true, true, monitor());
	moduleFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor());
	waitForAutoBuild();
	waitForUpdateEditorJob();

	assertFalse("Parent.n4js doesn't exist anymore", moduleFolder.getFile(new Path("Parent" + F_EXT)).exists());
	IFile movedParentFile = moduleFolder.getFile("Parent2" + F_EXT);
	assertTrue("Parent2.n4js does exist", movedParentFile.exists());

	errors = getEditorErrors(childFileXtextEditor);
	assertEquals("Editor of child should have got error markers", 3, errors.size());

	movedParentFile.move(new Path("Parent" + F_EXT), true, true, monitor());
	moduleFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor());
	waitForAutoBuild();
	waitForUpdateEditorJob();
	assertTrue("Parent.n4js does exist", moduleFolder.getFile(new Path("Parent" + F_EXT)).exists());

	errors = getEditorErrors(childFileXtextEditor);
	assertEquals("Editor of child should have no errors", 0, errors.size());
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:56,代碼來源:BuilderParticipantPluginUITest.java


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