KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > texteditor > quickdiff > IQuickDiffReferenceProvider


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.texteditor.quickdiff;
12
13 import org.eclipse.core.runtime.CoreException;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import org.eclipse.jface.text.IDocument;
17
18 import org.eclipse.ui.texteditor.ITextEditor;
19
20
21 /**
22  * The protocol a reference provider for Quick Diff has to implement. Quick Diff references provide
23  * a reference document (an <code>IDocument</code>) that is used as the original against which
24  * diff information is generated.
25  * <p>Extensions to the extension point <code>quickdiff.referenceprovider</code> have to implement
26  * this interface (plus another interface for plug-in and UI management.</p>
27  *
28  * @since 3.0
29  */

30 public interface IQuickDiffReferenceProvider {
31     /**
32      * Returns the reference document for the quick diff display.
33      *
34      * @param monitor a preference monitor to monitor / cancel the process, or <code>null</code>
35      * @return the reference document for the quick diff display or <code>null</code> if getting the
36      * document was canceled or there is no reference available.
37      * @throws CoreException if getting the document fails.
38      */

39     IDocument getReference(IProgressMonitor monitor) throws CoreException;
40
41     /**
42      * Called when the reference is no longer used and the provider can free resources.
43      */

44     void dispose();
45
46     /**
47      * Returns the id of this reference provider.
48      *
49      * @return the id of this provider as stated in the extending plugin's manifest.
50      */

51     String JavaDoc getId();
52
53     /**
54      * Sets the active editor for the provider implementation. Will usually just be called right after
55      * creation of the implementation.
56      *
57      * @param editor the active editor.
58      */

59     void setActiveEditor(ITextEditor editor);
60
61     /**
62      * Gives the implementation a hook to publish its enablement. The action corresponding to this
63      * implementation might be grayed out or not shown at all based on the value presented here.
64      *
65      * @return <code>false</code> if the implementation cannot be executed, <code>true</code> if it can,
66      * or if it cannot be decided yet.
67      */

68     boolean isEnabled();
69
70     /**
71      * Sets the id of this implementation. This method will be called right after creation, and
72      * <code>id</code> will be set to the <code>Id</code> attribute specified in the extension's
73      * declaration.
74      *
75      * @param id the provider's new id.
76      */

77     void setId(String JavaDoc id);
78 }
79
Popular Tags