equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
|
2 // Use of this source code is governed by a BSD-style license that can be |
|
3 // found in the LICENSE file. |
|
4 |
|
5 package org.chromium.debug.ui.editors; |
|
6 |
|
7 import org.eclipse.core.runtime.CoreException; |
|
8 import org.eclipse.jface.text.IDocument; |
|
9 import org.eclipse.jface.text.IDocumentPartitioner; |
|
10 import org.eclipse.jface.text.rules.FastPartitioner; |
|
11 import org.eclipse.ui.editors.text.FileDocumentProvider; |
|
12 |
|
13 /** |
|
14 * Provides JavaScript content and sets up the document partitioner. |
|
15 */ |
|
16 public class JsDocumentProvider extends FileDocumentProvider { |
|
17 |
|
18 @Override |
|
19 protected IDocument createDocument(Object element) throws CoreException { |
|
20 IDocument doc = super.createDocument(element); |
|
21 if (doc != null) { |
|
22 IDocumentPartitioner partitioner = new FastPartitioner( |
|
23 new JsPartitionScanner(), JsPartitionScanner.PARTITION_TYPES); |
|
24 partitioner.connect(doc); |
|
25 doc.setDocumentPartitioner(partitioner); |
|
26 } |
|
27 return doc; |
|
28 } |
|
29 |
|
30 } |