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 package org.eclipse.ltk.core.refactoring; 12 13 /** 14 * A <code>RefactoringStatusContext</code> can be used to annotate a 15 * {@link RefactoringStatusEntry} with additional information 16 * typically presented in the user interface. 17 * <p> 18 * To present a context in the user interface a corresponding context 19 * viewer can be registered via the extension point <code> 20 * org.eclipse.ltk.ui.refactoring.statusContextViewers</code>. 21 * </p> 22 * <p> 23 * This class may be subclassed by clients. 24 * </p> 25 * 26 * @since 3.0 27 */ 28 public abstract class RefactoringStatusContext { 29 /** 30 * Returns the element that corresponds directly to this context, 31 * or <code>null</code> if there is no corresponding element. 32 * <p> 33 * For example, the corresponding element of a context for a problem 34 * detected in an <code>IResource</code> would be the resource itself. 35 * <p> 36 * 37 * @return the corresponding element 38 */ 39 public abstract Object getCorrespondingElement(); 40 41 /* 42 * @see java.lang.Object#toString() 43 */ 44 public String toString() { 45 Object element= getCorrespondingElement(); 46 return element == null ? null : element.toString(); 47 } 48 } 49