Skip to main content



      Home
Home » Eclipse Projects » GEF » preventing resize of ghost
preventing resize of ghost [message #122225] Sun, 14 March 2004 21:43 Go to next message
Eclipse UserFriend
My GEF-based application successfully disallows resizing of parts but when a
part is selected, the resize handles still appear and they can be dragged
with the ghost being correspondingly resized.

When the button is released, the actual figure remains the same size. But
I'm wondering how I can prevent the selection handles from being draggable.

I have two edit parts, the overall DiagramPart and the individual NodeParts.

DiagramPart has a single policy in the LAYOUT_ROLE which implements
createChangeConstraintCommand (to handle moving) and getCreateCommand (to
handle creation from palette)

NodePart has a policy in the COMPONENT_ROLE which implements
createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
getDirectEditCommand.

Any help would be greatly appreciated.

James
Re: preventing resize of ghost [message #122300 is a reply to message #122225] Mon, 15 March 2004 06:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

James Tauber <jtauber@jtauber.com> wrote:

Just quick idea - use NonresizableEditPolicy.

> My GEF-based application successfully disallows resizing of parts but when a
> part is selected, the resize handles still appear and they can be dragged
> with the ghost being correspondingly resized.

> When the button is released, the actual figure remains the same size. But
> I'm wondering how I can prevent the selection handles from being draggable.

> I have two edit parts, the overall DiagramPart and the individual NodeParts.

> DiagramPart has a single policy in the LAYOUT_ROLE which implements
> createChangeConstraintCommand (to handle moving) and getCreateCommand (to
> handle creation from palette)

> NodePart has a policy in the COMPONENT_ROLE which implements
> createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
> getDirectEditCommand.

> Any help would be greatly appreciated.

> James



--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: preventing resize of ghost [message #122533 is a reply to message #122300] Mon, 15 March 2004 13:57 Go to previous messageGo to next message
Eclipse UserFriend
"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:snkcT0nCEHA.3404@fairy.ao.nlmk...
> James Tauber <jtauber@jtauber.com> wrote:
>
> Just quick idea - use NonresizableEditPolicy.

On which part and in which role? I've tried a few combinations and it
doesn't change the behaviour.

> > My GEF-based application successfully disallows resizing of parts but
when a
> > part is selected, the resize handles still appear and they can be
dragged
> > with the ghost being correspondingly resized.
>
> > When the button is released, the actual figure remains the same size.
But
> > I'm wondering how I can prevent the selection handles from being
draggable.
>
> > I have two edit parts, the overall DiagramPart and the individual
NodeParts.
>
> > DiagramPart has a single policy in the LAYOUT_ROLE which implements
> > createChangeConstraintCommand (to handle moving) and getCreateCommand
(to
> > handle creation from palette)
>
> > NodePart has a policy in the COMPONENT_ROLE which implements
> > createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
> > getDirectEditCommand.
>
> > Any help would be greatly appreciated.
>
> > James
>
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: preventing resize of ghost [message #122622 is a reply to message #122533] Tue, 16 March 2004 09:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: scheglov_ke.nlmk.ru

James Tauber <jtauber@jtauber.com> wrote:

Something like this:
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new NonResizableEditPolicy());
protected void createEditPolicies() {
installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new EmptySelectionEditPolicy());
}
For your part that should not be resized.



> "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> news:snkcT0nCEHA.3404@fairy.ao.nlmk...
>> James Tauber <jtauber@jtauber.com> wrote:
>>
>> Just quick idea - use NonresizableEditPolicy.

> On which part and in which role? I've tried a few combinations and it
> doesn't change the behaviour.

>> > My GEF-based application successfully disallows resizing of parts but
> when a
>> > part is selected, the resize handles still appear and they can be
> dragged
>> > with the ghost being correspondingly resized.
>>
>> > When the button is released, the actual figure remains the same size.
> But
>> > I'm wondering how I can prevent the selection handles from being
> draggable.
>>
>> > I have two edit parts, the overall DiagramPart and the individual
> NodeParts.
>>
>> > DiagramPart has a single policy in the LAYOUT_ROLE which implements
>> > createChangeConstraintCommand (to handle moving) and getCreateCommand
> (to
>> > handle creation from palette)
>>
>> > NodePart has a policy in the COMPONENT_ROLE which implements
>> > createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
>> > getDirectEditCommand.
>>
>> > Any help would be greatly appreciated.
>>
>> > James
>>
>>
>>
>> --
>> SY, Konstantin.
>> Advanced Eclipse SWT Designer (http://www.swt-designer.com)



--
SY, Konstantin.
Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: preventing resize of ghost [message #122756 is a reply to message #122622] Thu, 18 March 2004 00:59 Go to previous messageGo to next message
Eclipse UserFriend
Unfortunately, that still doesn't work - the ghost is still resizable.

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:d8mocC2CEHA.4092@fairy.ao.nlmk...
> James Tauber <jtauber@jtauber.com> wrote:
>
> Something like this:
> installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
NonResizableEditPolicy());
> protected void createEditPolicies() {
> installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
EmptySelectionEditPolicy());
> }
> For your part that should not be resized.
>
>
>
> > "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> > news:snkcT0nCEHA.3404@fairy.ao.nlmk...
> >> James Tauber <jtauber@jtauber.com> wrote:
> >>
> >> Just quick idea - use NonresizableEditPolicy.
>
> > On which part and in which role? I've tried a few combinations and it
> > doesn't change the behaviour.
>
> >> > My GEF-based application successfully disallows resizing of parts but
> > when a
> >> > part is selected, the resize handles still appear and they can be
> > dragged
> >> > with the ghost being correspondingly resized.
> >>
> >> > When the button is released, the actual figure remains the same size.
> > But
> >> > I'm wondering how I can prevent the selection handles from being
> > draggable.
> >>
> >> > I have two edit parts, the overall DiagramPart and the individual
> > NodeParts.
> >>
> >> > DiagramPart has a single policy in the LAYOUT_ROLE which implements
> >> > createChangeConstraintCommand (to handle moving) and getCreateCommand
> > (to
> >> > handle creation from palette)
> >>
> >> > NodePart has a policy in the COMPONENT_ROLE which implements
> >> > createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
> >> > getDirectEditCommand.
> >>
> >> > Any help would be greatly appreciated.
> >>
> >> > James
> >>
> >>
> >>
> >> --
> >> SY, Konstantin.
> >> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
>
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: preventing resize of ghost [message #122760 is a reply to message #122756] Thu, 18 March 2004 09:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Put a breakpoint in showSourceFeedback() in AbstractEditPart - one of your
EditPolicies is showing feedback while you drag. Perhaps you copied some
code that creates a ResizableEditPolicy for your children figures.

"James Tauber" <jtauber@jtauber.com> wrote in message
news:c3bdk7$ltb$1@eclipse.org...
>
> Unfortunately, that still doesn't work - the ghost is still resizable.
>
> "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> news:d8mocC2CEHA.4092@fairy.ao.nlmk...
> > James Tauber <jtauber@jtauber.com> wrote:
> >
> > Something like this:
> > installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
> NonResizableEditPolicy());
> > protected void createEditPolicies() {
> > installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
> EmptySelectionEditPolicy());
> > }
> > For your part that should not be resized.
> >
> >
> >
> > > "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> > > news:snkcT0nCEHA.3404@fairy.ao.nlmk...
> > >> James Tauber <jtauber@jtauber.com> wrote:
> > >>
> > >> Just quick idea - use NonresizableEditPolicy.
> >
> > > On which part and in which role? I've tried a few combinations and it
> > > doesn't change the behaviour.
> >
> > >> > My GEF-based application successfully disallows resizing of parts
but
> > > when a
> > >> > part is selected, the resize handles still appear and they can be
> > > dragged
> > >> > with the ghost being correspondingly resized.
> > >>
> > >> > When the button is released, the actual figure remains the same
size.
> > > But
> > >> > I'm wondering how I can prevent the selection handles from being
> > > draggable.
> > >>
> > >> > I have two edit parts, the overall DiagramPart and the individual
> > > NodeParts.
> > >>
> > >> > DiagramPart has a single policy in the LAYOUT_ROLE which implements
> > >> > createChangeConstraintCommand (to handle moving) and
getCreateCommand
> > > (to
> > >> > handle creation from palette)
> > >>
> > >> > NodePart has a policy in the COMPONENT_ROLE which implements
> > >> > createDeleteCommand and one in the DIRECT_EDIT_ROLE which
implements
> > >> > getDirectEditCommand.
> > >>
> > >> > Any help would be greatly appreciated.
> > >>
> > >> > James
> > >>
> > >>
> > >>
> > >> --
> > >> SY, Konstantin.
> > >> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
> >
> >
> >
> > --
> > SY, Konstantin.
> > Advanced Eclipse SWT Designer (http://www.swt-designer.com)
>
>
Re: preventing resize of ghost [message #122979 is a reply to message #122622] Thu, 18 March 2004 11:38 Go to previous messageGo to next message
Eclipse UserFriend
You'd want to use PRIMARY_DRAG_ROLE, and not SELECTION_FEEDBACK_ROLE.

"Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
news:d8mocC2CEHA.4092@fairy.ao.nlmk...
> James Tauber <jtauber@jtauber.com> wrote:
>
> Something like this:
> installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
NonResizableEditPolicy());
> protected void createEditPolicies() {
> installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new
EmptySelectionEditPolicy());
> }
> For your part that should not be resized.
>
>
>
> > "Konstantin Scheglov" <scheglov_ke@nlmk.ru> wrote in message
> > news:snkcT0nCEHA.3404@fairy.ao.nlmk...
> >> James Tauber <jtauber@jtauber.com> wrote:
> >>
> >> Just quick idea - use NonresizableEditPolicy.
>
> > On which part and in which role? I've tried a few combinations and it
> > doesn't change the behaviour.
>
> >> > My GEF-based application successfully disallows resizing of parts but
> > when a
> >> > part is selected, the resize handles still appear and they can be
> > dragged
> >> > with the ghost being correspondingly resized.
> >>
> >> > When the button is released, the actual figure remains the same size.
> > But
> >> > I'm wondering how I can prevent the selection handles from being
> > draggable.
> >>
> >> > I have two edit parts, the overall DiagramPart and the individual
> > NodeParts.
> >>
> >> > DiagramPart has a single policy in the LAYOUT_ROLE which implements
> >> > createChangeConstraintCommand (to handle moving) and getCreateCommand
> > (to
> >> > handle creation from palette)
> >>
> >> > NodePart has a policy in the COMPONENT_ROLE which implements
> >> > createDeleteCommand and one in the DIRECT_EDIT_ROLE which implements
> >> > getDirectEditCommand.
> >>
> >> > Any help would be greatly appreciated.
> >>
> >> > James
> >>
> >>
> >>
> >> --
> >> SY, Konstantin.
> >> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
>
>
>
> --
> SY, Konstantin.
> Advanced Eclipse SWT Designer (http://www.swt-designer.com)
Re: preventing resize of ghost [message #123061 is a reply to message #122760] Thu, 18 March 2004 23:04 Go to previous messageGo to next message
Eclipse UserFriend
Yep. ResizableEditPolicy.showSourceFeedback is definitely getting called.
Now to track down how ResizableEditPolicy is getting on my edit part's
policy list.

James

"Whitney Sorenson" <none@us.ibm.com> wrote in message
news:c3cbrd$h3k$1@eclipse.org...
> Put a breakpoint in showSourceFeedback() in AbstractEditPart - one of your
> EditPolicies is showing feedback while you drag. Perhaps you copied some
> code that creates a ResizableEditPolicy for your children figures.
Re: preventing resize of ghost [message #123072 is a reply to message #123061] Thu, 18 March 2004 23:21 Go to previous message
Eclipse UserFriend
PROBLEM FOUND!

By default, ConstrainedLayoutEditPolicy implements createChildEditPolicy()
to return a ResizableEditPolicy.

In other words, if a part has, in a LAYOUT_ROLE, a subclass of
ConstrainedLayoutEditPolicy, then children of that part will be resizable
even if the child parts themselves don't have a resizable policy.

The solution was to override createChildEditPolicy to return a
NonResizableEditPolicy.

James
Previous Topic:Keeping figure in the middle of the editor
Next Topic:Detecting Control key state during drag from a navigator view to a GEF editor
Goto Forum:
  


Current Time: Tue Jul 15 23:52:19 EDT 2025

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

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

Back to the top