[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jedit-cvs
Subject:    [ jEdit-commits ] SF.net SVN: jedit: [9029] jEdit/trunk
From:       kpouer () users ! sourceforge ! net
Date:       2007-02-27 8:08:51
Message-ID: E1HLxOF-0000Bt-Jf () sc8-pr-svn4 ! sourceforge ! net
[Download RAW message or body]

Revision: 9029
          http://svn.sourceforge.net/jedit/?rev=9029&view=rev
Author:   kpouer
Date:     2007-02-27 00:08:51 -0800 (Tue, 27 Feb 2007)

Log Message:
-----------
New popup menu in Register dockable panel

Modified Paths:
--------------
    jEdit/trunk/doc/CHANGES.txt
    jEdit/trunk/org/gjt/sp/jedit/gui/RegisterViewer.java

Modified: jEdit/trunk/doc/CHANGES.txt
===================================================================
--- jEdit/trunk/doc/CHANGES.txt	2007-02-27 07:55:45 UTC (rev 9028)
+++ jEdit/trunk/doc/CHANGES.txt	2007-02-27 08:08:51 UTC (rev 9029)
@@ -93,6 +93,7 @@
 - New LayoutManager ExtendedGridLayout added. For further explanations see
   its JavaDoc. (Bj\xF6rn "Vampire" Kautler)
 
+- New popup menu in Register dockable panel (Matthieu Casanova)
 }}}
 
 {{{ Editing

Modified: jEdit/trunk/org/gjt/sp/jedit/gui/RegisterViewer.java
===================================================================
--- jEdit/trunk/org/gjt/sp/jedit/gui/RegisterViewer.java	2007-02-27 07:55:45 UTC (rev \
                9028)
+++ jEdit/trunk/org/gjt/sp/jedit/gui/RegisterViewer.java	2007-02-27 08:08:51 UTC (rev \
9029) @@ -100,18 +100,9 @@
 		if (cmd.equals("paste-string-register"))
 			insertRegister();
 		else if (cmd.equals("clear-string-register"))
-		{
-			Object o = registerList.getSelectedValue();
-			if (o == null)
-				return;
-			else if (o instanceof Character)
-			{
-				Registers.clearRegister(((Character)o).charValue());
-				refreshList();
-			}
-		}
+			clearSelectedIndex();
 	} //}}}
-	
+
 	//{{{ handleMessage
 	public void handleMessage(EBMessage msg)
 	{
@@ -143,6 +134,17 @@
 
 	//{{{ Private members
 
+	//{{{ clearSelectedIndex() method
+	private void clearSelectedIndex()
+	{
+		Object o = registerList.getSelectedValue();
+		if (o != null && o instanceof Character)
+		{
+			Registers.clearRegister(((Character)o).charValue());
+			refreshList();
+		}
+	} //}}}
+
 	//{{{ Instance variables
 	private JList registerList;
 	private JTextArea contentTextArea;
@@ -150,6 +152,7 @@
 	private View view;
 	private boolean editing;
 	private JSplitPane splitPane;
+	private JPopupMenu popup;
 	//}}}
 
 	//{{{ refreshList
@@ -268,6 +271,7 @@
 			}
 
 			return this;
+
 		}
 	} //}}}
 
@@ -292,18 +296,31 @@
 	//{{{ MouseHandler Class
 	class MouseHandler extends MouseAdapter
 	{
-		/*public void mousePressed(MouseEvent evt)
-		{
-			if(evt.isConsumed())
-				return;
-			int index = registerList.locationToIndex(
-				evt.getPoint());
-			registerList.setSelectedIndex(index);
-		} */
-
 		public void mouseClicked(MouseEvent evt)
 		{
-			if (evt.getClickCount() % 2 == 0)
+			int i = registerList.locationToIndex(evt.getPoint());
+			if (i != -1)
+				registerList.setSelectedIndex(i);
+			if (GUIUtilities.isPopupTrigger(evt))
+			{
+				if (popup == null)
+				{
+					popup = new JPopupMenu();
+					JMenuItem item = GUIUtilities.loadMenuItem("paste");
+					popup.add(item);
+					item = new JMenuItem(jEdit.getProperty("clear-string-register.label"));
+					item.addActionListener(new ActionListener()
+					{
+						public void actionPerformed(ActionEvent e)
+						{
+							clearSelectedIndex();
+						}
+					});
+					popup.add(item);
+				}
+				GUIUtilities.showPopupMenu(popup, registerList, evt.getX(), evt.getY(), false);
+			}
+			else if (evt.getClickCount() % 2 == 0)
 				insertRegister();
 		}
 	} //}}}


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
jEdit-CVS mailing list
jEdit-CVS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jedit-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic