Commit 60b1c19e authored by Simon Barner's avatar Simon Barner
Browse files

Element connection compositors: Do not explicitly prepare IDs for newly created connectors.

- This will be performed by the IElementCompositorService that is called from createNewSourceDropContext().
- Doing it here already, will trigger an expensive check for duplicate IDs when the ID assignment is issued for the second time from the IElementCompositorService
refs 2759
parent 008a8636
......@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author igna
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: 527D8AA1B59F1A259BADEA1609C00555
* @ConQAT.Rating YELLOW Hash: B65DD76817032940B5C3BC3BF3B1125D
*/
public abstract class ConnectorHierarchicElementConnectionCompositorBase<HE extends IHierarchicElement, S extends IConnector, T extends IHierarchicElement>
extends ConnectionCompositorBase<HE, S, T> {
......@@ -56,16 +56,15 @@ public abstract class ConnectorHierarchicElementConnectionCompositorBase<HE exte
/** {@inheritDoc} */
@Override
public boolean connect(S source, T target, HE parent, IConnectionCompositionContext context) {
ITopLevelElement topElement =
IPersistencyService.getInstance().getTopLevelElementFor(parent);
boolean isSrcEntry = source instanceof EntryConnectorBase;
isSrcEntry = sameParent(target, source) ? isSrcEntry : !isSrcEntry;
IConnector conn = isSrcEntry ? createEntryConnector() : createExitConnector();
avoidDuplicateConnectorName(target, conn);
if(topElement != null) {
topElement.prepareIDs(conn);
}
createNewTargetDropContext(target, context, conn);
ITopLevelElement topElement =
IPersistencyService.getInstance().getTopLevelElementFor(parent);
createConnection(source, conn, parent, topElement);
return true;
}
......
......@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author hoelzl
* @author $Author$
* @version $Rev$
* @ConQAT.Rating YELLOW Hash: 7A3C53940D04EA617F6AB4B38AB87C9E
* @ConQAT.Rating YELLOW Hash: 6DB675BD3A0953264509F4D152177632
*/
public abstract class HierarchicElementConnectionCompositorBase<HE extends IHierarchicElement, S extends IHierarchicElement, T extends IHierarchicElement>
extends ConnectionCompositorBase<HE, S, T> {
......@@ -59,14 +59,12 @@ public abstract class HierarchicElementConnectionCompositorBase<HE extends IHier
// And conversely entry connectors are target connectors.
IConnector targetConnector = createEntryConnector();
avoidDuplicateConnectorName(target, targetConnector);
ITopLevelElement topElement =
IPersistencyService.getInstance().getTopLevelElementFor(parent);
if(topElement != null) {
topElement.prepareIDs(sourceConnector);
topElement.prepareIDs(targetConnector);
}
createNewSourceDropContext(source, context, sourceConnector);
createNewTargetDropContext(target, context, targetConnector);
ITopLevelElement topElement =
IPersistencyService.getInstance().getTopLevelElementFor(parent);
createConnection(sourceConnector, targetConnector, parent, topElement);
return true;
}
......
......@@ -31,7 +31,7 @@ import org.fortiss.tooling.kernel.service.IPersistencyService;
* @author igna
* @author $Author: hoelzl $
* @version $Rev: 18709 $
* @ConQAT.Rating GREEN Hash: BE31FD9962A2EA352648CB1EA34FDEAE
* @ConQAT.Rating YELLOW Hash: 2A6272E51C04314F65C60044D767BCB4
*/
public abstract class HierarchicElementConnectorConnectionCompositorBase<HE extends IHierarchicElement, S extends IHierarchicElement, T extends IConnector>
extends ConnectionCompositorBase<HE, S, T> {
......@@ -63,15 +63,15 @@ public abstract class HierarchicElementConnectorConnectionCompositorBase<HE exte
/** {@inheritDoc} */
@Override
public boolean connect(S source, T target, HE parent, IConnectionCompositionContext context) {
ITopLevelElement topElement = IPersistencyService.getInstance().getTopLevelElementFor(parent);
boolean isTargetEntry = target instanceof EntryConnectorBase;
isTargetEntry = sameParent(source, target) ? isTargetEntry : !isTargetEntry;
IConnector conn = isTargetEntry ? createEntryConnector() : createExitConnector();
avoidDuplicateConnectorName(source, conn);
if(topElement != null) {
topElement.prepareIDs(conn);
}
createNewSourceDropContext(source, context, conn);
ITopLevelElement topElement =
IPersistencyService.getInstance().getTopLevelElementFor(parent);
createConnection(conn, target, parent, topElement);
return true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment