KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > schemas > view > views > SchemaSourceViewerConfiguration


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  *
19  */

20 package org.apache.directory.ldapstudio.schemas.view.views;
21
22
23 import org.apache.directory.ldapstudio.schemas.Activator;
24 import org.eclipse.jface.text.IDocument;
25 import org.eclipse.jface.text.presentation.IPresentationReconciler;
26 import org.eclipse.jface.text.presentation.PresentationReconciler;
27 import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
28 import org.eclipse.jface.text.source.ISourceViewer;
29 import org.eclipse.jface.text.source.SourceViewerConfiguration;
30
31
32 /**
33  * This class is used to handle the display (syntax highlighting, etc.) of Schema files in the SchemaSourceViewer.
34  *
35  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
36  * @version $Rev$, $Date$
37  */

38 public class SchemaSourceViewerConfiguration extends SourceViewerConfiguration
39 {
40     /* (non-Javadoc)
41      * @see org.eclipse.jface.text.source.SourceViewerConfiguration#getPresentationReconciler(org.eclipse.jface.text.source.ISourceViewer)
42      */

43     public IPresentationReconciler getPresentationReconciler( ISourceViewer sourceViewer )
44     {
45         PresentationReconciler reconciler = new PresentationReconciler();
46         reconciler.setDocumentPartitioning( getConfiguredDocumentPartitioning( sourceViewer ) );
47
48         // Creating the damager/repairer for code
49
DefaultDamagerRepairer dr = new DefaultDamagerRepairer( Activator.getSchemaCodeScanner() );
50         reconciler.setDamager( dr, IDocument.DEFAULT_CONTENT_TYPE );
51         reconciler.setRepairer( dr, IDocument.DEFAULT_CONTENT_TYPE );
52
53         return reconciler;
54     }
55 }
56
Popular Tags