Hi Andriy, yes, bundling all changes into a single IChange will definitely be better, and will make sure you can undo/redo them as atomic operation.
Holger On Dec 3, 2010, at 9:03 PM, Andriy Sokolov wrote: > Hello Holger, > thanks for your quick responce. However, the point is, I want to make > one atomic operation from multiple. If I make so like you recommend, I > have still multiple operations. I think I should collect this > operations and only then execute it in the one single Ichange object. > Or maybe there are any other alternatives based on mechanism of > ChangeEngine possible? > > Andriy > > On 1 Dez., 04:10, Holger Knublauch <[email protected]> wrote: >> Hi Andriy, >> >> I am not sure if I understand you correctly, but if multi-threading of >> changes is a problem, you could use the variant of the execute method that >> takes a Runnable as second argument (changeEngine.execute(change, andThen)). >> The andThen Runnable is executed after the change has been processed, and >> you can safely execute the next one at this stage. >> >> Holger >> >> On Dec 1, 2010, at 4:55 AM, Andriy Sokolov wrote: >> >>> ..and a small addition to "[...]the main thread goes on and makes the >>> leftover 3 graph operations DIRECTLY on the graph." >>> Every of this 3 poerations is fired one by one to >>> IChangeEngineListener, however the Change-object contains the very >>> same 5 operations as before. >> >>> Thanks >>> Andriy >> >>> On 30 Nov., 19:36, Andriy Sokolov <[email protected]> wrote: >>>> Hello, TopBraid Suite team! >> >>>> After one half year of working on my project I have discovered that >>>> the ChangeEngine mechanism not working such, how I wanted to use it. >>>> The point is following: i have multiple changes in a batch, and i want >>>> they all to be handled atomically. >>>> Here is the execute()-method of the MyCommand (extends >>>> org.eclipse.gef.commands.Command): >> >>>> if (!TB.getSession().getChangeEngine().isBusy()){ >>>> IChange change = new AbstractChange(changeName) { >>>> @Override >>>> public void execute(ISession arg0, IProgressMonitor arg1) >>>> throws >>>> InterruptedException { >>>> //changes the graph: 4 operations >>>> child.setBounds(constraint); >>>> } >>>> }; >>>> //request for execution >>>> TB.getSession().getChangeEngine().execute(change);} >> >>>> else { >>>> //changes the graph: 4 operations >>>> child.setBounds(constraint); >> >>>> } >> >>>> So, when there are multiple such commands in a batch, the first of >>>> them creates an IChange (Change A) and an execution will be requested. >>>> When the second command runs, the direct change (Change B) should be >>>> performed. >>>> But! >>>> From 4 operations of Change B the FIRST operation is fired by jena's >>>> GraphMemBulkUpdateHandler to the GraphTracker, which to >>>> TBCChangeEngine, which to PropertiesTreeView, and PropertiesTreeView >>>> makes the main threed asleep and runs the parallel thread with >>>> TBCChangeEngine, where Change A is executed. After that >>>> TBCChangeEngine fires changes to my IChangeEngineListener, and I see >>>> there Change X = Change A + the first operation of Change B (5 >>>> operations). Then after this thread has finished, the main thread goes >>>> on and makes the leftover 3 ograph operations DIRECTLY on the graph. >> >>>> Therefore the undo/redo is not working and the graphics is 'blinking' >>>> because of multiple updates insteed of only one. >> >>>> I hope you can follow my explanations..Please tell me, how can I fix >>>> this behaviour? >> >>>> Best regards >>>> Andriy >> >>> -- >>> You received this message because you are subscribed to the Google >>> Group "TopBraid Suite Users", the topics of which include TopBraid Composer, >>> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN. >>> To post to this group, send email to >>> [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/topbraid-users?hl=en >> >> > > -- > You received this message because you are subscribed to the Google > Group "TopBraid Suite Users", the topics of which include TopBraid Composer, > TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN. > To post to this group, send email to > [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/topbraid-users?hl=en -- You received this message because you are subscribed to the Google Group "TopBraid Suite Users", the topics of which include TopBraid Composer, TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/topbraid-users?hl=en
