[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: newbiew qn: how to add a viewer to the EMF editor plugin

Hi Ed

   With regard to the EMF Transactional Editor...

   If I want to process a long edit in an RCP, can I / should I use the EMF TransactionalEditingDomain.runExclusive() and the Eclipse Jobs API together?  

  That is, should I use something like:

--------------------------------------------------
  final TransactionalEditingDomain domain = getDomain();
  final CommandStack stack = domain.getCommandStack();

  Job job = new Job("My EMF Edit Job") {
  protected IStatus run(IProgressMonitor monitor) {
           
  domain.runExclusive(new RunnableWithResult.Impl() {
          public void run() {

          // notify (other) views 
          //       that EMF model is dirty
          setDirty(true);

          // read data from disk
          Object[] data = readData();

          // modify EMF model objects
          Command cmd = domain.createCommand(
                         SetCommand.class,                          
                          new CommandParameter(...));
          stack.execute(cmd);

                     
          }
        }
        return Status.OK_STATUS;
   }
     };

  job.schedule(); 


--------------------------------------------------
  Thanks

  Charles


  BTW, I would post some this basic EMF/RCP question on the new javalobby page but I am not sure where to post ?  Do you know where the EMF forum went?