From 093682b34262263c43bb3ab621a9cc2d3a67c1d1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Anian=20B=C3=BChler?=
 <anian.buehler@reutlingen-university.de>
Date: Mon, 15 Jul 2024 17:52:10 +0200
Subject: [PATCH] added the reference option to context menue

---
 .../edu/mit/blocks/workspace/ContextMenu.java | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/main/java/edu/mit/blocks/workspace/ContextMenu.java b/src/main/java/edu/mit/blocks/workspace/ContextMenu.java
index bc1adb5..f267321 100644
--- a/src/main/java/edu/mit/blocks/workspace/ContextMenu.java
+++ b/src/main/java/edu/mit/blocks/workspace/ContextMenu.java
@@ -82,6 +82,11 @@ public class ContextMenu extends PopupMenu implements ActionListener {
     	cloneAllItem1.addActionListener(rndBlockMenu);
         addCommentMenu.add(cloneAllItem1);
         
+        refrenceItem = new MenuItem(uiMessageBundle.getString("ardublock.ui.reference"));
+        refrenceItem.setActionCommand(OPEN_REFERENCE);
+        refrenceItem.addActionListener(rndBlockMenu);
+        addCommentMenu.add(refrenceItem);
+        
         addCommentMenuInit = true;
         
     }
@@ -109,6 +114,11 @@ public class ContextMenu extends PopupMenu implements ActionListener {
     	cloneAllItem2.setActionCommand(CLONE_BLOCKS);
     	cloneAllItem2.addActionListener(rndBlockMenu);
     	removeCommentMenu.add(cloneAllItem2);
+    	
+        refrenceItem = new MenuItem(uiMessageBundle.getString("ardublock.ui.reference"));
+        refrenceItem.setActionCommand(OPEN_REFERENCE);
+        refrenceItem.addActionListener(rndBlockMenu);
+        removeCommentMenu.add(refrenceItem);
         
         removeCommentMenuInit = true;
     }
@@ -161,7 +171,6 @@ public class ContextMenu extends PopupMenu implements ActionListener {
         return null;
     }
     
-<<<<<<< d9a986a828726b1e45728775df9d1d8a29dab891
     /**
      * opens reference-file (html) for active block 
      * in standard browser
@@ -360,8 +369,6 @@ public class ContextMenu extends PopupMenu implements ActionListener {
     	}
         return;
     }
-=======
->>>>>>> 96d591de06c7d786793f059145b4f9a934b0675e
 
     public void actionPerformed(ActionEvent a) {
         if (a.getActionCommand() == ARRANGE_ALL_BLOCKS) {
@@ -391,5 +398,11 @@ public class ContextMenu extends PopupMenu implements ActionListener {
                 ((RenderableBlock) activeComponent).cloneMe(false);
             }
         }
+        else if (a.getActionCommand() == OPEN_REFERENCE) {
+        	//notify the renderableblock componenet that lauched the conetxt menu
+            if (activeComponent != null && activeComponent instanceof RenderableBlock) {
+            	createReferenceWindow(((RenderableBlock) activeComponent).getBlock().getGenusName());
+            }
+        }
     }
 }
-- 
GitLab