blob: 2c8859f0e65a5f2804775dc020469d7f045364cf [file] [log] [blame]
nitind958d79a2004-11-23 19:23:00 +00001/*******************************************************************************
nsandonato4cf26a12011-01-12 20:02:29 +00002 * Copyright (c) 2004, 2011 IBM Corporation and others.
nitind958d79a2004-11-23 19:23:00 +00003 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
amywu923ee602007-04-10 18:32:07 +00007 *
nitind958d79a2004-11-23 19:23:00 +00008 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
david_williams63219a22005-04-10 01:59:51 +000011package org.eclipse.wst.css.core.internal.metamodel.util;
nitind958d79a2004-11-23 19:23:00 +000012
david_williams63219a22005-04-10 01:59:51 +000013import org.eclipse.wst.css.core.internal.metamodel.CSSMetaModel;
14import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
david_williams4ad020f2005-04-18 08:00:30 +000015import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
nsandonato4cf26a12011-01-12 20:02:29 +000016import org.w3c.dom.Node;
nitind958d79a2004-11-23 19:23:00 +000017
18
19public class CSSMetaModelFinder {
20 /**
21 * Constructor for CSSMetaModelFinder.
22 */
23 private CSSMetaModelFinder() {
24 super();
25 }
26
27 static synchronized public CSSMetaModelFinder getInstance() {
28 if (fInstance == null) {
29 fInstance = new CSSMetaModelFinder();
30 }
31 return fInstance;
32 }
33
34 public CSSMetaModel findMetaModelFor(ICSSNode node) {
35 return CSSProfileFinder.getInstance().findProfileFor(node).getMetaModel();
36 }
37
38 public CSSMetaModel findMetaModelFor(IStructuredModel model) {
39 return CSSProfileFinder.getInstance().findProfileFor(model).getMetaModel();
40
41 }
42
nsandonato4cf26a12011-01-12 20:02:29 +000043 /**
44 * Finds the meta model for the node that contains the css model
45 */
46 public CSSMetaModel findMetaModelFor(Node node) {
47 return CSSProfileFinder.getInstance().findProfileFor(node).getMetaModel();
48 }
49
nitind958d79a2004-11-23 19:23:00 +000050 // findMetaModelFor(Node) is not used.
51 // Even if it is used, it can be replaced with
52 // findMetaModelFor(IStructuredModel) easily
53
54 public CSSMetaModel findMetaModelFor(String baseLocation) {
55 return CSSProfileFinder.getInstance().findProfileFor(baseLocation).getMetaModel();
56 }
57
58 static private CSSMetaModelFinder fInstance = null;
amywu923ee602007-04-10 18:32:07 +000059}