| /******************************************************************************* |
| * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation |
| *******************************************************************************/ |
| |
| package org.eclipse.ui.externaltools.internal.ant.editor.text; |
| |
| |
| import org.eclipse.core.runtime.IProgressMonitor; |
| import org.eclipse.jface.text.IDocument; |
| import org.eclipse.jface.text.IRegion; |
| import org.eclipse.jface.text.reconciler.DirtyRegion; |
| import org.eclipse.jface.text.reconciler.IReconcilingStrategy; |
| import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension; |
| import org.eclipse.ui.externaltools.internal.ant.editor.outline.AntModel; |
| import org.eclipse.ui.texteditor.IDocumentProvider; |
| import org.eclipse.ui.texteditor.ITextEditor; |
| |
| |
| public class XMLReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension { |
| |
| private ITextEditor fEditor; |
| |
| public XMLReconcilingStrategy(ITextEditor editor) { |
| fEditor= editor; |
| } |
| |
| private void internalReconcile() { |
| IDocumentProvider provider= fEditor.getDocumentProvider(); |
| if (provider instanceof PlantyDocumentProvider) { |
| PlantyDocumentProvider documentProvider= (PlantyDocumentProvider) provider; |
| AntModel model= documentProvider.getAntModel(fEditor.getEditorInput()); |
| if (model != null) |
| model.reconcile(); |
| } |
| } |
| |
| /* |
| * @see IReconcilingStrategy#reconcile(IRegion) |
| */ |
| public void reconcile(IRegion partition) { |
| internalReconcile(); |
| } |
| |
| /* |
| * @see IReconcilingStrategy#reconcile(DirtyRegion, IRegion) |
| */ |
| public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) { |
| internalReconcile(); |
| } |
| |
| /* |
| * @see IReconcilingStrategy#setDocument(IDocument) |
| */ |
| public void setDocument(IDocument document) { |
| } |
| |
| /* |
| * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) |
| */ |
| public void setProgressMonitor(IProgressMonitor monitor) { |
| } |
| |
| /* |
| * @see org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension#initialReconcile() |
| */ |
| public void initialReconcile() { |
| internalReconcile(); |
| } |
| } |