001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.web.core.syntax.deprecated;
043:
044: import java.util.logging.Level;
045: import java.util.logging.Logger;
046: import org.netbeans.modules.web.core.syntax.deprecated.JspJavaFakeTokenContext;
047: import org.netbeans.editor.BaseTokenID;
048: import org.netbeans.editor.TokenContext;
049: import org.netbeans.editor.TokenContextPath;
050: import org.netbeans.editor.ext.html.HTMLTokenContext;
051: import org.netbeans.editor.ext.plain.PlainTokenContext;
052: import org.netbeans.modules.web.core.syntax.deprecated.ELTokenContext;
053:
054: /**
055: * Token context for JSP.
056: *
057: * @author Miloslav Metelka
058: * @deprecated Use JSP Lexer instead
059: */
060:
061: public class JspMultiTokenContext extends TokenContext {
062:
063: // Jsp token numericIDs
064: public static final int ERROR_ID = 1;
065:
066: /** jsp-error token-id */
067: public static final BaseTokenID ERROR = new BaseTokenID("error",
068: ERROR_ID); // NOI18N
069:
070: // Context instance declaration
071: public static final JspMultiTokenContext context = new JspMultiTokenContext();
072:
073: public static final TokenContextPath contextPath = context
074: .getContextPath();
075:
076: /** Path for jsp-tags in jsp */
077: public static final TokenContextPath jspTagContextPath = context
078: .getContextPath(JspTagTokenContext.contextPath);
079:
080: /** Path for Expression Language tokens in jsp */
081: public static final TokenContextPath elContextPath = context
082: .getContextPath(ELTokenContext.contextPath);
083:
084: /** Path for java tokens in jsp */
085: public static final TokenContextPath javaScriptletContextPath = context
086: .getContextPath(JspJavaFakeTokenContext.JavaScriptletTokenContext.contextPath);
087:
088: public static final TokenContextPath javaExpressionContextPath = context
089: .getContextPath(JspJavaFakeTokenContext.JavaExpressionTokenContext.contextPath);
090:
091: public static final TokenContextPath javaDeclarationContextPath = context
092: .getContextPath(JspJavaFakeTokenContext.JavaDeclarationTokenContext.contextPath);
093:
094: /** Path for HTML tokens in jsp */
095: public static final TokenContextPath htmlContextPath = context
096: .getContextPath(HTMLTokenContext.contextPath);
097:
098: /** Path for plain tokens in jsp */
099: public static final TokenContextPath plainContextPath = context
100: .getContextPath(PlainTokenContext.contextPath);
101:
102: private JspMultiTokenContext() {
103: super (
104: "jsp-",
105: new TokenContext[] { // NOI18N
106: JspTagTokenContext.context,
107: ELTokenContext.context,
108: JspJavaFakeTokenContext.JavaScriptletTokenContext.context,
109: JspJavaFakeTokenContext.JavaDeclarationTokenContext.context,
110: JspJavaFakeTokenContext.JavaExpressionTokenContext.context,
111: HTMLTokenContext.context,
112: PlainTokenContext.context });
113:
114: try {
115: addDeclaredTokenIDs();
116: } catch (Exception e) {
117: Logger.getLogger("global").log(Level.INFO, null, e);
118: }
119:
120: }
121:
122: }
|