Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » speacialized toolentry
speacialized toolentry [message #188322] Tue, 19 July 2005 18:53 Go to next message
Eclipse UserFriend
Originally posted by: tiagoneves.hotmail.com

Hello,

i am trying to create a toolentry that doesn't create any object, it just
works as a value for other toolentrys to use. (I know this is not the
objective of the toolentrys, but i am a speacialist of what we portuguese
people normally call "Martelada" (workaround)).

For this i have extended the toolEntry to create MyToolEntry.

I have also created a MyTool that extends the AbstractTool to be used as
toolclass for mytoolEntry.

My problem is, i have several instances of MytoolEntry with different
values, how can i make Mytool have different behaviors according to the
MytoolEntry that is currently selected.

Thanks in advance,

Tiago Neves
Re: specialized toolentry [message #188388 is a reply to message #188322] Wed, 20 July 2005 13:07 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tiagoneves.hotmail.com

Specifics:

in the pallete i do something like this:

PaletteDrawer myDrawer = ...
PaletteStack myStack
//One Value
MyToolEntry myToolEntry = new MyToolEntry("Value", "The current value",
int mYvalue1);

myStack.add(myToolEntry);

//Another value
myToolEntry = new MyToolEntry("Value 2", "The current value", int
myValue2);

myStack.add(myToolEntry);

myDrawer.add(myStack);

in MyToolEntry i do Something like this:

MyToolEntry extends ToolEntry {

public MyToolEntry(String label, String shortDesc, int myValue) {
super(label, shortDesc, SharedImages.MY_TOOL_16,
SharedImages.MY_TOOL_24, MyTool.class);

}


This way i intend the toolentry to indicate values that other toolentrys
are going to use.

My problem is that MyTool that is used in the contructor of MyToolEntry
doesn't have any access to myValue so, in the activate method of MyTool i
always execute the same code.

Question:
Do i need to create different Tools to achieve what i need or, there is
any way to provide MyTool access to myValue.

Thanks

Tiago Neves
Re: specialized toolentry [message #188485 is a reply to message #188388] Wed, 20 July 2005 20:31 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I'll try to "dar um jeitinho". First, I think that if the tool is active,
and the user changes the current value in the palette, the tool needs to
respond to that. So, you probably need to put some observable property
somewhere like on your EditDomain, and have the tool initialize using its
current value, and listen to the value for any changes while the tool is
active. The PaletteStack would have to set that property as the top entry
is changed.

If you don't think you need to respond to changes while the tool is active I
would have another suggestiong.
Re: specialized toolentry [message #188497 is a reply to message #188388] Wed, 20 July 2005 20:39 Go to previous message
Eclipse UserFriend
Originally posted by: none.unknown.com

The way you want to implement this currently is not a good idea. There are
several other approaches available to you. One is to implement this value
as a property of the tool entry and customizable in the Customize dialog. I
am not sure exactly what these tools are and how they use these values, but
creating a separate tool for each of the values might also be viable. We do
this in the logic example, where three different types of marquee tools are
stacked. Names, descriptions and tooltips can be used to clarify the
difference.

"Tiago Neves" <tiagoneves@hotmail.com> wrote in message
news:f2650ee508b2c99f78b436ae247f82fd$1@www.eclipse.org...
> Specifics:
>
> in the pallete i do something like this:
>
> PaletteDrawer myDrawer = ...
> PaletteStack myStack
> //One Value
> MyToolEntry myToolEntry = new MyToolEntry("Value", "The current value",
> int mYvalue1);
>
> myStack.add(myToolEntry);
>
> //Another value
> myToolEntry = new MyToolEntry("Value 2", "The current value", int
> myValue2);
>
> myStack.add(myToolEntry);
>
> myDrawer.add(myStack);
>
> in MyToolEntry i do Something like this:
>
> MyToolEntry extends ToolEntry {
>
> public MyToolEntry(String label, String shortDesc, int myValue) {
> super(label, shortDesc, SharedImages.MY_TOOL_16,
> SharedImages.MY_TOOL_24, MyTool.class);
>
> }
>
>
> This way i intend the toolentry to indicate values that other toolentrys
> are going to use.
>
> My problem is that MyTool that is used in the contructor of MyToolEntry
> doesn't have any access to myValue so, in the activate method of MyTool i
> always execute the same code.
>
> Question:
> Do i need to create different Tools to achieve what i need or, there is
> any way to provide MyTool access to myValue.
>
> Thanks
>
> Tiago Neves
>
Previous Topic:Polygon Handles
Next Topic:Modifying GEF examples
Goto Forum:
  


Current Time: Fri Dec 13 03:01:31 GMT 2024

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

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

Back to the top