if ((connectionDragAnchorPart instanceof DisplayedPartOutput && partUnder instanceof DisplayedPartInput) ||
(connectionDragAnchorPart instanceof DisplayedPartInput && partUnder instanceof DisplayedPartOutput)){
// Assign the source and sink parts depending what we are hovering over.
PartConnectable sourcePart;
PartInput sinkPart;
if (connectionDragAnchorPart instanceof DisplayedPartOutput) {
sourcePart = connectionDragAnchorPart.getPartConnectable();
sinkPart = ((DisplayedPartInput)partUnder).getPartInput();
} else {
sourcePart = ((DisplayedPartConnectable)partUnder).getPartConnectable();
sinkPart = ((DisplayedPartInput)connectionDragAnchorPart).getPartInput();
}
Gem sourceGem = sourcePart.getGem();
Gem sinkGem = sinkPart.getGem();
if (sourceGem instanceof ValueGem) {
// Check if a value gem can be connected.
// They get special treatment since autoburning doesn't apply to value gems.
ModuleTypeInfo currentModuleTypeInfo = tableTop.getCurrentModuleTypeInfo();
ValueEditorManager valueEditorManager = gemCutter.getValueEditorManager();
if (!valueEditorManager.canInputDefaultValue(sinkPart.getType())) {
setCursor(connectNoParkCursor);
} else if (GemGraph.isCompositionConnectionValid(sourcePart, sinkPart, currentModuleTypeInfo)) {
setCursor(connectCursor);
} else if (GemGraph.isDefaultableValueGemSource(sourcePart, sinkPart, gemCutter.getConnectionContext())) {
setCursor(connectCursor);
} else {
setCursor(connectNoParkCursor);
}
} else if (sinkGem instanceof RecordFieldSelectionGem && !((RecordFieldSelectionGem)sinkGem).isFieldFixed()) {
if (GemGraph.isValidConnectionToRecordFieldSelection(sourcePart, sinkPart, tableTop.getCurrentModuleTypeInfo()) != null) {
setCursor(connectCursor);
} else {
setCursor(connectNoParkCursor);
}
} else if (GemGraph.arePartsConnectable(sourcePart, sinkPart)) {
// Check if the parts can be connected either through burning or direct connection.
// Even if they can be connected without autoburning we want to at least try burning them.
// Why? Because it might be better to burn the gem than just connecting it. We want to
// at least consider that possibility and recommend the best choice to the user.
if (tableTop.getBurnManager().getAutoburnLastResult() == AutoburnLogic.AutoburnAction.BURNED) {
// If the gem has already been burnt previously then keep showing the burn cursor.
// Don't try and burn the gem again since that will just show the connect cursor,
// since the autoburn logic already sees the gem as being burnt.
setCursor(burnCursor);
} else if (GemGraph.isConnectionValid(sourcePart, sinkPart)) {
// Try making a connection using autoburning.
AutoburnLogic.AutoburnAction autoBurnResult = tableTop.getBurnManager().handleAutoburnGemGesture(sourceGem, sinkPart.getType(), true);
if (autoBurnResult == AutoburnLogic.AutoburnAction.BURNED) {
setCursor(burnCursor);
} else if (autoBurnResult == AutoburnLogic.AutoburnAction.MULTIPLE) {