Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » how to detect the behavior of delete a model from a LogicDiagram( logic example)
how to detect the behavior of delete a model from a LogicDiagram( logic example) [message #160243] Fri, 03 December 2004 05:39 Go to next message
Eclipse UserFriend
Originally posted by: hitdemo2002.yahoo.com.cn

in GEF's example-logic i want to add some extrally function to deletion
action ,that is to say: when delete a model from a logicdiagram (or delete
a
figure from diagram), i can notified. and i can add some number to a
array(or some other function).

for implements this function ,does i must code a new deleteaction and
replace "IWorkbenchActionConstants.DELETE" with thest new action

or i can use some existed function such as performRequest in some
editpart??
Re: how to detect the behavior of delete a model from a LogicDiagram( logic example) [message #160288 is a reply to message #160243] Fri, 03 December 2004 07:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

hitdemo2002 wrote:
> in GEF's example-logic i want to add some extrally function to deletion
> action ,that is to say: when delete a model from a logicdiagram (or
> delete a
> figure from diagram), i can notified. and i can add some number to a
> array(or some other function).
>
> for implements this function ,does i must code a new deleteaction and
> replace "IWorkbenchActionConstants.DELETE" with thest new action
>
> or i can use some existed function such as performRequest in some
> editpart??
>
>
>
>

You can probably use performRequest or something similar to send
notificatoin of deletes. Depends on what you are listening too. You
could listen to the parent container, or the child being deleted itself.
Its up to you.

--
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 detect the behavior of delete a model from a LogicDiagram( logic example) [message #160311 is a reply to message #160288] Fri, 03 December 2004 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hitdemo2002.yahoo.com.cn

> You can probably use performRequest or something similar to send
> notificatoin of deletes. Depends on what you are listening too. You
> could listen to the parent container, or the child being deleted itself.
> Its up to you.


i have added a performRequest() to the xxxeditpart,

public class xxxeditpart extends LogicEditPart {
.............................
public void performRequest(Request req) {
System.out.println("come
in。。。。&#1229 0;。。。。 ");
if (req.getType() == RequestConstants.REQ_DELETE) {

System.out.println(" deleting。。。。& ;#12290;。。。。 ");
}
}
......................
}
but i found that above code only took effect at the time of double click
the xxxeditpart. it can't notified of deletion,resize,move etc,why?
Re: how to detect the behavior of delete a model from a LogicDiagram( logic example) [message #160336 is a reply to message #160311] Fri, 03 December 2004 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Lamont_Gilbert.rigidsoftware.com

hitdemo2002 wrote:
>> You can probably use performRequest or something similar to send
>> notificatoin of deletes. Depends on what you are listening too. You
>> could listen to the parent container, or the child being deleted
>> itself. Its up to you.
>
>
>
> i have added a performRequest() to the xxxeditpart,
>
> public class xxxeditpart extends LogicEditPart {
> .............................
> public void performRequest(Request req) {
> System.out.println("come
> in。。。。&#1229 0;。。。。 ");
>
> if (req.getType() == RequestConstants.REQ_DELETE) {
>
> System.out.println(" deleting。。。。& ;#12290;。。。。 ");
>
> }
> }
> ......................
> }
> but i found that above code only took effect at the time of double click
> the xxxeditpart. it can't notified of deletion,resize,move etc,why?
>
>

What do you mean by took effect? Do you mean the only time that method
was called was during double click?

Also you should still be using .equals() rather than instance equality.

--
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 detect the behavior of delete a model from a LogicDiagram( logic example) [message #160344 is a reply to message #160243] Fri, 03 December 2004 15:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gaslade.yahoo.com

Probably the simplest thing to do would be to remove the existing delete
action ( if there is one ) and then replace it with a custom delete action.
For example, your editor probably has a createActions() method if it is
based on the logic example ( which everyones is ) and the first thing
this method probably does is call super. After super has been called you
can do the following....

protected void createActions() {
super.createActions();
ActionRegistry registry = getActionRegistry();
IAction action;

IAction deleteAction =
registry.getAction(GEFActionConstants.DELETE);
if (deleteAction != null) {
registry.removeAction(deleteAction);
}
action = new MyDeleteAction(this);
registry.registerAction(action);
getSelectionActions().add(action.getId());
.....


Guy




hitdemo2002 wrote:
> in GEF's example-logic i want to add some extrally function to deletion
> action ,that is to say: when delete a model from a logicdiagram (or
> delete a
> figure from diagram), i can notified. and i can add some number to a
> array(or some other function).
>
> for implements this function ,does i must code a new deleteaction and
> replace "IWorkbenchActionConstants.DELETE" with thest new action
>
> or i can use some existed function such as performRequest in some
> editpart??
>
>
>
>
Re: how to detect the behavior of delete a model from a LogicDiagram( logic example) [message #160447 is a reply to message #160336] Sat, 04 December 2004 01:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: hitdemo2002.yahoo.com.cn

> What do you mean by took effect? Do you mean the only time that method
> was called was during double click?
>
> Also you should still be using .equals() rather than instance equality.
>
> --
> 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


what i mean is:
when i delete xxxeditpart use "del" key for popmenu, xxxeditpart's
performRequest
could't be called,because there were no print out message "come
in.........."
if i double click xxxeditpart , above mothod was called,so i was confused
by this method.

public void performRequest(Request req) {
System.out.println("come in...........");
if (req.getType() == RequestConstants.REQ_DELETE) {
System.out.println("deleting..........");
}
}
Re: how to detect the behavior of delete a model from a LogicDiagram( logic example) [message #160615 is a reply to message #160311] Mon, 06 December 2004 17:06 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

PerformRequest is used for things which do not necessarily execute a
Command. For example, direct edit may go into an editing mode, but if the
user presses ESC, nothing happens. For actions which should simply execute
immediately, if executable, getCommand is the API of choice.

"hitdemo2002" <hitdemo2002@yahoo.com.cn> wrote in message
news:cop6v3$g6g$1@www.eclipse.org...
> > You can probably use performRequest or something similar to send
> > notificatoin of deletes. Depends on what you are listening too. You
> > could listen to the parent container, or the child being deleted itself.
> > Its up to you.
>
>
> i have added a performRequest() to the xxxeditpart,
>
> public class xxxeditpart extends LogicEditPart {
> .............................
> public void performRequest(Request req) {
> System.out.println("come
>
in&#12290;&#12290;&#12290;&#12290;&#1229 0;&#12290;&#12290;&#12290;&#12290; ")
;
> if (req.getType() == RequestConstants.REQ_DELETE) {
>
>
System.out.println(" deleting&#12290;&#12290;&#12290;&#12290;& ;#12290;&#12290;
&#12290;&#12290;&#12290;");
> }
> }
> ......................
> }
> but i found that above code only took effect at the time of double click
> the xxxeditpart. it can't notified of deletion,resize,move etc,why?
>
>
Previous Topic:Automatic graph layout of links only
Next Topic:EditDomain
Goto Forum:
  


Current Time: Thu Apr 25 17:12:45 GMT 2024

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

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

Back to the top