Download

Online

Gallery

Blog

  Index  | Recent Threads  | List Attachments  | Search
 Welcome Guest  |  Register  |  Login
Login Name  Password
 

Sweet Home 3D Forum



No member browsing this thread
Thread Status: Active
Total posts in this thread: 9
[ Jump to Last Post ]
Post new Thread
Author
Previous Thread This topic has been viewed 5040 times and has 8 replies Next Thread
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
confused Plugin Menus

Is it possible to create plugin functions that appear in the 'right click' menu instead of the main menu at the top? If it is not possible then that is fine and I can work around that but it would make for a friendlier user interface.
[Oct 15, 2013, 6:49:13 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

The JPopupMenu contextual menus are accessible through the getComponentPopupMenu method of the Swing views. So, it should be possible to modify them directly if needed.
For example, the following call will return the contextual menu of the 3D view:
((JComponent)getHomeController().getHomeController3D().getView()).getComponentPopupMenu()

----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Oct 17, 2013, 9:53:11 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

Thank you so much for your reply. The process you described seems to work but I can only get the menu to appear in the 3D model of the house. When I change getHomeController3D() to getPlanController() a JPopupMenu does not get returned.
[Oct 23, 2013, 1:21:13 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

BUMP
[Nov 12, 2013, 6:23:37 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

I'm guessing that the planController gets filled upon a click event so I was wondering how I might add to the plancontroller popup menu without creating a new list.
[Nov 12, 2013, 6:25:30 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

Exploring the code yourself would have given you the answer.
In the current version, the view of the plan is an instance of MultipleLevelsPlanPanel class. Exploring the childs of this object will let you find the final PlanComponent that stores the popup menu.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 13, 2013, 6:20:41 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

I am still confused on how (without changing the source code) I am to access the current popupmenu with a plugin. The code that you linked me to had no @override get call for the popup menu (it has a set). I want to pull the current menu and concatenate onto the end some of my own options so i need to be able to pull the current menu first. Could you possibly elaborate more on how to do this please.
[Nov 14, 2013, 2:07:03 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Puybaret
Expert
Member's Avatar

France
Joined: Nov 7, 2005
Post Count: 9141
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

The contextual menu is attached to the PlanComponent instance, and you can find that instance with the static method findChildren in SwingTools class.
By the way, it would be nice to explain the kind of plug-in you want to develop.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D developer
[Nov 25, 2013, 9:54:18 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Cong
Newbie




Joined: Oct 15, 2013
Post Count: 6
Status: Offline
Reply to this Post  Reply with Quote 
Re: Plugin Menus

Thank you so much for your help. I have successfully added a few custom options to the JPopupMenu using the method you described in your last post.
[Nov 28, 2013, 12:59:20 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
[ Jump to Last Post ]
Show Printable Version of Thread  Post new Thread

    Get Sweet Home 3D at SourceForge.net. Fast, secure and Free Open Source software downloads
   
© Copyright 2006-2024 eTeks - All rights reserved