use of org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider in project knime-core by knime.
the class WorkflowImportSelectionPage method collectWorkflowsFromProvider.
/**
* @param parent the archive element to collect the workflows from
* @param monitor progress monitor
*/
public void collectWorkflowsFromProvider(final WorkflowImportElementFromArchive parent, final IProgressMonitor monitor) {
if (monitor.isCanceled()) {
m_importRoot = null;
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
m_fromZipTextUI.setText("");
}
});
return;
}
if (parent == null || parent.isWorkflow()) {
// abort recursion
return;
}
// public in order to make it possible to import from a given zip entry
ILeveledImportStructureProvider provider = parent.getProvider();
Object entry = parent.getEntry();
List children = provider.getChildren(entry);
if (children == null) {
return;
}
monitor.subTask(provider.getLabel(entry));
Iterator childrenEnum = children.iterator();
while (childrenEnum.hasNext()) {
Object child = childrenEnum.next();
if (provider.isFolder(child)) {
WorkflowImportElementFromArchive childElement = new WorkflowImportElementFromArchive(provider, child, parent.getLevel() + 1);
collectWorkflowsFromProvider(childElement, monitor);
// either it's a workflow
if (childElement.isWorkflow() || // or it is a workflow group
childElement.isWorkflowGroup()) {
// because only workflows and workflow groups are added
parent.addChild(childElement);
}
}
}
}
Aggregations