Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Saving of a resource and modifying the same after that in xtext(Saving of a resource and modifying the same after that in xtext)
icon5.gif  Saving of a resource and modifying the same after that in xtext [message #1258270] Thu, 27 February 2014 03:17
Eclipse UserFriend
Hi all,
I am doing two operations on a resource which I would explain step wise below:

Step 1: I am adding some content to a resource and then saving it.

Step 2: After this I am passing my resource to some other method as input. But this method needs updated saved resource from step 1. But execution happens so quickly that this method is not getting the updated resource.

The code looks like:
resource.getContents().add(model);
    try {
        resource.save(Collections.EMPTY_MAP);
	} catch (IOException e) {
	e.printStackTrace();
	}
			

model.getMyObjs.addAll(readExcel(excelFile, resource).getEntriesList());


readExcel method is not getting the saved resource But if I add Thread.Sleep(milSec) then it works fine. Then code would look like:

resource.getContents().add(model);
    try {
        resource.save(Collections.EMPTY_MAP);
	} catch (IOException e) {
	e.printStackTrace();
	}

    try {
	Thread.sleep(3000);
	} catch (InterruptedException e1) {
	e1.printStackTrace();
        }
			

model.getMyObjs.addAll(readExcel(excelFile, resource).getEntriesList());


Its just a work around. How can I avoid this problem? How to wait until a resource is saved/loaded completely?
Please suggest some ideas.

Thanks in advance Smile



Previous Topic:How can I add sourceDir to xtext-maven-plugin
Next Topic:How to Add xtext 2.5.1 Zip to Eclipse to provide xtext nature
Goto Forum:
  


Current Time: Wed Jul 09 08:38:44 EDT 2025

Powered by FUDForum. Page generated in 0.08013 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top