Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Adding function to the palette?
Adding function to the palette? [message #909658] Fri, 07 September 2012 14:10 Go to next message
Jens B is currently offline Jens BFriend
Messages: 2
Registered: September 2012
Junior Member
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 16:22 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
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 11:59 Go to previous messageGo to next message
Aljoscha Hark is currently offline Aljoscha HarkFriend
Messages: 24
Registered: March 2012
Junior Member
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 18:24 Go to previous messageGo to next message
Rui Domingues is currently offline Rui DominguesFriend
Messages: 194
Registered: October 2010
Senior Member
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 07:44 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
+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: Thu Apr 25 08:52:08 GMT 2024

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

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

Back to the top