當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。