use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class ConsistencyConflictDialog method findRootContainers.
private List<IRepositoryViewObject> findRootContainers() {
Set<ERepositoryObjectType> types = new HashSet<ERepositoryObjectType>();
for (IRepositoryViewObject viewObj : viewObjMap.keySet()) {
types.add(viewObj.getRepositoryObjectType());
}
List<IRepositoryViewObject> containers = new LinkedList<IRepositoryViewObject>();
for (IRepositoryViewObject container : RepositoryResourceUtil.getCategoryViewObjects()) {
if (container.getRepositoryObjectType() == IServerObjectRepositoryType.TYPE_EVENTMANAGER) {
for (IRepositoryViewObject subContainer : ((FolderRepositoryObject) container).getChildren()) {
if (types.contains(subContainer.getRepositoryObjectType())) {
containers.add(subContainer);
}
}
} else if (types.contains(container.getRepositoryObjectType())) {
containers.add(container);
}
}
Collections.sort(containers, new Comparator() {
public int compare(Object o1, Object o2) {
String name1 = ((IRepositoryViewObject) o1).getRepositoryObjectType().getLabel();
String name2 = ((IRepositoryViewObject) o2).getRepositoryObjectType().getLabel();
return name1.compareTo(name2);
}
});
return containers;
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class ConsistencyConflictDialog method installCellEditor.
private void installCellEditor() {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
treeViewer.setColumnProperties(new String[] { "0", "1", "2", "3", "4" });
treeViewer.setCellModifier(new ICellModifier() {
public void modify(Object element, String property, Object value) {
if (property.equals("2")) {
// $NON-NLS-1$
int index = (Integer) value;
IRepositoryViewObject viewObj = (IRepositoryViewObject) ((TreeItem) element).getData();
if (index == 0) {
moveToDeployObjs(viewObj);
} else if (index == 1) {
moveToSkipObjs(viewObj);
}
treeViewer.refresh(viewObj);
}
}
public Object getValue(Object element, String property) {
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
if (isSkipObj(viewObj)) {
return 1;
}
return 0;
}
public boolean canModify(Object element, String property) {
if (property.equals("2") && !(element instanceof FolderRepositoryObject)) {
// $NON-NLS-1$
IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
return getCompareResult(viewObj) != CompareResultEnum.NOT_EXIST_IN_SERVER;
}
return false;
}
});
CellEditor[] cellEditors = new CellEditor[5];
cellEditors[2] = new ComboBoxCellEditor(treeViewer.getTree(), OPERATIONS, SWT.READ_ONLY);
treeViewer.setCellEditors(cellEditors);
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class EmptyRecycleBinAction method doRun.
@Override
protected void doRun() {
Object selObj = getSelectedObject().get(0);
FolderRepositoryObject conRepObj = (FolderRepositoryObject) selObj;
List<IRepositoryViewObject> children = conRepObj.getChildren();
int size = children.size();
if (size > 0) {
if (!(MessageDialog.openQuestion(getShell(), Messages.EmptyRecycleBinAction_title, Messages.EmptyRecycleBinAction_confirmEmpty))) {
return;
}
removeViewObjects(children);
}
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class EmptyRecycleBinAction method isVisible.
@Override
public boolean isVisible(IRepositoryViewObject viewObj) {
Object selObj = getSelectedObject().get(0);
FolderRepositoryObject conRepObj = (FolderRepositoryObject) selObj;
return !conRepObj.getChildren().isEmpty();
}
use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.
the class RestoreAction method restoreParent.
private void restoreParent(IRepositoryViewObject viewObj) {
IRepositoryViewObject parent = ContainerCacheService.getParent(viewObj);
if (parent != null && parent instanceof FolderRepositoryObject) {
Item item = parent.getProperty().getItem();
ERepositoryObjectType type = parent.getRepositoryObjectType();
if (RepositoryResourceUtil.isDeletedFolder(item, type)) {
item.getState().setDeleted(false);
String path = ERepositoryObjectType.getFolderName(type);
if (!path.isEmpty()) {
path += item.getState().getPath();
}
List<String> deletedFolderPaths = ProjectManager.getInstance().getCurrentProject().getEmfProject().getDeletedFolders();
deletedFolderPaths.remove(path);
restoreParent(parent);
}
}
}
Aggregations