Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to handle a delete command that needs to prompt user?
How to handle a delete command that needs to prompt user? [message #162411] Tue, 21 December 2004 21:19 Go to next message
Eclipse UserFriend
Originally posted by: simon.ibm.com

I have a generic delete action. In its run method, loops over all the
currently selected edit parts, and asked each one for a delete command. That
is, I call getCommand() on each edit part, which in turn ends up calling
getCommand() on my ComponentEditPolicy.

All is working well except for one scenario. Some edit parts can be
"referenced" by other edit parts. So we want to prompt the user to confirm
they are willing to delete these other edit parts also. How could that be
done? Because some of these edit parts (that can be referenced by other edit
parts) can be contributed by other plugins, I do not know about them in
advance in my delete action to check for them and prompt the user.

There are not "connection" line between these edit parts. The only
indication of the reference is each edit part that is dependent on another
edit part contains the name of that edit part in its property. Since these
edit parts may not be visible on the screen at the time of the delete, the
user is "surprised" later on when scrolling in the editor and noticing other
edit parts are gone.

Anyone else have this problem/situation? If so, what did you do?

Thanks
Simon :-)
Re: How to handle a delete command that needs to prompt user? [message #162527 is a reply to message #162411] Wed, 22 December 2004 05:47 Go to previous messageGo to next message
Gunnar Wagenknecht is currently offline Gunnar WagenknechtFriend
Messages: 486
Registered: July 2009
Location: San Francisco ✈ Germany
Senior Member

Simon schrieb:
> Anyone else have this problem/situation? If so, what did you do?

See:
MessageDialog#openQuestion
PlatformUI#getWorkbench#getDisplay#getActiveShell
Display#syncExec

Cu, Gunnar
Re: How to handle a delete command that needs to prompt user? [message #162541 is a reply to message #162411] Wed, 22 December 2004 13:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

create a new CancellableDeleteAction

let that open dialog to ask about what to and not to delete. once
proper list generated then issue the real delete command.

that is how i would do it.

Simon wrote:
> I have a generic delete action. In its run method, loops over all the
> currently selected edit parts, and asked each one for a delete command. That
> is, I call getCommand() on each edit part, which in turn ends up calling
> getCommand() on my ComponentEditPolicy.
>
> All is working well except for one scenario. Some edit parts can be
> "referenced" by other edit parts. So we want to prompt the user to confirm
> they are willing to delete these other edit parts also. How could that be
> done? Because some of these edit parts (that can be referenced by other edit
> parts) can be contributed by other plugins, I do not know about them in
> advance in my delete action to check for them and prompt the user.
>
> There are not "connection" line between these edit parts. The only
> indication of the reference is each edit part that is dependent on another
> edit part contains the name of that edit part in its property. Since these
> edit parts may not be visible on the screen at the time of the delete, the
> user is "surprised" later on when scrolling in the editor and noticing other
> edit parts are gone.
>
> Anyone else have this problem/situation? If so, what did you do?
>
> Thanks
> Simon :-)
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber."

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Re: How to handle a delete command that needs to prompt user? [message #162556 is a reply to message #162541] Wed, 22 December 2004 15:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cqbtst$oe3$1@www.eclipse.org...
> create a new CancellableDeleteAction
>
> let that open dialog to ask about what to and not to delete. once
> proper list generated then issue the real delete command.
>
> that is how i would do it.

The command could open a dialog and there a several cases where this makes
sense. It's good practice to allow the user to avoid aa prompt by pressing
ESC. So they choices would be, delete just selected, delete dependents, or
cancel the action (it isn't necessary to display a cancel button, just hook
dialog's ESC).

To handle the first two, I don't think you need to create a second command,
you could just modify the command which displayed the dialog. But that
leaves the cancel case. I'm not sure how to abort a command. You'd have to
extend the API. Maybe you could run some pre-execute method which return
boolean.

>
> Simon wrote:
> > I have a generic delete action. In its run method, loops over all the
> > currently selected edit parts, and asked each one for a delete command.
That
> > is, I call getCommand() on each edit part, which in turn ends up calling
> > getCommand() on my ComponentEditPolicy.
> >
> > All is working well except for one scenario. Some edit parts can be
> > "referenced" by other edit parts. So we want to prompt the user to
confirm
> > they are willing to delete these other edit parts also. How could that
be
> > done? Because some of these edit parts (that can be referenced by other
edit
> > parts) can be contributed by other plugins, I do not know about them in
> > advance in my delete action to check for them and prompt the user.
> >
> > There are not "connection" line between these edit parts. The only
> > indication of the reference is each edit part that is dependent on
another
> > edit part contains the name of that edit part in its property. Since
these
> > edit parts may not be visible on the screen at the time of the delete,
the
> > user is "surprised" later on when scrolling in the editor and noticing
other
> > edit parts are gone.
> >
> > Anyone else have this problem/situation? If so, what did you do?
> >
> > Thanks
> > Simon :-)
> >
> >
>
>
> --
> Respectfully,
>
>
> CL Gilbert
>
> "Verily, verily, I say unto you, He that entereth not by the door() into
> the sheepfold{}, but climbeth up some other *way, the same is a thief
> and a robber."
>
> GnuPG Key Fingerprint:
> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>
> For a free Java interface to Freechess.org see
> http://www.rigidsoftware.com/Chess/chess.html
Re: How to handle a delete command that needs to prompt user? [message #162596 is a reply to message #162541] Wed, 22 December 2004 18:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.ibm.com

Did you mean CancellableDeleteCommand instead of CancellableDeleteAction? If
so, do you have a sample you could post here?

Thanks
Simon :-)

"CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
news:cqbtst$oe3$1@www.eclipse.org...
> create a new CancellableDeleteAction
>
> let that open dialog to ask about what to and not to delete. once
> proper list generated then issue the real delete command.
>
> that is how i would do it.
>
> Simon wrote:
> > I have a generic delete action. In its run method, loops over all the
> > currently selected edit parts, and asked each one for a delete command.
That
> > is, I call getCommand() on each edit part, which in turn ends up calling
> > getCommand() on my ComponentEditPolicy.
> >
> > All is working well except for one scenario. Some edit parts can be
> > "referenced" by other edit parts. So we want to prompt the user to
confirm
> > they are willing to delete these other edit parts also. How could that
be
> > done? Because some of these edit parts (that can be referenced by other
edit
> > parts) can be contributed by other plugins, I do not know about them in
> > advance in my delete action to check for them and prompt the user.
> >
> > There are not "connection" line between these edit parts. The only
> > indication of the reference is each edit part that is dependent on
another
> > edit part contains the name of that edit part in its property. Since
these
> > edit parts may not be visible on the screen at the time of the delete,
the
> > user is "surprised" later on when scrolling in the editor and noticing
other
> > edit parts are gone.
> >
> > Anyone else have this problem/situation? If so, what did you do?
> >
> > Thanks
> > Simon :-)
> >
> >
>
>
> --
> Respectfully,
>
>
> CL Gilbert
>
> "Verily, verily, I say unto you, He that entereth not by the door() into
> the sheepfold{}, but climbeth up some other *way, the same is a thief
> and a robber."
>
> GnuPG Key Fingerprint:
> 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>
> For a free Java interface to Freechess.org see
> http://www.rigidsoftware.com/Chess/chess.html
Re: How to handle a delete command that needs to prompt user? [message #162602 is a reply to message #162556] Wed, 22 December 2004 18:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: simon.ibm.com

For whatever reason, I was under the impression that opening a dialog from
within a command was not considered "proper style". I will try this out.

Thanks
Simon :-)

"Randy Hudson" <none@us.ibm.com> wrote in message
news:cqc47u$fsp$1@www.eclipse.org...
>
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:cqbtst$oe3$1@www.eclipse.org...
> > create a new CancellableDeleteAction
> >
> > let that open dialog to ask about what to and not to delete. once
> > proper list generated then issue the real delete command.
> >
> > that is how i would do it.
>
> The command could open a dialog and there a several cases where this makes
> sense. It's good practice to allow the user to avoid aa prompt by pressing
> ESC. So they choices would be, delete just selected, delete dependents,
or
> cancel the action (it isn't necessary to display a cancel button, just
hook
> dialog's ESC).
>
> To handle the first two, I don't think you need to create a second
command,
> you could just modify the command which displayed the dialog. But that
> leaves the cancel case. I'm not sure how to abort a command. You'd have
to
> extend the API. Maybe you could run some pre-execute method which return
> boolean.
>
> >
> > Simon wrote:
> > > I have a generic delete action. In its run method, loops over all the
> > > currently selected edit parts, and asked each one for a delete
command.
> That
> > > is, I call getCommand() on each edit part, which in turn ends up
calling
> > > getCommand() on my ComponentEditPolicy.
> > >
> > > All is working well except for one scenario. Some edit parts can be
> > > "referenced" by other edit parts. So we want to prompt the user to
> confirm
> > > they are willing to delete these other edit parts also. How could that
> be
> > > done? Because some of these edit parts (that can be referenced by
other
> edit
> > > parts) can be contributed by other plugins, I do not know about them
in
> > > advance in my delete action to check for them and prompt the user.
> > >
> > > There are not "connection" line between these edit parts. The only
> > > indication of the reference is each edit part that is dependent on
> another
> > > edit part contains the name of that edit part in its property. Since
> these
> > > edit parts may not be visible on the screen at the time of the delete,
> the
> > > user is "surprised" later on when scrolling in the editor and noticing
> other
> > > edit parts are gone.
> > >
> > > Anyone else have this problem/situation? If so, what did you do?
> > >
> > > Thanks
> > > Simon :-)
> > >
> > >
> >
> >
> > --
> > Respectfully,
> >
> >
> > CL Gilbert
> >
> > "Verily, verily, I say unto you, He that entereth not by the door() into
> > the sheepfold{}, but climbeth up some other *way, the same is a thief
> > and a robber."
> >
> > GnuPG Key Fingerprint:
> > 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
> >
> > For a free Java interface to Freechess.org see
> > http://www.rigidsoftware.com/Chess/chess.html
>
>
Re: How to handle a delete command that needs to prompt user? [message #162610 is a reply to message #162602] Wed, 22 December 2004 19:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I don't see it as a real problem. I know Text team records offsets and
length in their commands, which are purely UI data. You will of course want
to null out any fields which hold onto dialogs, etc., once execute has
completed.

"Simon" <simon@ibm.com> wrote in message
news:cqcekj$iif$1@www.eclipse.org...
> For whatever reason, I was under the impression that opening a dialog from
> within a command was not considered "proper style". I will try this out.
>
> Thanks
> Simon :-)
>
> "Randy Hudson" <none@us.ibm.com> wrote in message
> news:cqc47u$fsp$1@www.eclipse.org...
> >
> > "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in
message
> > news:cqbtst$oe3$1@www.eclipse.org...
> > > create a new CancellableDeleteAction
> > >
> > > let that open dialog to ask about what to and not to delete. once
> > > proper list generated then issue the real delete command.
> > >
> > > that is how i would do it.
> >
> > The command could open a dialog and there a several cases where this
makes
> > sense. It's good practice to allow the user to avoid aa prompt by
pressing
> > ESC. So they choices would be, delete just selected, delete dependents,
> or
> > cancel the action (it isn't necessary to display a cancel button, just
> hook
> > dialog's ESC).
> >
> > To handle the first two, I don't think you need to create a second
> command,
> > you could just modify the command which displayed the dialog. But that
> > leaves the cancel case. I'm not sure how to abort a command. You'd
have
> to
> > extend the API. Maybe you could run some pre-execute method which
return
> > boolean.
> >
> > >
> > > Simon wrote:
> > > > I have a generic delete action. In its run method, loops over all
the
> > > > currently selected edit parts, and asked each one for a delete
> command.
> > That
> > > > is, I call getCommand() on each edit part, which in turn ends up
> calling
> > > > getCommand() on my ComponentEditPolicy.
> > > >
> > > > All is working well except for one scenario. Some edit parts can be
> > > > "referenced" by other edit parts. So we want to prompt the user to
> > confirm
> > > > they are willing to delete these other edit parts also. How could
that
> > be
> > > > done? Because some of these edit parts (that can be referenced by
> other
> > edit
> > > > parts) can be contributed by other plugins, I do not know about them
> in
> > > > advance in my delete action to check for them and prompt the user.
> > > >
> > > > There are not "connection" line between these edit parts. The only
> > > > indication of the reference is each edit part that is dependent on
> > another
> > > > edit part contains the name of that edit part in its property. Since
> > these
> > > > edit parts may not be visible on the screen at the time of the
delete,
> > the
> > > > user is "surprised" later on when scrolling in the editor and
noticing
> > other
> > > > edit parts are gone.
> > > >
> > > > Anyone else have this problem/situation? If so, what did you do?
> > > >
> > > > Thanks
> > > > Simon :-)
> > > >
> > > >
> > >
> > >
> > > --
> > > Respectfully,
> > >
> > >
> > > CL Gilbert
> > >
> > > "Verily, verily, I say unto you, He that entereth not by the door()
into
> > > the sheepfold{}, but climbeth up some other *way, the same is a thief
> > > and a robber."
> > >
> > > GnuPG Key Fingerprint:
> > > 82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
> > >
> > > For a free Java interface to Freechess.org see
> > > http://www.rigidsoftware.com/Chess/chess.html
> >
> >
>
>
Re: How to handle a delete command that needs to prompt user? [message #162626 is a reply to message #162556] Wed, 22 December 2004 23:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Randy Hudson wrote:
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:cqbtst$oe3$1@www.eclipse.org...
>
>>create a new CancellableDeleteAction
>>
>>let that open dialog to ask about what to and not to delete. once
>>proper list generated then issue the real delete command.
>>
>>that is how i would do it.
>
>
> The command could open a dialog and there a several cases where this makes
> sense. It's good practice to allow the user to avoid aa prompt by pressing
> ESC. So they choices would be, delete just selected, delete dependents, or
> cancel the action (it isn't necessary to display a cancel button, just hook
> dialog's ESC).
>
> To handle the first two, I don't think you need to create a second command,
> you could just modify the command which displayed the dialog. But that
> leaves the cancel case. I'm not sure how to abort a command. You'd have to
> extend the API. Maybe you could run some pre-execute method which return
> boolean.
>

I wasnt suggesting a 2nd command, but a 2nd action. That is why its so
easy to abort, because its not really in progress yet.
Re: How to handle a delete command that needs to prompt user? [message #162634 is a reply to message #162596] Wed, 22 December 2004 23:31 Go to previous message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

Simon wrote:
> Did you mean CancellableDeleteCommand instead of CancellableDeleteAction? If
> so, do you have a sample you could post here?
>
> Thanks

IIRC, the action can generate the command if the proper conditions are
met. That is why i suggested a new action. cancelling a command is not
really GEF style i dont think, but if you dont start the command till
you know exactly what to delete and what not to, then their is no need
to cancel it.


> Simon :-)
>
> "CL [dnoyeb] Gilbert" <Lamont_Gilbert@rigidsoftware.com> wrote in message
> news:cqbtst$oe3$1@www.eclipse.org...
>
>>create a new CancellableDeleteAction
>>
>>let that open dialog to ask about what to and not to delete. once
>>proper list generated then issue the real delete command.
>>
>>that is how i would do it.
>>
>>Simon wrote:
>>
>>>I have a generic delete action. In its run method, loops over all the
>>>currently selected edit parts, and asked each one for a delete command.
>
> That
>
>>>is, I call getCommand() on each edit part, which in turn ends up calling
>>>getCommand() on my ComponentEditPolicy.
>>>
>>>All is working well except for one scenario. Some edit parts can be
>>>"referenced" by other edit parts. So we want to prompt the user to
>
> confirm
>
>>>they are willing to delete these other edit parts also. How could that
>
> be
>
>>>done? Because some of these edit parts (that can be referenced by other
>
> edit
>
>>>parts) can be contributed by other plugins, I do not know about them in
>>>advance in my delete action to check for them and prompt the user.
>>>
>>>There are not "connection" line between these edit parts. The only
>>>indication of the reference is each edit part that is dependent on
>
> another
>
>>>edit part contains the name of that edit part in its property. Since
>
> these
>
>>>edit parts may not be visible on the screen at the time of the delete,
>
> the
>
>>>user is "surprised" later on when scrolling in the editor and noticing
>
> other
>
>>>edit parts are gone.
>>>
>>>Anyone else have this problem/situation? If so, what did you do?
>>>
>>>Thanks
>>>Simon :-)
>>>
>>>
>>
>>
>>--
>>Respectfully,
>>
>>
>>CL Gilbert
>>
>>"Verily, verily, I say unto you, He that entereth not by the door() into
>>the sheepfold{}, but climbeth up some other *way, the same is a thief
>>and a robber."
>>
>>GnuPG Key Fingerprint:
>>82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D
>>
>>For a free Java interface to Freechess.org see
>>http://www.rigidsoftware.com/Chess/chess.html
>
>
>


--
Respectfully,


CL Gilbert

"Verily, verily, I say unto you, He that entereth not by the door() into
the sheepfold{}, but climbeth up some other *way, the same is a thief
and a robber."

GnuPG Key Fingerprint:
82A6 8893 C2A1 F64E A9AD 19AE 55B2 4CD7 80D2 0A2D

For a free Java interface to Freechess.org see
http://www.rigidsoftware.com/Chess/chess.html
Previous Topic:What is GEF
Next Topic:how to set the rooteditpart's size.
Goto Forum:
  


Current Time: Fri Apr 26 11:57:29 GMT 2024

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

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

Back to the top