1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 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 12 package org.eclipse.ui.console; 13 14 import org.eclipse.jface.text.IDocumentPartitioner; 15 import org.eclipse.swt.custom.StyleRange; 16 17 /** 18 * A document partitioner for a text console. 19 * <p> 20 * In addition to regular partitioner duties, a console document partitioner 21 * dictates which regions in its document are read-only and provides style ranges. 22 * </p> 23 * <p> 24 * Clients may implement this interface. 25 * </p> 26 * @see org.eclipse.ui.console.TextConsole 27 * @since 3.1 28 */ 29 public interface IConsoleDocumentPartitioner extends IDocumentPartitioner { 30 31 /** 32 * Returns whether this partitioner's document is read-only at the specified 33 * offset. The user is not allowed to type in read-only locations. 34 * 35 * @param offset document offset 36 * @return whether this partitioner's document is read-only at the specified 37 * offset 38 */ 39 public boolean isReadOnly(int offset); 40 41 /** 42 * Returns style ranges for the specified region of this partitioner's document 43 * to use when rendering, or <code>null</code> if none. 44 * 45 * @param offset beginning offset for which style ranges are requested 46 * @param length the length of text for which style ranges are requested 47 * @return style ranges for the specified region of this partitioner's document 48 * to use when rendering, or <code>null</code> if none 49 */ 50 public StyleRange[] getStyleRanges(int offset, int length); 51 } 52