第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > java move 方法_Java IFile.move方法代码示例

java move 方法_Java IFile.move方法代码示例

时间:2022-12-17 05:19:07

相关推荐

java move 方法_Java IFile.move方法代码示例

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());

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。