1 /*******************************************************************************
2  * Copyright (c) 2006, 2008 IBM Corporation and others.
3  *
4  * This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License 2.0
6  * which accompanies this distribution, and is available at
7  * https://www.eclipse.org/legal/epl-2.0/
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  *     IBM Corporation - initial API and implementation
13  *******************************************************************************/
14 package org.eclipse.ui.texteditor.rulers;
15 
16 
17 import org.eclipse.core.runtime.IConfigurationElement;
18 
19 import org.eclipse.jface.text.source.IVerticalRulerColumn;
20 
21 import org.eclipse.ui.texteditor.ITextEditor;
22 
23 
24 /**
25  * Interface that has to be implemented by contributions to the
26  * <code>org.eclipse.ui.texteditor.rulerColumns</code> extension point.
27  * <p>
28  * Implementors must have a zero-argument constructor so that they can be created
29  * by {@link IConfigurationElement#createExecutableExtension(String)}.</p>
30  *
31  * @since 3.3
32  */
33 public interface IContributedRulerColumn extends IVerticalRulerColumn {
34 
35 	/**
36 	 * Returns the extension point descriptor of this ruler.
37 	 *
38 	 * @return descriptor the extension point descriptor of this ruler or <code>null</code> if called before {@link #columnCreated()}
39 	 */
getDescriptor()40 	RulerColumnDescriptor getDescriptor();
41 
42 	/**
43 	 * Sets the extension point descriptor of this ruler.
44 	 * <p>
45 	 * <em>This method will be called by the framework and must not
46 	 * be called by clients.</em></p>
47 	 *
48 	 * @param descriptor the extension point descriptor
49 	 */
setDescriptor(RulerColumnDescriptor descriptor)50 	void setDescriptor(RulerColumnDescriptor descriptor);
51 
52 	/**
53 	 * Sets the editor (called right after the extension was instantiated).
54 	 * <p>
55 	 * <em>This method will be called by the framework and must not
56 	 * be called by clients.</em></p>
57 	 *
58 	 * @param editor the editor targeted by this ruler instance
59 	 */
setEditor(ITextEditor editor)60 	void setEditor(ITextEditor editor);
61 
62 	/**
63 	 * Returns the editor targeted by this ruler instance.
64 	 *
65 	 * @return the editor targeted by this ruler instance or <code>null</code> if called before {@link #columnCreated()}
66 	 */
getEditor()67 	ITextEditor getEditor();
68 
69 	/**
70 	 * Hook method called after a column has been instantiated, but before it is
71 	 * added to a {@link org.eclipse.jface.text.source.CompositeRuler} and
72 	 * before
73 	 * {@linkplain org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite)
74 	 * createControl} is called.
75 	 * <p>
76 	 * This happens when
77 	 * </p>
78 	 * <ul>
79 	 * <li>the column is set visible by the user or programmatically</li>
80 	 * <li>the editor is created, if this ruler targets the editor and is
81 	 * enabled by default</li>
82 	 * <li>the editor input changes and the column now targets the new editor
83 	 * contents.</li>
84 	 * </ul>
85 	 */
columnCreated()86 	void columnCreated();
87 
88 	/**
89 	 * Hook method called after a column has been removed from the
90 	 * {@link org.eclipse.jface.text.source.CompositeRuler}.
91 	 * <p>
92 	 * This happens when
93 	 * </p>
94 	 * <ul>
95 	 * <li>the column is hidden by the user or programmatically</li>
96 	 * <li>the editor is closed</li>
97 	 * <li>the editor input changes and the column no longer targets the editor
98 	 * contents.</li>
99 	 * </ul>
100 	 * <p>
101 	 * The column will not be used after this method has been called. A new
102 	 * column will be instantiated if the same column type should be shown for
103 	 * the same editor.
104 	 * </p>
105 	 */
columnRemoved()106 	void columnRemoved();
107 
108 }
109