[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Please Help!!!

Hi everyone,

my problem is the following: I am developing a GEF based application, in which all the figures has only one input connection and one output connection. But now, I would like to create a figure which has several input connections and only one output connection. I have changed the method getConnectionCompleteCommand but it doesn't work. This is the code for the getConnectionCompleteCommand and getConnectionCreateCommand methods:

protected Command getConnectionCompleteCommand(
CreateConnectionRequest request) {

JclecEditPart target = (JclecEditPart) request.getTargetEditPart();
if(getJCLECSubpart() instanceof InitModel){
return null;
}

if(target.hasInputConnections() && !(getJCLECSubpart() instanceof CollectorModel)){


			return null;
		}
		else{			
			
			ConnectionCommand command = (ConnectionCommand) request
			.getStartCommand();
			command.setTarget(getJCLECSubpart());
			ConnectionAnchor ctor = getJCLECEditPart().getTargetConnectionAnchor(
					request);
					
			command.setTargetTerminal(getJCLECEditPart()
					.mapConnectionAnchorToTerminal(ctor));
			
			return command;
		}
	
	}

protected Command getConnectionCreateCommand(CreateConnectionRequest request) {

JclecEditPart target = (JclecEditPart) request.getTargetEditPart();

if(getJCLECSubpart() instanceof EndModel)
return null;

if(target.hasOutputConnections()){
return null;
}

else{
ConnectionCommand command = new ConnectionCommand();
command.setConnection(new Arrow());
command.setSource(getJCLECSubpart());
ConnectionAnchor ctor = getJCLECEditPart().getSourceConnectionAnchor(
request);
command.setSourceTerminal(getJCLECEditPart()
.mapConnectionAnchorToTerminal(ctor));
request.setStartCommand(command);
return command;
}

}



The figure which should have several input connections and only one output connection is "CollectorModel". Could you tell me why the code above doesn't work? What others method should I modify? Please, help me!!!


 Thank you very much.



  --Jose.