| a toolEntry that call a method [message #144571] |
Tue, 27 July 2004 09: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 #145546 is a reply to message #144571] |
Thu, 29 July 2004 13: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.03787 seconds