1 /* 2 * The contents of this file are subject to the terms of the Common Development 3 * and Distribution License (the License). You may not use this file except in 4 * compliance with the License. 5 * 6 * You can obtain a copy of the License at http://www.netbeans.org/cddl.html 7 * or http://www.netbeans.org/cddl.txt. 8 * 9 * When distributing Covered Code, include this CDDL Header Notice in each file 10 * and include the License file at http://www.netbeans.org/cddl.txt. 11 * If applicable, add the following below the CDDL Header, with the fields 12 * enclosed by brackets [] replaced by your own identifying information: 13 * "Portions Copyrighted [year] [name of copyright owner]" 14 * 15 * The Original Software is NetBeans. The Initial Developer of the Original 16 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun 17 * Microsystems, Inc. All Rights Reserved. 18 */ 19 20 package org.netbeans.api.lexer; 21 22 /** 23 * Token hierarchy event type determines the reason 24 * why token hierarchy modification described by {@link TokenHierarchyEvent} 25 * happened. 26 * 27 * @author Miloslav Metelka 28 * @version 1.00 29 */ 30 31 public enum TokenHierarchyEventType { 32 33 /** 34 * The token change was caused by modification (insert/remove) of the characters 35 * in the underlying character sequence. 36 */ 37 MODIFICATION, 38 39 /** 40 * The token change was caused by relexing of a part of the token hierarchy 41 * without any text modification. 42 * <br/> 43 * This change is notified under modification lock (write lock) 44 * of the corresponding input source. 45 */ 46 RELEX, 47 48 /** 49 * The token change was caused by a complete rebuild 50 * of the token hierarchy. 51 * <br/> 52 * That may be necessary because of changes 53 * in input attributes that influence the lexing. 54 * <br/> 55 * When the whole hierarchy is rebuilt only the removed tokens 56 * will be notified. There will be no added tokens 57 * because they will be created lazily when asked. 58 * <br/> 59 * This change is notified under modification lock (write lock) 60 * of the corresponding input source. 61 */ 62 REBUILD, 63 64 /** 65 * The token change was caused by change in activity 66 * of the token hierarchy. 67 * <br/> 68 * The current activity state can be determined by {@link TokenHierarchy#isActive()}. 69 * <br/> 70 * Firing an event with this type may happen because the input source 71 * (for which the token hierarchy was created) has not been used for a long time 72 * and its token hierarchy is being deactivated. Or the token hierarchy is just going 73 * to be activated again. 74 * <br/> 75 * The hierarchy will only notify the tokens being removed (for the case when 76 * the hierarchy is going to be deactivated). There will be no added tokens 77 * because they will be created lazily when asked. 78 * <br/> 79 * This change is notified under modification lock (write lock) 80 * of the corresponding input source. 81 */ 82 ACTIVITY, 83 84 /** 85 * Custom language embedding was created by 86 * {@link TokenSequence#createEmbedding(Language,int,int)}. 87 * <br/> 88 * The {@link TokenHierarchyEvent#tokenChange()} contains the token 89 * where the embedding was created and the embedded change 90 * {@link TokenChange#embeddedChange(int)} that describes the added 91 * embedded language. 92 */ 93 EMBEDDING, 94 95 /** 96 * Notification that result of 97 * {@link TokenHierarchy#languagePaths()} has changed. 98 */ 99 LANGUAGE_PATHS; 100 101 }