use of com.twinsoft.convertigo.beans.core.IStepSourceContainer in project convertigo by convertigo.
the class CanCreateSource method canCreateSource.
public static boolean canCreateSource(Object obj, StepSourceWrap ssw) {
// if (target instanceof TreeObject) {
// TreeObject targetTreeObject = (TreeObject) target;
// Check for drop to a step which contains a stepSource definition
// if (targetTreeObject.getObject() instanceof IStepSourceContainer) {
DatabaseObject targetDbo = (DatabaseObject) obj;
if (targetDbo instanceof Step && ((Step) targetDbo).canWorkOnSource() || targetDbo instanceof IStepSourceContainer) {
// StepSourceTransfer.getInstance().getStepSource();
StepSourceWrap stepSource = ssw;
if (stepSource != null) {
Step targetStep = (Step) ((targetDbo instanceof StepVariable) ? ((StepVariable) targetDbo).getParent() : targetDbo);
// Check for drop to a step in the same sequence
Long key = Long.valueOf(stepSource.getPriority());
Step sourceStep = targetStep.getSequence().loadedSteps.get(key);
if ((sourceStep != null) && (!targetStep.equals(sourceStep))) {
// Check for drop on a 'following' step
try {
List<DatabaseObject> siblings = new ArrayList<>();
getNextSiblings(siblings, targetDbo.getProject(), sourceStep);
// System.out.println("siblings: "+siblings.toString());
return siblings.contains(targetDbo);
} catch (Exception e) {
e.printStackTrace(System.out);
}
;
}
}
}
// }
return false;
}
Aggregations