Skip to main content



      Home
Home » Modeling » Graphiti » Adding function to the palette?
Adding function to the palette? [message #909658] Fri, 07 September 2012 10:10 Go to next message
Eclipse UserFriend
Hello,

i would like to add a function to the palette that does not create a new object.
I.e if i click on an entry a function should start which will open a messagedialog or something like that.

if someone could give me an advice what to do, i'd appreciate that.

Thanks in advance.
Re: Adding function to the palette? [message #909710 is a reply to message #909658] Fri, 07 September 2012 12:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi.
This should work:
	
((DiagramEditor)getDiagramEditor()).getEditDomain().getPaletteViewer().addPaletteListener(new PaletteListener() {
			
			@Override
			public void activeToolChanged(PaletteViewer palette, ToolEntry tool) {
				System.out.println("Tool Changed");
                               //You can put here the code to analyse if the tool clicked is the one you want
                               //and call whatever you want
				
			}
		});

You will need to create some cancreate and create methods on create feature.

Hope it helps.
Re: Adding function to the palette? [message #910024 is a reply to message #909710] Sat, 08 September 2012 07:59 Go to previous messageGo to next message
Eclipse UserFriend
hi,

i really dont know the use case, but it would perhaps be nice/a cleaner solution, when the graphiti framework would provide a ICustomToolEntry --|> IToolEntry interface with an execute() method which is honored by the framework.

therefore, an bugzilla enhancement request would be nice.
Re: Adding function to the palette? [message #910116 is a reply to message #910024] Sat, 08 September 2012 14:24 Go to previous messageGo to next message
Eclipse UserFriend
I really don't know if it makes sense, since the expected palette behaviour is usually to provide a set of tools to create something within the diagram. I think when user clicks palette he is not expecting dialogs or something else for something that is not related to the diagram itself. For that you have coolbars, platform actions, ..etc.

That's why I suggested this "hack", otherwise, yes , i would suggest something like that (specialized entry), if it is possible.

But, I don't consider myself an expert at all, and maybe someone else could find it useful.



Re: Adding function to the palette? [message #910675 is a reply to message #910116] Mon, 10 September 2012 03:44 Go to previous message
Eclipse UserFriend
+1

The palette is intended to be used for new object creation, not for
providing custom functionality.

Another "hack" would be to implement open the functionality (opening the
popup and whatever you want to trigger) simply from inside a create feature.

Michael
Previous Topic:ChopBoxAnchor vs. BoxRelativeAnchor
Next Topic:What PictogramsElement#active means?
Goto Forum:
  


Current Time: Wed Jul 23 20:46:00 EDT 2025

Powered by FUDForum. Page generated in 0.04410 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top