Controling the number of connections [message #171916] |
Tue, 15 March 2005 17:40 |
Eclipse User |
|
|
|
Originally posted by: i92deosj.uco.es
Hi!
I have created several figures, and now I want to connect them
one-to-one, i.e. only one input connection and one output connection. How
can I know if the connection been created is the second connection? And
how can I know if this connection is an input connection or an output
connection?
If someone could give me any example, I would be grateful.
Thank you very much
|
|
|
Re: Controling the number of connections [message #171937 is a reply to message #171916] |
Tue, 15 March 2005 19:53 |
Eclipse User |
|
|
|
Originally posted by: huangjun.cs.umb.edu
I suppose we are talking gef, so,
all pieces of information you need are just in your model, right?
From an editpart you can get underlying model thru getModel() medthod and
then it's your own logic.
In class AbstractGraphicalEditPart you see getModelSourceConnections(output
connections) method and getModelTargetConnections(input connections) method.
You just need return a one-element-list in these two methods of your
customized editpart class to implement one input and one output.
Say, a model like this
interface model_node {
model_line getInput();
model_line getOutput();
...
}
and a connection model like this
interface model_line {
model_node getSource();
model_node getTarget();
...
}
then
class model_node_editpart {
protected List getModelSourceConnections() {
// return a list containing only
((model_node)getModel()).getOutput()
// or an empty list if no output;
}
protected List getModelTargetConnections() {
// return a list containing only ((model_node)getModel()).getInput()
// or an empty list if no input;
}
}
Then your customized model_line_editpart will be created as controller of
model_line instance.
Correct me if I am wrong. Good luck!
Best,
Jun
" Jose Antonio" <i92deosj@uco.es> wrote in message
news:d176mr$131$1@www.eclipse.org...
> Hi!
>
> I have created several figures, and now I want to connect them
> one-to-one, i.e. only one input connection and one output connection. How
> can I know if the connection been created is the second connection? And
> how can I know if this connection is an input connection or an output
> connection?
>
> If someone could give me any example, I would be grateful.
>
> Thank you very much
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02844 seconds