Hi, this is the patch to get the Separator-Button in the MenuEditor working.
Mainly these two lines caused the problem:
// separator.setTransferHandler(new SeparatorTransferHandler());
// separator.addMouseListener(new SeparatorMouseListener());
The attached patch file can patch the current version "MenuEditor 0.4" to version 0.5
Greets!
Daniel Brüßler
current version "MenuEditor 0.4" to version 0.5
For me, the separator button is working as-is, without your changes - both click and drag & drop are working. Can you describe what is the behavior that you see?
My OS: Ubuntu 8.04
Java version: JDK 1.6.0_20 (openjdk)
In the original version the button didn't do anything. It didn't insert the separator when I clicked on it - not at the end and not after a selection.
I didn't try to move the box by drag&drop into the left one because it's a button and buttons are to click on it. I didn't get that idea.
So it behaved: The mouse pointer changed for a short (a part of a second) when I clicked on the button. It showed a special cursor what looked like a forbiden symbol.
I don't see that cursor in the class java.awt.Cursor, but to show you how it looks see http://de.fotolia.com/id/19819841
I also get this "forbidden" (or "no entrance") icon when I press the button. But this does not prevent me from releasing the mouse button (and then the separator is appended to the list) or dragging it to the list of menu items and dropping it where I like.
This icon is shown due to the "drag & drop" - currently the drop is only enabled on the list of items, you cannot drop anywhere else. But the mouse listener is the one that appends the separator to the end when you release the mouse button (even though the strange icon was shown when the mouse button was down).
If it doesn't work for you, then either it behaves differently on mac (on other OSs it works fine), or you don't have the latest trunk version.
Sorry, ignore my comment about mac. You wrote you use OpenJDK, I've never tried it with OpenJDK and as far as I know jEdit does not officially support it.
I installed the plugin using the jEdit PluginManager. Version 0.4 - can you make a diff between the official version 0.4 and the SVN trunk version?
Is there a known error in openjdk/Swing what's not in the sun jdk? Until now I thought that it's well tested.
It might be a timing problem in the Linux version of the JDK, maybe the click-event is in conflict with the drag-and-drop event and so Swing "thinks" I want to drag and drop the button to the button. ;-)
Now I switched back to the 0.4 version and see that the drag-and-drop feature of the button does work.
But that's really a "hidden feature" ;-) A button is a button.
The "drag & drop" feature of the separator is more important for me than the click, since usually you'd want to place the separator in a specific place in the menu and not just append it. The reason I also added the "click to append" capability (that's actually the only reason for it to be a button) is that drag & drop is difficult to use for some people, who have a problem with delicate movements of the mouse. This is also the reason I added the buttons to move items from one list to the other - as these can also be dragged.
About OpenJDK, see here: http://jedit.org/index.php?page=compatibility
Finally, I also didn't like the button idea, but couldn't think of a better way to present an object that can both be dragged and clicked. If you have an idea how to do it better, let me know. One option would be to add it to the list on the right, so it can be added by dragging or one of the other buttons. But that would make it less visible for users (I think).
MenuEditor Separator proposal2
Hey Shlomy,
I added a screenshot, how I would find it good. In the actions list of the right menu you see the separator "-" with the label
menu-editor.separator=---- Separator ----
from MenuEditor.props. There's no problem to have the MenuElement with a label for this element in the menu list, it works.
So the separator from the actions list is usable for drag'n'drop and the Button is just a Button how users expect it. :-)
I think that would be okay. And then there is also no need for the "Add Separator" button since the separator menu item can be used. I'll do that.
That's cool! So I think the user interface looks cleaner also, because it's just a "from right to left".
I have put
allActionsModel.addElement(new MenuElement(menuSeparator, getProp("menu-editor.separator")));
into private void updateActions(String actionSet) - is that a good place?
Can you try the updated version here:
http://community.jedit.org/?q=node/view/4577
and let me know what you think?
works like a charm :-)
using openjdk-6-jdk (1.6.0_20-b02)
I think you can think about a versionn number of 1.0, because the extension is doing what it tells. It just good to test it also on 64bit and with java5.
The fix will be included in the next release.