// WARNING THIS IS A REALLY DIRTY DIRTY HACK
// PLEASE DO SOMETING FOR ME
// ----------------------------------------------------------------------------
if (!source.isSettable()) {
if (widget instanceof IEditableComponent) {
IEditableComponent editableComponent = (IEditableComponent) widget;
editableComponent.setEditable(false);
}
}
// we check first if a similar controller already exist, otherwise we create
// it
AbstractController<U> controller = getController(source.getDataType(),
getTargetType());
if (controller != null) {
controller.setFirstInitAllowed(firstInitAllowed);
// we connect both components to the controller and check if the link is
// make
result = controller.addLink(source, connectedTarget);
String logMessage = "connection failed for";
if (result) {
IDataSourceProducer producer = DataSourceProducerProvider
.getProducer(key.getSourceProduction());
List<AbstractPlugin<?>> tempListPlugin = initPlugins(source);
List<AbstractPlugin<?>> toRemove = new ArrayList<AbstractPlugin<?>>();
for (AbstractPlugin<?> plugin : tempListPlugin) {
boolean connectionState = plugin.addPlugin(producer, key, widget);
if (!connectionState) {
toRemove.add(plugin);
}
}
tempListPlugin.removeAll(toRemove);
toRemove.clear();
connectCheckers(widget, controller);
computeDefaultToolTip(widget, key);
// registration of all usefull information about the connection
linkedPlugins.put(widget, tempListPlugin);
mainConnections.put(widget, key);
logMessage = "connection for";
}
// connection trace
printLog(logMessage, widget, controller, source);
// TODO
if (widget instanceof IEditableComponent && !source.isSettable()) {
IEditableComponent iEditableComponent = (IEditableComponent) widget;
iEditableComponent.setEditable(false);
}
}
}
else {
widget.setEnabled(false);