当前位置: 首页>>代码示例>>Java>>正文


Java IFolder.refreshLocal方法代码示例

本文整理汇总了Java中org.eclipse.core.resources.IFolder.refreshLocal方法的典型用法代码示例。如果您正苦于以下问题:Java IFolder.refreshLocal方法的具体用法?Java IFolder.refreshLocal怎么用?Java IFolder.refreshLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.resources.IFolder的用法示例。


在下文中一共展示了IFolder.refreshLocal方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: replaceFileContentAndWaitForRefresh

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/***/
protected void replaceFileContentAndWaitForRefresh(IFolder folder, IFile file, String newContent)
		throws IOException, CoreException {
	File fileInFilesystem = file.getLocation().toFile();
	FileWriter fileWriter = new FileWriter(fileInFilesystem);
	fileWriter.write(newContent);
	fileWriter.close();
	folder.refreshLocal(IResource.DEPTH_INFINITE, monitor());
	waitForAutoBuild();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:AbstractBuilderParticipantTest.java

示例2: createProject

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 * This method creates a new java project based on the user inputs, captured in WizardInput object.
 * The new project is created in the current workspace.
 * @param wizardInput
 * @return IJavaProject
 * @throws CoreException
 * @throws IOException
 **/
public IJavaProject createProject(WizardInput wizardInput) throws CoreException, IOException
{
	IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
	IProject project = root.getProject(wizardInput.getProjectName());
	project.create(null);
	project.open(null);		
	IProjectDescription description = project.getDescription();
	description.setNatureIds(new String[] { JavaCore.NATURE_ID });
	project.setDescription(description, null);
	IJavaProject javaProject = JavaCore.create(project); 
	IFolder binFolder = project.getFolder("bin");
	binFolder.create(false, true, null);
	javaProject.setOutputLocation(binFolder.getFullPath(), null);
	List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
	IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
	LibraryLocation[] locations = JavaRuntime.getLibraryLocations(vmInstall);
	for (LibraryLocation element : locations) {
	 entries.add(JavaCore.newLibraryEntry(element.getSystemLibraryPath(), null, null));
	}
	InputStream is = new BufferedInputStream(new FileInputStream(wizardInput.getSootPath().toOSString()));
    IFile jarFile = project.getFile("soot-trunk.jar");
    jarFile.create(is, false, null);
    IPath path = jarFile.getFullPath();
    entries.add(JavaCore.newLibraryEntry(path, null, null));
	javaProject.setRawClasspath(entries.toArray(new IClasspathEntry[entries.size()]), null);		
	IFolder sourceFolder = project.getFolder("src");
	sourceFolder.create(false, true, null);
	IPackageFragmentRoot root1 = javaProject.getPackageFragmentRoot(sourceFolder);
	IClasspathEntry[] oldEntries = javaProject.getRawClasspath();
	IClasspathEntry[] newEntries = new IClasspathEntry[oldEntries.length + 1];
	System.arraycopy(oldEntries, 0, newEntries, 0, oldEntries.length);
	newEntries[oldEntries.length] = JavaCore.newSourceEntry(root1.getPath());
	javaProject.setRawClasspath(newEntries, null);
	String filepath = sourceFolder.getLocation().toOSString();
	File file = new File(filepath);
	wizardInput.setFile(file);
	try {
		CodeGenerator.generateSource(wizardInput);
	} catch (JClassAlreadyExistsException e) {
		e.printStackTrace();
	}
	sourceFolder.refreshLocal(1, null);
	javaProject.open(null);
	return javaProject;
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:54,代码来源:ProjectGenerator.java

示例3: fullBuild

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
protected void fullBuild(IProgressMonitor monitor) throws CoreException{
	Visuflow.getDefault().getLogger().info("Build Start");
	String targetFolder = "sootOutput";
	IJavaProject project = JavaCore.create(getProject());
	IResourceDelta delta = getDelta(project.getProject());
	if (delta == null || !delta.getAffectedChildren()[0].getProjectRelativePath().toString().equals(targetFolder)) {
		classpath = getSootCP(project);
		String location = GlobalSettings.get("Target_Path");
		IFolder folder = project.getProject().getFolder(targetFolder);

		// at this point, no resources have been created
		if (!folder.exists()) {
			// Changed to force because of bug id vis-119
			folder.create(IResource.FORCE, true, monitor);

		} else {
			for (IResource resource : folder.members()) {
				resource.delete(IResource.FORCE, monitor);
			}
		}
		classpath = location + classpath;
		String[] sootString = new String[] { "-cp", classpath, "-exclude", "javax", "-allow-phantom-refs", "-no-bodies-for-excluded", "-process-dir",
				location, "-src-prec", "only-class", "-w", "-output-format", "J", "-keep-line-number", "-output-dir",
				folder.getLocation().toOSString()/* , "tag.ln","on" */ };
		ICFGStructure icfg = new ICFGStructure();
		JimpleModelAnalysis analysis = new JimpleModelAnalysis();
		analysis.setSootString(sootString);
		List<VFClass> jimpleClasses = new ArrayList<>();
		try {
			analysis.createICFG(icfg, jimpleClasses);
			fillDataModel(icfg, jimpleClasses);
		} catch(Exception e) {
			logger.error("Couldn't execute analysis", e);
		}

		folder.refreshLocal(IResource.DEPTH_INFINITE, monitor);
	}
}
 
开发者ID:VisuFlow,项目名称:visuflow-plugin,代码行数:39,代码来源:JimpleBuilder.java

示例4: testReferenceDeleted

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 *
 * 01. Class0
 * 02. Class1.field0
 * 03. Class0 -> Class1.field0
 * 04. delete Class1
 * 05. Class0 -> Class1 import and Class1.field0 should get error marker
 * 06. recreate Class1 file
 * 07. Class0 should have no error markers
 */
//@formatter:on
@Test
public void testReferenceDeleted() throws Exception {
	logger.info("BuilderParticipantPluginUITest.testReferenceDeleted");
	// create project and test files
	final IProject project = createJSProject("testReferenceBrokenToOtherClassesMethod");
	IFolder folder = configureProjectWithXtext(project);
	IFolder moduleFolder = createFolder(folder, TestFiles.moduleFolder());

	IFile file2 = createTestFile(moduleFolder, "Class1", TestFiles.class1());
	assertMarkers("File2 should have no errors", file2, 0);
	IFile file1 = createTestFile(moduleFolder, "Class0", TestFiles.class0());
	assertMarkers("File1 should have no errors, one unused variable warning", file1, 1);

	// open editors of test files
	IWorkbenchPage page = getActivePage();
	XtextEditor file1XtextEditor = openAndGetXtextEditor(file1, page);
	List<?> errors = getEditorErrors(file1XtextEditor);
	assertEquals("Editor of Class0 should have no errors", 0, errors.size());
	XtextEditor file2XtextEditor = openAndGetXtextEditor(file2, page);
	errors = getEditorErrors(file2XtextEditor);
	assertEquals("Editor of Class1 should have no errors", 0, errors.size());

	file2.delete(true, monitor());
	moduleFolder.refreshLocal(IResource.DEPTH_INFINITE, monitor());
	waitForAutoBuild();
	waitForUpdateEditorJob();

	// check if editor 1 contain error markers
	errors = getEditorErrors(file1XtextEditor);
	// Consequential errors are omitted, so there is no error reported for unknown field, as the receiver is of
	// unknown type
	assertEquals("Content of editor 1 should be broken, because now linking to missing resource", 3, errors.size());

	file2 = createTestFile(folder, "Class1", TestFiles.class1());
	assertMarkers("File2 should have no errors", file2, 0);

	// editor 1 should not contain any error markers anymore
	file2 = createTestFile(moduleFolder, "Class1", TestFiles.class1());
	waitForAutoBuild();
	waitForUpdateEditorJob();

	errors = getEditorErrors(file1XtextEditor);
	assertEquals(
			"Content of editor 1 should be valid again, as Class1 in editor has got the field with name 'field0' again",
			0, errors.size());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:58,代码来源:BuilderParticipantPluginUITest.java

示例5: testSuperClassRenamed

import org.eclipse.core.resources.IFolder; //导入方法依赖的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

示例6: testSuperClassDeleted

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
/**
 *
 * 01. Class0 uses Class1 in require statement and in isa function
 * 02. Class1 is deleted
 * 05. Class0 should get error marker at require statement and at isa function
 * 06. recreate Class1 file
 * 07. Class0 should have no error markers
 *
 */
//@formatter:on
@Test
public void testSuperClassDeleted() throws Exception {
	logger.info("BuilderParticipantPluginUITest.testSuperClassDeleted");
	// create project and test files
	final IProject project = createJSProject("testSuperClassDeleted");
	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.delete(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());
	errors = getEditorErrors(childFileXtextEditor);
	assertEquals("Editor of child should have error markers", 3, errors.size());

	IFile recreatedParentFile = createTestFile(moduleFolder, "Parent", InheritanceTestFiles.Parent());
	assertMarkers("File1 should have no errors", recreatedParentFile, 0);
	waitForUpdateEditorJob();

	errors = getEditorErrors(childFileXtextEditor);
	assertEquals("Editor of child should have no errors", 0, errors.size());
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:51,代码来源:BuilderParticipantPluginUITest.java

示例7: processLocal

import org.eclipse.core.resources.IFolder; //导入方法依赖的package包/类
@Override
public void processLocal ( final IFolder output, final IProgressMonitor parentMonitor ) throws Exception
{
    final IProgressMonitor monitor = new SubProgressMonitor ( parentMonitor, 13 );

    // create context

    final OscarContext ctx = createContext ();

    // generate common content

    new SecurityProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new JdbcUserServiceModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new EventStoragePostgresModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new EventStorageJdbcModuleProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new EventInjectorJdbcProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new EventInjectorPostgresProcessor ( this.app, ctx ).process ( new SubProgressMonitor ( monitor, 1 ) ); // COUNT:1
    new ConnectionProcessor ( this.app, ctx ).process ();
    new ExporterProcessor ( this.app, ctx ).process ();

    // generate based on processors

    final Collection<OscarProcessor> processors = createProcessors ();
    monitor.worked ( 1 ); // COUNT:1
    {
        final SubProgressMonitor subMonitor = new SubProgressMonitor ( monitor, 1 ); // COUNT:1
        subMonitor.beginTask ( "Process application modules", processors.size () );

        for ( final OscarProcessor processor : processors )
        {
            processor.process ( ctx, this.app, subMonitor );
            subMonitor.worked ( 1 );
        }
        subMonitor.done ();
    }

    // generate custom content

    processForContext ( ctx, output, monitor );

    // write out oscar context

    final OscarWriter writer = new OscarWriter ( ctx.getData (), ctx.getIgnoreFields () );
    monitor.worked ( 1 ); // COUNT:1

    final IFile file = output.getFile ( "configuration.oscar" ); //$NON-NLS-1$
    try ( FileOutputStream fos = new FileOutputStream ( file.getRawLocation ().toOSString () ) )
    {
        writer.write ( fos );
    }
    monitor.worked ( 1 ); // COUNT:1

    final IFile jsonFile = output.getFile ( "data.json" ); //$NON-NLS-1$
    try ( final FileOutputStream fos = new FileOutputStream ( jsonFile.getRawLocation ().toOSString () ) )
    {
        OscarWriter.writeData ( ctx.getData (), fos );
    }
    monitor.worked ( 1 ); // COUNT:1

    // write out profile
    new P2ProfileProcessor ( this.app ).process ( output.getLocation ().toFile (), monitor );
    monitor.worked ( 1 ); // COUNT:1

    // refresh
    output.refreshLocal ( IResource.DEPTH_INFINITE, monitor );

    monitor.done ();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:69,代码来源:EquinoxApplicationProcessor.java


注:本文中的org.eclipse.core.resources.IFolder.refreshLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。