palette question [message #149120] |
Tue, 31 August 2004 05:28 |
Eclipse User |
|
|
|
Originally posted by: myoracle.hotmail.com
I have got a palette with a PaletteDrawer which has ten children .
Each child is an object of MyToolEntry which is defined as follows:
class MyToolEntry extends ToolEntry {
public MyToolEntry(
String label,
String shortDesc,
ImageDescriptor iconSmall,
ImageDescriptor iconLarge) {
super(label, shortDesc, iconSmall, iconLarge);
}
public Tool createTool() {
// TODO Auto-generated method stub
return new MyTool();
}
}
and the "MyTool" class is extened from TargetingTool.
All is fine but...where is my action?
I want to make an action which is defined myself(e.g.
System.out.println("welcome");) when i press a MyToolEntry object in the
palette,but nothing happend,and it seems that the method
"mouseDown(MouseEvent e, EditPartViewer viewer)" defined in TargetingTool
does not work.
How and where could i make my action?
|
|
|
Re: palette question [message #149775 is a reply to message #149120] |
Thu, 02 September 2004 19:21 |
Pratik Shah Messages: 1077 Registered: July 2009 |
Senior Member |
|
|
When you click on your tool in the palette, the edit domain unloads the
current tool and loads the selected tool. Then, when you go over to the
editor and click somewhere, that's when your tool's mouseDown() will be
invoked.
If you want your tool to perform some action when clicked, instead of
allowing the user to create something on the diagram interactively, you
could probably do it in the activate() method. You don't need a
TargetingTool for that either.
"spool" <myoracle@hotmail.com> wrote in message
news:ch12ae$o32$1@eclipse.org...
> I have got a palette with a PaletteDrawer which has ten children .
> Each child is an object of MyToolEntry which is defined as follows:
> class MyToolEntry extends ToolEntry {
> public MyToolEntry(
> String label,
> String shortDesc,
> ImageDescriptor iconSmall,
> ImageDescriptor iconLarge) {
>
> super(label, shortDesc, iconSmall, iconLarge);
>
> }
> public Tool createTool() {
> // TODO Auto-generated method stub
> return new MyTool();
> }
> }
> and the "MyTool" class is extened from TargetingTool.
> All is fine but...where is my action?
> I want to make an action which is defined myself(e.g.
> System.out.println("welcome");) when i press a MyToolEntry object in the
> palette,but nothing happend,and it seems that the method
> "mouseDown(MouseEvent e, EditPartViewer viewer)" defined in TargetingTool
> does not work.
> How and where could i make my action?
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.02405 seconds