Search in sources :

Example 26 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class WaitToDeployDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    Label lblNewLabel = new Label(container, SWT.WRAP);
    lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    lblNewLabel.setText(Messages.WaitToDeployDialog_message);
    treeViewer = new TreeViewer(container, SWT.BORDER);
    Tree tree = treeViewer.getTree();
    tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    treeViewer.setLabelProvider(new ViewerLabelProvider());
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.addFilter(new ViewerFilter() {

        @Override
        public boolean select(Viewer viewer, Object parentElement, Object element) {
            if (element instanceof IRepositoryViewObject) {
                if (element instanceof FolderRepositoryObject) {
                    return needShowDialog(((FolderRepositoryObject) element).getChildren());
                } else {
                    return needShowObject((IRepositoryViewObject) element);
                }
            }
            return false;
        }
    });
    treeViewer.setInput(viewObjs);
    treeViewer.expandAll();
    return container;
}
Also used : Composite(org.eclipse.swt.widgets.Composite) ViewerFilter(org.eclipse.jface.viewers.ViewerFilter) TreeViewer(org.eclipse.jface.viewers.TreeViewer) Label(org.eclipse.swt.widgets.Label) Viewer(org.eclipse.jface.viewers.Viewer) TreeViewer(org.eclipse.jface.viewers.TreeViewer) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) ITreeContentProvider(org.eclipse.jface.viewers.ITreeContentProvider) GridData(org.eclipse.swt.layout.GridData) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) Tree(org.eclipse.swt.widgets.Tree) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 27 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class AbstractContentProvider method getChildren.

public Object[] getChildren(Object element) {
    Item item = RepositoryResourceUtil.getItemFromRepViewObj(element);
    if (item != null && item instanceof ContainerItem) {
        ContainerItem containerItem = (ContainerItem) item;
        // recycle
        if (RepositoryResourceUtil.isDeletedFolder(item, ((IRepositoryViewObject) element).getRepositoryObjectType())) {
            AbstractContentProvider recycleContentProvider = (AbstractContentProvider) RepositoryNodeConfigurationManager.getRecycleBinNodeConfiguration().getContentProvider();
            return recycleContentProvider.getChildren(element);
        }
        // 
        FolderType containerType = containerItem.getType();
        List<IRepositoryViewObject> children = ((FolderRepositoryObject) element).getChildren();
        if (containerType == FolderType.SYSTEM_FOLDER_LITERAL) {
            List<IRepositoryViewObject> viewObjects = getViewObjFromSystemFolder(containerItem);
            if (viewObjects != null) {
                children.clear();
                children.addAll(viewObjects);
                return viewObjects.toArray();
            }
        }
        if (containerType == FolderType.FOLDER_LITERAL || containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
            List<IRepositoryViewObject> viewObjects = getViewObjFromFolder(containerItem);
            if (viewObjects != null) {
                children.clear();
                children.addAll(viewObjects);
                return viewObjects.toArray();
            }
        }
    // if (containerType == FolderType.STABLE_SYSTEM_FOLDER_LITERAL) {
    // List<IRepositoryViewObject> children = ((ContainerRepositoryObject) element).getChildren();
    // if (children != null) {
    // return children.toArray();
    // }
    // }
    }
    return new Object[0];
}
Also used : Item(org.talend.core.model.properties.Item) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) FolderType(org.talend.core.model.properties.FolderType) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 28 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class RecycleBinContentProvider method addToMap.

private void addToMap(FolderRepositoryObject viewObj, String path) {
    ERepositoryObjectType repObjType = viewObj.getRepositoryObjectType();
    Map<String, FolderRepositoryObject> map = containerMap.get(repObjType);
    if (map == null) {
        map = new HashMap<String, FolderRepositoryObject>();
        containerMap.put(repObjType, map);
    }
    map.put(path, viewObj);
}
Also used : ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 29 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class RecycleBinContentProvider method getChildren.

@Override
public Object[] getChildren(Object element) {
    IRepositoryViewObject viewObj = (IRepositoryViewObject) element;
    ERepositoryObjectType type = viewObj.getRepositoryObjectType();
    if (viewObj instanceof FolderRepositoryObject) {
        FolderRepositoryObject containerObj = (FolderRepositoryObject) viewObj;
        if (type == IServerObjectRepositoryType.TYPE_RECYCLE_BIN) {
            buildAllDeletedFolders(containerObj);
            buildAllDeletedObjects(containerObj);
        }
        return containerObj.getChildren().toArray();
    }
    return new Object[0];
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryViewObject(org.talend.core.model.repository.RepositoryViewObject) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) FolderRepositoryObject(org.talend.mdm.repository.models.FolderRepositoryObject)

Example 30 with FolderRepositoryObject

use of org.talend.mdm.repository.models.FolderRepositoryObject in project tmdm-studio-se by Talend.

the class RemoveFromRepositoryAction method removeFolderObject.

private void removeFolderObject(IRepositoryViewObject viewObj) {
    if (removed.contains(viewObj.getId())) {
        return;
    }
    for (IRepositoryViewObject childObj : viewObj.getChildren()) {
        if (childObj instanceof FolderRepositoryObject) {
            removeFolderObject(childObj);
        } else {
            removeServerObject(childObj);
        }
    }
    removed.add(viewObj.getId());
    // 
    ContainerItem containerItem = (ContainerItem) viewObj.getProperty().getItem();
    String path = containerItem.getState().getPath();
    ERepositoryObjectType repObjType = containerItem.getRepObjType();
    ContainerCacheService.removeContainer(repObjType, path);
    FolderItem folderItem = factory.getFolderItem(ProjectManager.getInstance().getCurrentProject(), repObjType, new Path(path));
    folderItem.getState().setDeleted(true);
}
Also used : Path(org.eclipse.core.runtime.Path) ContainerItem(org.talend.mdm.repository.model.mdmproperties.ContainerItem) FolderItem(org.talend.core.model.properties.FolderItem) 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