a toolEntry that call a method [message #144571] |
Tue, 27 July 2004 13:46 |
Eclipse User |
|
|
|
Originally posted by: jerome.lafon.bull.net
Hi,
I need to add a button in my palette, that call a method from an other
object.
So I have created a object "GenerateEntry" that extends ToolEntry and I
have redefined the createTool() method:
public Tool createTool() {
root.generate();
return null;
}
after that I have added generate to the palette:
List entries = new ArrayList();
PaletteGroup controlGroup
GenerateEntry generateEntry=new GenerateEntry("generate", "generate
files", null,null);
entries.add(generate);
controlGroup.addAll(entries);
I can click the toolEntry but it stays pushed and I have an error:
Unhandled event loop exception
Reason:
java.lang.NullPointerException
I think the problem is the return of createTool() but I don't know what
object to return.
thanks for your answers
|
|
|
|
Re: a toolEntry that call a method [message #145452 is a reply to message #145390] |
Thu, 29 July 2004 11:58 |
Eclipse User |
|
|
|
Originally posted by: mastr.arcor.de
Pratik Shah wrote:
> I think what you want is a custom tool. The tool and template entries are
> meant for creating new items (and hence dreateTool() should return a
> CreationTool). If you want your item to just be a button that does
> something (as opposed to an item that can be created by dragging and
> dropping on the diagram), you'd be better off creating your own tool. And
> then you could do whatever you want in activate() or handleButtonDown() or
> some such method.
I have to invent a palette tool myself, too.
Are there any examples/tutorials for creating own palette tools? The GEF
API is not very meaningful.
Thanks,
Martin.
|
|
|
Re: a toolEntry that call a method [message #145546 is a reply to message #144571] |
Thu, 29 July 2004 17:05 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
Are you talking about putting a generic action in the palette? This is not
the intended use of the palette and is not supported. You could try to fake
it by placing a bogus tool in the palette, and doing something when it is
activated and the restoring the previous tool.
"jerome lafon" <jerome.lafon@bull.net> wrote in message
news:41065CBB.33A3800D@bull.net...
> Hi,
> I need to add a button in my palette, that call a method from an other
> object.
> So I have created a object "GenerateEntry" that extends ToolEntry and I
> have redefined the createTool() method:
> public Tool createTool() {
> root.generate();
> return null;
> }
>
> after that I have added generate to the palette:
> List entries = new ArrayList();
> PaletteGroup controlGroup
> GenerateEntry generateEntry=new GenerateEntry("generate", "generate
> files", null,null);
> entries.add(generate);
> controlGroup.addAll(entries);
>
> I can click the toolEntry but it stays pushed and I have an error:
> Unhandled event loop exception
> Reason:
> java.lang.NullPointerException
>
> I think the problem is the return of createTool() but I don't know what
> object to return.
>
> thanks for your answers
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04139 seconds