[#2009] Check for unmodified component earlier on
This commit is contained in:
		
							parent
							
								
									a7e094311b
								
							
						
					
					
						commit
						58a32c41f0
					
				| @ -276,16 +276,18 @@ public class RocketComponentConfig extends JPanel { | |||||||
| 		cancelButton.addActionListener(new ActionListener() { | 		cancelButton.addActionListener(new ActionListener() { | ||||||
| 			@Override | 			@Override | ||||||
| 			public void actionPerformed(ActionEvent arg0) { | 			public void actionPerformed(ActionEvent arg0) { | ||||||
|  | 				// Don't do anything on cancel if you are editing an existing component, and it is not modified | ||||||
|  | 				if (!isNewComponent && parent != null && !parent.isModified()) { | ||||||
|  | 					ComponentConfigDialog.disposeDialog(); | ||||||
|  | 					return; | ||||||
|  | 				} | ||||||
|  | 				// Apply the cancel operation if set to auto discard in preferences | ||||||
| 				if (preferences.getBoolean(IGNORE_DISCARD_EDITING_WARNING, false)) { | 				if (preferences.getBoolean(IGNORE_DISCARD_EDITING_WARNING, false)) { | ||||||
| 					ComponentConfigDialog.clearConfigListeners = false;		// Undo action => config listeners of new component will be cleared | 					ComponentConfigDialog.clearConfigListeners = false;		// Undo action => config listeners of new component will be cleared | ||||||
| 					ComponentConfigDialog.disposeDialog(); | 					ComponentConfigDialog.disposeDialog(); | ||||||
| 					document.undo(); | 					document.undo(); | ||||||
| 					return; | 					return; | ||||||
| 				} | 				} | ||||||
| 				if (!isNewComponent && parent != null && !parent.isModified()) { |  | ||||||
| 					ComponentConfigDialog.disposeDialog(); |  | ||||||
| 					return; |  | ||||||
| 				} |  | ||||||
| 
 | 
 | ||||||
| 				// Yes/No dialog: Are you sure you want to discard your changes? | 				// Yes/No dialog: Are you sure you want to discard your changes? | ||||||
| 				JPanel msg = createCancelOperationContent(); | 				JPanel msg = createCancelOperationContent(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user