Project

General

Profile

« Previous | Next » 

Revision 6da59e5d

Added by Patrick Plitzner about 8 years ago

Fix editing of transient entities in EntitySelectionElement #5592

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/selection/EntitySelectionElement.java
421 421
		/** {@inheritDoc} */
422 422
		@Override
423 423
		public void widgetSelected(SelectionEvent e) {
424

  
425
	        IService<T> service = CdmStore.getService(entity);
426
	        T loadedEntity = service.load(entity.getUuid());
427
            if (loadedEntity==null){
428
	            MessageDialog.openInformation(null,"Save changes", "You have made changes that must be saved before this query can be executed");
429
	            return;
430
	        }
431 424
			WizardDialog dialog = new WizardDialog(selectionElement.getShell(),
432 425
					new EditFromSelectionWizard(selectionElement));
433 426
			if (dialog.open() == IStatus.OK) {
434

  
435 427
				selectionElement.updateFromWizard();
428
				//if the edited entity has already been persisted
429
				//but the transient entity is still set in this 
430
				//EntitySelectionElement, re-load it and set it
431
				IService<T> service = CdmStore.getService(entity);
432
				if(entity.getId()==0){
433
					T loadedEntity = service.load(entity.getUuid());
434
					if(loadedEntity!=null){
435
						setEntity(loadedEntity);
436
					}
437
				}
436 438
			}
437 439
		}
438 440
	}

Also available in: Unified diff