Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 08:17
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
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





Arshad
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 Oct 28 01:48:43 GMT 2020

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

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

Back to the top