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