Search in sources :

Example 1 with FolderRepositoryObject

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;
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) LinkedList(java.util.LinkedList) HashSet(java.util.HashSet) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) ViewerComparator(org.eclipse.jface.viewers.ViewerComparator) Comparator(java.util.Comparator)

Example 2 with FolderRepositoryObject

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);
}
Also used : TreeItem(org.eclipse.swt.widgets.TreeItem) CellEditor(org.eclipse.jface.viewers.CellEditor) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) ICellModifier(org.eclipse.jface.viewers.ICellModifier) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ComboBoxCellEditor(org.eclipse.jface.viewers.ComboBoxCellEditor) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 3 with FolderRepositoryObject

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);
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 4 with FolderRepositoryObject

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();
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 5 with FolderRepositoryObject

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);
        }
    }
}
Also used : Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Aggregations

FolderRepositoryObject (org.talend.mdm.repository.models.FolderRepositoryObject)37 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)32 ERepositoryObjectType (org.talend.core.model.repository.ERepositoryObjectType)16 ContainerItem (org.talend.mdm.repository.model.mdmproperties.ContainerItem)14 ArrayList (java.util.ArrayList)7 Item (org.talend.core.model.properties.Item)7 Property (org.talend.core.model.properties.Property)7 PersistenceException (org.talend.commons.exception.PersistenceException)6 ItemState (org.talend.core.model.properties.ItemState)6 TreeItem (org.eclipse.swt.widgets.TreeItem)5 LinkedList (java.util.LinkedList)4 Project (org.talend.core.model.general.Project)4 RepositoryViewObject (org.talend.core.model.repository.RepositoryViewObject)4 IProject (org.eclipse.core.resources.IProject)3 Path (org.eclipse.core.runtime.Path)3 FolderItem (org.talend.core.model.properties.FolderItem)3 WSRootRepositoryObject (org.talend.mdm.repository.models.WSRootRepositoryObject)3 List (java.util.List)2 Matcher (java.util.regex.Matcher)2 IFolder (org.eclipse.core.resources.IFolder)2