| /********************************************************************** |
| Copyright (c) 2000, 2003 IBM Corp. and others. |
| All rights reserved. This program and the accompanying materials |
| are made available under the terms of the Common Public License v1.0 |
| which accompanies this distribution, and is available at |
| http://www.eclipse.org/legal/cpl-v10.html |
| |
| Contributors: |
| IBM Corporation - Initial implementation |
| **********************************************************************/ |
| package org.eclipse.ui.examples.javaeditor; |
| |
| import org.eclipse.core.filebuffers.IDocumentSetupParticipant; |
| |
| import org.eclipse.jface.text.IDocument; |
| import org.eclipse.jface.text.IDocumentExtension3; |
| import org.eclipse.jface.text.IDocumentPartitioner; |
| import org.eclipse.jface.text.rules.DefaultPartitioner; |
| |
| /** |
| * |
| */ |
| public class JavaDocumentSetupParticipant implements IDocumentSetupParticipant { |
| |
| /** |
| */ |
| public JavaDocumentSetupParticipant() { |
| } |
| |
| /* |
| * @see org.eclipse.core.filebuffers.IDocumentSetupParticipant#setup(org.eclipse.jface.text.IDocument) |
| */ |
| public void setup(IDocument document) { |
| if (document instanceof IDocumentExtension3) { |
| IDocumentExtension3 extension3= (IDocumentExtension3) document; |
| IDocumentPartitioner partitioner= new DefaultPartitioner(JavaEditorExamplePlugin.getDefault().getJavaPartitionScanner(), JavaPartitionScanner.JAVA_PARTITION_TYPES); |
| extension3.setDocumentPartitioner(JavaEditorExamplePlugin.JAVA_PARTITIONING, partitioner); |
| partitioner.connect(document); |
| } |
| } |
| } |