Initialize
[sdk/ide/product.git] / org.eclipse.jst.pagedesigner / src / org / eclipse / jst / pagedesigner / css2 / style / StyleUtil.java
1 /*******************************************************************************\r
2  * Copyright (c) 2006 Sybase, Inc. and others.\r
3  *\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     Sybase, Inc. - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.eclipse.jst.pagedesigner.css2.style;\r
13 \r
14 import org.eclipse.jst.pagedesigner.css2.ICSSStyle;\r
15 \r
16 /**\r
17  * @author mengbo\r
18  * @version 1.5\r
19  */\r
20 public final class StyleUtil {\r
21         /**\r
22          * @param style\r
23          * @return true if the style is in a widget\r
24          */\r
25         public static boolean isInWidget(ICSSStyle style) {\r
26                 while (style != null && style != DefaultStyle.getInstance()) {\r
27                         ITagEditInfo info = (ITagEditInfo) style\r
28                                         .getAdapter(ITagEditInfo.class);\r
29                         if (info != null && info.isWidget()) {\r
30                                 return true;\r
31                         }\r
32 \r
33                         style = style.getParentStyle();\r
34                 }\r
35                 return false;\r
36         }\r
37         \r
38         private StyleUtil()\r
39         {\r
40             // util class\r
41         }\r
42 }\r