use of org.talend.mdm.repository.ui.dialogs.lock.LockedObjectDialog in project tmdm-studio-se by Talend.
the class ImportServerObjectWizard method showLockedObjDialog.
private boolean showLockedObjDialog(Object[] objs) {
if (objs == null) {
return true;
}
List<IRepositoryViewObject> viewObjs = new LinkedList<IRepositoryViewObject>();
boolean forceContinueResetOperation = false;
Map<IRepositoryViewObject, TreeObject> objMap = new HashMap<IRepositoryViewObject, TreeObject>();
for (Object obj : objs) {
TreeObject treeObj = (TreeObject) obj;
if (treeObj != null && treeObj instanceof TreeParent) {
continue;
}
String treeObjName = treeObj.getName();
ERepositoryObjectType type = RepositoryQueryService.getRepositoryObjectType(treeObj.getType());
if (type != null && treeObjName != null) {
String uniqueName = getUniqueName(treeObj, treeObjName);
IRepositoryViewObject viewObject = RepositoryResourceUtil.findViewObjectByName(type, uniqueName);
if (viewObject != null) {
viewObjs.add(viewObject);
objMap.put(viewObject, treeObj);
} else {
// not exist in local
forceContinueResetOperation = true;
}
}
}
LockedObjectDialog lockDialog = new LockedObjectDialog(getShell(), Messages.ImportServerObjectWizard_lockedObjectMessage, Messages.ImportServerObjectWizard_cancelImportingObjectMessage, viewObjs, forceContinueResetOperation);
if (lockDialog.needShowDialog()) {
int open = lockDialog.open();
if (open == IDialogConstants.OK_ID) {
if (lockDialog.canContinueRestOperation()) {
selectedObjects = lockDialog.getUnlockedTreeObject(selectedObjects, objMap);
return true;
}
}
return false;
}
return true;
}
Aggregations