Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Disable palette entry
Disable palette entry [message #124102] Wed, 24 March 2004 16:43 Go to next message
Eclipse UserFriend
Originally posted by: phil.williams.toadmail.com

Is there a way to disable a CombinedTemplateCreationEntry within a GEF
palette. What I am looking for is someway to "grey out" a given tool so
that a user sees that a tool exists, but they can not select or use it
for one reason or another. Currently it looks like the only thing I can
do is call setVisible().

Thanks,
Phil
Re: Disable palette entry [message #124153 is a reply to message #124102] Wed, 24 March 2004 19:03 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
It's not a good idea to call setVisible() for this purpose. While you
cannot disable the entry itself, you can certainly get the figure from the
edit part (ToolEntryEditPart) and disable it.

ToolEntryEditPart's figure is an InactiveToggleButton (inner class).
However, that figure has not been set up to behave properly when disabled.
Once you disable it, the user won't be able to click on it, but it won't
show proper feedback to indicate that it is disabled. So, you might have to
change that class a little bit to disable rollover, change foreground color,
etc. Below is an example of what it might look like. Of course, you can
also do this in a property change listener that you add to that figure.

You should open a feature request to have this supported in GEF.


class InactiveToggleButton extends ToggleButton {
InactiveToggleButton(IFigure contents) {
super(contents);
setOpaque(false);
setEnabled(true);
}
public IFigure findMouseEventTargetAt(int x, int y) {
return null;
}
public IFigure getToolTip() {
return createToolTip();
}
public void setEnabled(boolean value) {
super.setEnabled(value);
if (isEnabled()) {
setRolloverEnabled(true);
setBorder(BORDER_TOGGLE);
setForegroundColor(null);
} else {
setRolloverEnabled(false);
setBorder(null);
setForegroundColor(ColorConstants.gray);
}
}
}


"Phil Williams" <phil.williams@toadmail.com> wrote in message
news:c3sdis$74q$1@eclipse.org...
> Is there a way to disable a CombinedTemplateCreationEntry within a GEF
> palette. What I am looking for is someway to "grey out" a given tool so
> that a user sees that a tool exists, but they can not select or use it
> for one reason or another. Currently it looks like the only thing I can
> do is call setVisible().
>
> Thanks,
> Phil
Re: Disable palette entry [message #230715 is a reply to message #124153] Thu, 15 February 2007 12:03 Go to previous message
Eclipse UserFriend
Originally posted by: nicolas.bleyh.misys.com

Pratik Shah schrieb:
> It's not a good idea to call setVisible() for this purpose. While you
> cannot disable the entry itself, you can certainly get the figure from the
> edit part (ToolEntryEditPart) and disable it.
>
> ToolEntryEditPart's figure is an InactiveToggleButton (inner class).
> However, that figure has not been set up to behave properly when disabled.
> Once you disable it, the user won't be able to click on it, but it won't
> show proper feedback to indicate that it is disabled. So, you might have to
> change that class a little bit to disable rollover, change foreground color,
> etc. Below is an example of what it might look like. Of course, you can
> also do this in a property change listener that you add to that figure.
>
> You should open a feature request to have this supported in GEF.
>
>
> class InactiveToggleButton extends ToggleButton {
> InactiveToggleButton(IFigure contents) {
> super(contents);
> setOpaque(false);
> setEnabled(true);
> }
> public IFigure findMouseEventTargetAt(int x, int y) {
> return null;
> }
> public IFigure getToolTip() {
> return createToolTip();
> }
> public void setEnabled(boolean value) {
> super.setEnabled(value);
> if (isEnabled()) {
> setRolloverEnabled(true);
> setBorder(BORDER_TOGGLE);
> setForegroundColor(null);
> } else {
> setRolloverEnabled(false);
> setBorder(null);
> setForegroundColor(ColorConstants.gray);
> }
> }
> }
>
>
> "Phil Williams" <phil.williams@toadmail.com> wrote in message
> news:c3sdis$74q$1@eclipse.org...
>> Is there a way to disable a CombinedTemplateCreationEntry within a GEF
>> palette. What I am looking for is someway to "grey out" a given tool so
>> that a user sees that a tool exists, but they can not select or use it
>> for one reason or another. Currently it looks like the only thing I can
>> do is call setVisible().
>>
>> Thanks,
>> Phil
>
>
And how do I get the ToolEntryEditPart from a CombinedTemplateCreationEntry?
Thanks,
Nick
Previous Topic:Draw2D events
Next Topic:Why are PaletteEntries disabled?
Goto Forum:
  


Current Time: Fri Apr 19 16:22:41 GMT 2024

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

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

Back to the top