jeffliu | ec1c478 | 2006-05-24 14:16:24 +0000 | [diff] [blame] | 1 | /******************************************************************************* |
nitind | 1bf20a1 | 2005-09-15 11:48:15 +0000 | [diff] [blame] | 2 | * Copyright (c) 2005 IBM Corporation and others. |
jeffliu | ec1c478 | 2006-05-24 14:16:24 +0000 | [diff] [blame] | 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
nitind | 1bf20a1 | 2005-09-15 11:48:15 +0000 | [diff] [blame] | 5 | * which accompanies this distribution, and is available at |
jeffliu | ec1c478 | 2006-05-24 14:16:24 +0000 | [diff] [blame] | 6 | * http://www.eclipse.org/legal/epl-v10.html |
nitind | 1bf20a1 | 2005-09-15 11:48:15 +0000 | [diff] [blame] | 7 | * |
| 8 | * Contributors: |
jeffliu | ec1c478 | 2006-05-24 14:16:24 +0000 | [diff] [blame] | 9 | * IBM Corporation - initial API and implementation |
| 10 | * Jens Lukowski/Innoopract - initial renaming/restructuring |
| 11 | * |
| 12 | *******************************************************************************/ |
nitind | 1bf20a1 | 2005-09-15 11:48:15 +0000 | [diff] [blame] | 13 | package org.eclipse.wst.xml.ui.internal.correction; |
| 14 | |
| 15 | import org.eclipse.jface.text.contentassist.ContentAssistant; |
| 16 | import org.eclipse.jface.text.contentassist.IContentAssistProcessor; |
| 17 | import org.eclipse.jface.text.contentassist.IContentAssistant; |
| 18 | import org.eclipse.jface.text.source.ISourceViewer; |
| 19 | import org.eclipse.wst.sse.ui.internal.correction.CorrectionAssistantProvider; |
pavery | b0f98c5 | 2006-02-13 20:19:39 +0000 | [diff] [blame] | 20 | import org.eclipse.wst.xml.core.text.IXMLPartitions; |
nitind | 1bf20a1 | 2005-09-15 11:48:15 +0000 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Correction assistant for XML |
| 24 | */ |
| 25 | public class CorrectionAssistantProviderXML extends CorrectionAssistantProvider { |
| 26 | |
| 27 | public IContentAssistant getCorrectionAssistant(ISourceViewer sourceViewer) { |
| 28 | IContentAssistant ca = null; |
| 29 | |
| 30 | if (sourceViewer != null) { |
| 31 | ContentAssistant assistant = new ContentAssistant(); |
| 32 | |
| 33 | if (sourceViewer != null) { |
| 34 | IContentAssistProcessor correctionProcessor = new CorrectionProcessorXML(sourceViewer); |
| 35 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.XML_DEFAULT); |
| 36 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.XML_CDATA); |
| 37 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.XML_COMMENT); |
| 38 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.XML_DECLARATION); |
| 39 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.XML_PI); |
| 40 | assistant.setContentAssistProcessor(correctionProcessor, IXMLPartitions.DTD_SUBSET); |
| 41 | } |
| 42 | ca = assistant; |
| 43 | } |
| 44 | |
| 45 | return ca; |
| 46 | } |
| 47 | |
| 48 | } |