01: /*******************************************************************************
02: * Copyright (c) 2000, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.texteditor.quickdiff;
11:
12: import org.eclipse.core.runtime.CoreException;
13: import org.eclipse.core.runtime.IProgressMonitor;
14:
15: import org.eclipse.jface.text.IDocument;
16:
17: import org.eclipse.ui.texteditor.ITextEditor;
18:
19: /**
20: * The protocol a reference provider for Quick Diff has to implement. Quick Diff references provide
21: * a reference document (an <code>IDocument</code>) that is used as the original against which
22: * diff information is generated.
23: * <p>Extensions to the extension point <code>quickdiff.referenceprovider</code> have to implement
24: * this interface (plus another interface for plug-in and UI management.</p>
25: *
26: * @since 3.0
27: */
28: public interface IQuickDiffReferenceProvider {
29: /**
30: * Returns the reference document for the quick diff display.
31: *
32: * @param monitor a preference monitor to monitor / cancel the process, or <code>null</code>
33: * @return the reference document for the quick diff display or <code>null</code> if getting the
34: * document was canceled or there is no reference available.
35: * @throws CoreException if getting the document fails.
36: */
37: IDocument getReference(IProgressMonitor monitor)
38: throws CoreException;
39:
40: /**
41: * Called when the reference is no longer used and the provider can free resources.
42: */
43: void dispose();
44:
45: /**
46: * Returns the id of this reference provider.
47: *
48: * @return the id of this provider as stated in the extending plugin's manifest.
49: */
50: String getId();
51:
52: /**
53: * Sets the active editor for the provider implementation. Will usually just be called right after
54: * creation of the implementation.
55: *
56: * @param editor the active editor.
57: */
58: void setActiveEditor(ITextEditor editor);
59:
60: /**
61: * Gives the implementation a hook to publish its enablement. The action corresponding to this
62: * implementation might be grayed out or not shown at all based on the value presented here.
63: *
64: * @return <code>false</code> if the implementation cannot be executed, <code>true</code> if it can,
65: * or if it cannot be decided yet.
66: */
67: boolean isEnabled();
68:
69: /**
70: * Sets the id of this implementation. This method will be called right after creation, and
71: * <code>id</code> will be set to the <code>Id</code> attribute specified in the extension's
72: * declaration.
73: *
74: * @param id the provider's new id.
75: */
76: void setId(String id);
77: }
|