From 2be0a486a6a0302d06d30ef05e4821b44dd48a23 Mon Sep 17 00:00:00 2001
From: Fabien Tessier <fabien.tessier@telecom-paristech.fr>
Date: Fri, 17 Nov 2017 11:07:53 +0100
Subject: [PATCH] Issue #99: Delete on selected components sometimes fails

---
 src/main/java/ui/TDiagramMouseManager.java | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/main/java/ui/TDiagramMouseManager.java b/src/main/java/ui/TDiagramMouseManager.java
index eecb4575e9..c2f7f30852 100755
--- a/src/main/java/ui/TDiagramMouseManager.java
+++ b/src/main/java/ui/TDiagramMouseManager.java
@@ -133,6 +133,7 @@ public class TDiagramMouseManager extends MouseAdapter {//implements MouseListen
                 tdp.mode = TDiagramPanel.SELECTING_COMPONENTS;
                 tdp.setSelectingComponents(e.getX(), e.getY());
             }  else {
+            	tdp.mgui.actions[TGUIAction.ACT_DELETE].setEnabled(true);
                 // Resize, move, or make a connector
                 if (tgc.isUserResizable() && ((resizeInfo=tgc.getResizeZone(e.getX(), e.getY())) != 0)) {
                     actionMade = true;
@@ -466,6 +467,10 @@ public class TDiagramMouseManager extends MouseAdapter {//implements MouseListen
         //If one click is done for selection
         if ((selected == TGComponentManager.EDIT) && (e.getClickCount() == 1) && (e.getButton() == MouseEvent.BUTTON1)) {
         	setSelection(e.getX(), e.getY());
+        	if (tdp.select)
+        		tdp.mgui.actions[TGUIAction.ACT_DELETE].setEnabled(true);
+        	else
+        		tdp.mgui.actions[TGUIAction.ACT_DELETE].setEnabled(false);
         }
     }
 
-- 
GitLab