nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2004 IBM Corporation and others. |
| 3 | * 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 |
| 7 | * |
| 8 | * Contributors: |
| 9 | * IBM Corporation - initial API and implementation |
| 10 | *******************************************************************************/ |
david_williams | 63219a2 | 2005-04-10 01:59:51 +0000 | [diff] [blame] | 11 | package org.eclipse.wst.css.core.internal.metamodelimpl; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 12 | |
david_williams | 63219a2 | 2005-04-10 01:59:51 +0000 | [diff] [blame] | 13 | import org.eclipse.wst.css.core.internal.metamodel.CSSMMNode; |
| 14 | import org.eclipse.wst.css.core.internal.metamodel.CSSMMStyleSheet; |
nitind | 958d79a | 2004-11-23 19:23:00 +0000 | [diff] [blame] | 15 | |
| 16 | class CSSMMStyleSheetImpl extends CSSMMNodeImpl implements CSSMMStyleSheet { |
| 17 | |
| 18 | |
| 19 | public CSSMMStyleSheetImpl() { |
| 20 | super(); |
| 21 | } |
| 22 | |
| 23 | public String getType() { |
| 24 | return TYPE_STYLE_SHEET; |
| 25 | } |
| 26 | |
| 27 | public String getName() { |
| 28 | return NAME_NOT_AVAILABLE; |
| 29 | } |
| 30 | |
| 31 | /* |
| 32 | * @see CSSMMNodeImpl#canContain(CSSMMNode) |
| 33 | */ |
| 34 | boolean canContain(CSSMMNode child) { |
| 35 | if (child == null) { |
| 36 | return false; |
| 37 | } |
| 38 | String type = child.getType(); |
| 39 | return (type == TYPE_CHARSET_RULE || type == TYPE_IMPORT_RULE || type == TYPE_PAGE_RULE || type == TYPE_MEDIA_RULE || type == TYPE_FONT_FACE_RULE || type == TYPE_STYLE_RULE); |
| 40 | } |
| 41 | |
| 42 | short getError() { |
| 43 | if (getChildCount() == 0) { |
| 44 | return MetaModelErrors.ERROR_NO_CHILD; |
| 45 | } |
| 46 | else { |
| 47 | return MetaModelErrors.NO_ERROR; |
| 48 | } |
| 49 | } |
| 50 | } |