Skip to main content
summaryrefslogtreecommitdiffstats
blob: d3bdc14e0a53a890ade172d4bf03fbc43b52b9be (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
 * Copyright (c) 2011 Mia-Software.
 * 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 * 	Gregoire Dupe (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
 *  Nicolas Guyomar (Mia-Software) - Bug 333553 - The user has not to deal with two files to create a facet
 *  Nicolas Bros (Mia-Software) - Bug 361617 - Deprecation of APIs for the old Facet metamodels
 */
package org.eclipse.emf.facet.efacet.core.internal.catalog;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.facet.efacet.FacetSet;
import org.eclipse.emf.facet.efacet.QuerySet;
import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.EfacetcatalogFactory;
import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.FacetSetCatalog;
import org.eclipse.emf.facet.efacet.catalog.efacetcatalog.QuerySetCatalog;
import org.eclipse.emf.facet.efacet.core.internal.Messages;
import org.eclipse.emf.facet.util.emf.catalog.CatalogSet;
import org.eclipse.emf.facet.util.emf.core.ICatalogManager;

/** @deprecated replaced by {@link EFacetCatalogManager2} for the new eFacet2 metamodel */
@Deprecated
public class EFacetCatalogManager implements ICatalogManager {

	private final FacetSetCatalog facetSetCatalog;
	private final QuerySetCatalog querySetCatalog;

	public EFacetCatalogManager() {
		this.facetSetCatalog = EfacetcatalogFactory.eINSTANCE.createFacetSetCatalog();
		this.facetSetCatalog.setName(Messages.EFacetCatalogManager_FacetSetCatalogName);
		this.querySetCatalog = EfacetcatalogFactory.eINSTANCE.createQuerySetCatalog();
		this.querySetCatalog.setName(Messages.EFacetCatalogManager_QuerySetCatalogName);
	}

	public boolean canBeManaged(final EObject root) {
		return root instanceof QuerySet || root instanceof FacetSet;
	}

	public void manage(final EObject root) {
		if (root instanceof FacetSet) {
			FacetSet facetSet = (FacetSet) root;
			this.facetSetCatalog.getInstalledEntries().add(facetSet);
		} else if (root instanceof QuerySet) {
			QuerySet querySet = (QuerySet) root;
			this.querySetCatalog.getInstalledEntries().add(querySet);
		}
	}

	public void setCatalogSet(final CatalogSet catalogSet) {
		catalogSet.getCatalogs().add(this.facetSetCatalog);
		catalogSet.getCatalogs().add(this.querySetCatalog);
	}
}

Back to the top