KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > editor > fold > ApiPackageAccessor


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.editor.fold;
21
22 import javax.swing.event.DocumentEvent JavaDoc;
23 import javax.swing.text.BadLocationException JavaDoc;
24 import javax.swing.text.Document JavaDoc;
25 import org.netbeans.api.editor.fold.Fold;
26 import org.netbeans.api.editor.fold.FoldHierarchy;
27 import org.netbeans.api.editor.fold.FoldHierarchyEvent;
28 import org.netbeans.api.editor.fold.FoldStateChange;
29 import org.netbeans.api.editor.fold.FoldType;
30
31 /**
32  * Accessor for the package-private functionality in org.netbeans.api.editor.fold.
33  *
34  * @author Miloslav Metelka
35  * @version 1.00
36  */

37
38 public abstract class ApiPackageAccessor {
39     
40     private static ApiPackageAccessor INSTANCE;
41     
42     public static ApiPackageAccessor get() {
43         return INSTANCE;
44     }
45
46     /**
47      * Register the accessor. The method can only be called once
48      * - othewise it throws IllegalStateException.
49      *
50      * @param accessor instance.
51      */

52     public static void register(ApiPackageAccessor accessor) {
53         if (INSTANCE != null) {
54             throw new IllegalStateException JavaDoc("Already registered"); // NOI18N
55
}
56         INSTANCE = accessor;
57     }
58     
59     public abstract FoldHierarchy createFoldHierarchy(FoldHierarchyExecution execution);
60
61     public abstract Fold createFold(FoldOperationImpl operation,
62     FoldType type, String JavaDoc description, boolean collapsed,
63     Document JavaDoc doc, int startOffset, int endOffset,
64     int startGuardedLength, int endGuardedLength,
65     Object JavaDoc extraInfo)
66     throws BadLocationException JavaDoc;
67     
68     public abstract FoldHierarchyEvent createFoldHierarchyEvent(FoldHierarchy source,
69     Fold[] removedFolds, Fold[] addedFolds, FoldStateChange[] foldStateChanges,
70     int affectedStartOffset, int affectedEndOffset);
71
72     public abstract FoldStateChange createFoldStateChange(Fold fold);
73
74     public abstract void foldSetCollapsed(Fold fold, boolean collapsed);
75     
76     public abstract void foldSetParent(Fold fold, Fold parent);
77
78     public abstract void foldExtractToChildren(Fold fold, int index, int length, Fold targetFold);
79
80     public abstract Fold foldReplaceByChildren(Fold fold, int index);
81
82     public abstract void foldSetDescription(Fold fold, String JavaDoc description);
83
84     public abstract void foldSetStartOffset(Fold fold, Document JavaDoc doc, int startOffset)
85     throws BadLocationException JavaDoc;
86     
87     public abstract void foldSetEndOffset(Fold fold, Document JavaDoc doc, int endOffset)
88     throws BadLocationException JavaDoc;
89     
90     public abstract boolean foldIsStartDamaged(Fold fold);
91
92     public abstract boolean foldIsEndDamaged(Fold fold);
93
94     public abstract boolean foldIsExpandNecessary(Fold fold);
95
96     public abstract void foldInsertUpdate(Fold fold, DocumentEvent JavaDoc evt);
97
98     public abstract void foldRemoveUpdate(Fold fold, DocumentEvent JavaDoc evt);
99     
100     public abstract FoldOperationImpl foldGetOperation(Fold fold);
101     
102     public abstract int foldGetRawIndex(Fold fold);
103
104     public abstract void foldSetRawIndex(Fold fold, int rawIndex);
105
106     public abstract void foldUpdateRawIndex(Fold fold, int rawIndexDelta);
107
108     public abstract Object JavaDoc foldGetExtraInfo(Fold fold);
109
110     public abstract void foldStateChangeCollapsedChanged(FoldStateChange fsc);
111     
112     public abstract void foldStateChangeDescriptionChanged(FoldStateChange fsc);
113
114     public abstract void foldStateChangeStartOffsetChanged(FoldStateChange fsc,
115     int originalStartOffset);
116     
117     public abstract void foldStateChangeEndOffsetChanged(FoldStateChange fsc,
118     int originalEndOffset);
119
120 }
121
Popular Tags