Search in sources :

Example 1 with IReferencedProjectService

use of org.talend.core.ui.IReferencedProjectService in project tdq-studio-se by Talend.

the class DQRepositoryViewLabelProvider method getForeground.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider#getForeground(java.lang.Object)
     */
@Override
public Color getForeground(Object element) {
    RepositoryNode node = (RepositoryNode) element;
    if (node instanceof RecycleBinRepNode) {
        return super.getForeground(element);
    }
    if (node.getObject() != null) {
        switch(node.getType()) {
            case REFERENCED_PROJECT:
                return STABLE_PRIMARY_ENTRY_COLOR;
            case STABLE_SYSTEM_FOLDER:
            case SYSTEM_FOLDER:
                if (node.getContentType() == ERepositoryObjectType.TDQ_DATA_PROFILING || node.getContentType() == ERepositoryObjectType.METADATA || node.getContentType() == ERepositoryObjectType.TDQ_SYSTEM_INDICATORS || node.getContentType() == ERepositoryObjectType.TDQ_PATTERN_REGEX) {
                    return STABLE_PRIMARY_ENTRY_COLOR;
                }
                return STABLE_SECONDARY_ENTRY_COLOR;
            default:
                ERepositoryStatus repositoryStatus = node.getObject().getRepositoryStatus();
                if (repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER) {
                    return LOCKED_ENTRY;
                }
                if (org.talend.core.PluginChecker.isRefProjectLoaded()) {
                    IReferencedProjectService service = (IReferencedProjectService) GlobalServiceRegister.getDefault().getService(IReferencedProjectService.class);
                    if (service != null && service.isMergeRefProject()) {
                        IRepositoryViewObject object = node.getObject();
                        if (object != null) {
                            org.talend.core.model.properties.Project mainProject = ProjectManager.getInstance().getCurrentProject().getEmfProject();
                            String projectLabel = object.getProjectLabel();
                            if (!mainProject.getLabel().equals(projectLabel)) {
                                return MERGED_REFERENCED_ITEMS_COLOR;
                            }
                        }
                    }
                }
        }
    }
    return super.getForeground(element);
}
Also used : ERepositoryStatus(org.talend.commons.runtime.model.repository.ERepositoryStatus) IReferencedProjectService(org.talend.core.ui.IReferencedProjectService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RecycleBinRepNode(org.talend.dq.nodes.RecycleBinRepNode)

Aggregations

ERepositoryStatus (org.talend.commons.runtime.model.repository.ERepositoryStatus)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 IReferencedProjectService (org.talend.core.ui.IReferencedProjectService)1 RecycleBinRepNode (org.talend.dq.nodes.RecycleBinRepNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1 RepositoryNode (org.talend.repository.model.RepositoryNode)1