Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » make a figure not selectable/movable/resizable
make a figure not selectable/movable/resizable [message #56357] Sun, 19 January 2003 22:09 Go to next message
Eclipse UserFriend
Originally posted by: radienssmgs2.hotmail.com

Hi,

I try to make a figure not selectable/movable/resizable but creating a
NullEditPolicy which is a subclass of GraphicalEditPolicy.

This seems to work, since I can no longer click on it and select it. But I
can still select by using the Marquee. How can I REMOVE that functionality?
in other word, user can not select this figure using marquee (but it can
still use to select other figure)?

Thank you.
Re: make a figure not selectable/movable/resizable [message #56433 is a reply to message #56357] Mon, 20 January 2003 09:22 Go to previous messageGo to next message
Manfred Goetz is currently offline Manfred GoetzFriend
Messages: 8
Registered: July 2009
Junior Member
I had the same problem and solved it by overloading
SelectionTool.handleButton:

public class MySelectionTool extends SelectionTool
{
protected boolean handleButtonDown(int button)
{
EditPart ep = getTargetEditPart ();
if (ep instanceof TestEditPart)
return false;
else return super.handleButton(button);
}
}

Now only EditParts not instanceof TestEditPart will be selected.
I think this is rather messy - if someone knows a more beautiful solution,
please tell!
Re: make a figure not selectable/movable/resizable [message #59522 is a reply to message #56433] Wed, 29 January 2003 16:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I think we need to add:

interface EditPart {
....
boolean isSelectable();
....
}

And then change all tools, etc to look at this method. Changing just the
selection tool does not fix the Marquee tool. Fixing the Marquee tool does
not fix KeyboardNavigation, etc.

BTW, if this part appears in the OutlineView, there is no way to prevent the
native tree from selecting it. But, I am pretty sure that such EditParts
would be filtered from an outline.

"Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
news:b0ge6e$fkh$1@rogue.oti.com...
> I had the same problem and solved it by overloading
> SelectionTool.handleButton:
>
> public class MySelectionTool extends SelectionTool
> {
> protected boolean handleButtonDown(int button)
> {
> EditPart ep = getTargetEditPart ();
> if (ep instanceof TestEditPart)
> return false;
> else return super.handleButton(button);
> }
> }
>
> Now only EditParts not instanceof TestEditPart will be selected.
> I think this is rather messy - if someone knows a more beautiful solution,
> please tell!
>
>
Re: make a figure not selectable/movable/resizable [message #59688 is a reply to message #59522] Wed, 29 January 2003 16:58 Go to previous messageGo to next message
Manfred Goetz is currently offline Manfred GoetzFriend
Messages: 8
Registered: July 2009
Junior Member
Yes, that would be much better. :-)

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b18usp$2b2$1@rogue.oti.com...
> I think we need to add:
>
> interface EditPart {
> ...
> boolean isSelectable();
> ...
> }
>
> And then change all tools, etc to look at this method. Changing just the
> selection tool does not fix the Marquee tool. Fixing the Marquee tool
does
> not fix KeyboardNavigation, etc.
>
> BTW, if this part appears in the OutlineView, there is no way to prevent
the
> native tree from selecting it. But, I am pretty sure that such EditParts
> would be filtered from an outline.
>
> "Manfred Goetz" <xgoetz@de.ibm.com> wrote in message
> news:b0ge6e$fkh$1@rogue.oti.com...
> > I had the same problem and solved it by overloading
> > SelectionTool.handleButton:
> >
> > public class MySelectionTool extends SelectionTool
> > {
> > protected boolean handleButtonDown(int button)
> > {
> > EditPart ep = getTargetEditPart ();
> > if (ep instanceof TestEditPart)
> > return false;
> > else return super.handleButton(button);
> > }
> > }
> >
> > Now only EditParts not instanceof TestEditPart will be selected.
> > I think this is rather messy - if someone knows a more beautiful
solution,
> > please tell!
> >
> >
>
>
Re: make a figure not selectable/movable/resizable [message #140032 is a reply to message #59522] Fri, 25 June 2004 13:22 Go to previous message
Eclipse UserFriend
Originally posted by: brian.fernandes.codito.com

"Randy Hudson" <none@us.ibm.com> wrote in message
news:b18usp$2b2$1@rogue.oti.com...
> I think we need to add:
>
> interface EditPart {
> ...
> boolean isSelectable();
> ...
> }
>
> And then change all tools, etc to look at this method. Changing just the
> selection tool does not fix the Marquee tool. Fixing the Marquee tool
does
> not fix KeyboardNavigation, etc.
>
> BTW, if this part appears in the OutlineView, there is no way to prevent
the
> native tree from selecting it. But, I am pretty sure that such EditParts
> would be filtered from an outline.
>
I'm afraid I have this problem -
I have an model A, which cannot exist without a particular child, say model
B. I have 2 separate models, because A can have other children besides B
(but it MUST have B).
I don't want B to be selectable, because all it's properties are defined by
A. Also, selecting B seperately from A is slightly confusing for someone who
knows the relationship between the two models.

I have achieved this in the Editor by having isSelectable return false.
However, the outline view still allows me to select B. I do need to show B
in the outline view - because it might have children of it's own, and it's
parent A might have other children besides B.

As you mentioned above, selecting it in the outline view selects it in the
graph. Can you suggest anything I can do to prevent this from happening ?
Obviously, I don't mind not being able to select B in the outline view
either.

Thanks,
Brian.
Previous Topic:rededifing key function in eclipse
Next Topic:Drawing a CheckBox on a paletteViewer
Goto Forum:
  


Current Time: Fri Apr 26 07:06:26 GMT 2024

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

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

Back to the top