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.jdt.core; 12 13 import org.eclipse.core.runtime.IPath; 14 import org.eclipse.core.runtime.IStatus; 15 16 /** 17 * Represents the outcome of an Java model operation. Status objects are 18 * used inside <code>JavaModelException</code> objects to indicate what went 19 * wrong. 20 * <p> 21 * Java model status object are distinguished by their plug-in id: 22 * <code>getPlugin</code> returns <code>"org.eclipse.jdt.core"</code>. 23 * <code>getCode</code> returns one of the status codes declared in 24 * <code>IJavaModelStatusConstants</code>. 25 * </p> 26 * <p> 27 * A Java model status may also carry additional information (that is, in 28 * addition to the information defined in <code>IStatus</code>): 29 * <ul> 30 * <li>elements - optional handles to Java elements associated with the failure</li> 31 * <li>string - optional string associated with the failure</li> 32 * </ul> 33 * <p> 34 * This interface is not intended to be implemented by clients. 35 * </p> 36 * 37 * @see org.eclipse.core.runtime.IStatus 38 * @see IJavaModelStatusConstants 39 */ 40 public interface IJavaModelStatus extends IStatus { 41 /** 42 * Returns any Java elements associated with the failure (see specification 43 * of the status code), or an empty array if no elements are related to this 44 * particular status code. 45 * 46 * @return the list of Java element culprits 47 * @see IJavaModelStatusConstants 48 */ 49 IJavaElement[] getElements(); 50 /** 51 * Returns the path associated with the failure (see specification 52 * of the status code), or <code>null</code> if the failure is not 53 * one of <code>DEVICE_PATH</code>, <code>INVALID_PATH</code>, 54 * <code>PATH_OUTSIDE_PROJECT</code>, or <code>RELATIVE_PATH</code>. 55 * 56 * @return the path that caused the failure, or <code>null</code> if none 57 * @see IJavaModelStatusConstants#DEVICE_PATH 58 * @see IJavaModelStatusConstants#INVALID_PATH 59 * @see IJavaModelStatusConstants#PATH_OUTSIDE_PROJECT 60 * @see IJavaModelStatusConstants#RELATIVE_PATH 61 */ 62 IPath getPath(); 63 /** 64 * Returns the string associated with the failure (see specification 65 * of the status code), or <code>null</code> if no string is related to this 66 * particular status code. 67 * 68 * @return the string culprit, or <code>null</code> if none 69 * @see IJavaModelStatusConstants 70 * @deprecated Use {@link IStatus#getMessage()} instead 71 */ 72 String getString(); 73 /** 74 * Returns whether this status indicates that a Java model element does not exist. 75 * This convenience method is equivalent to 76 * <code>getCode() == IJavaModelStatusConstants.ELEMENT_DOES_NOT_EXIST</code>. 77 * 78 * @return <code>true</code> if the status code indicates that a Java model 79 * element does not exist 80 * @see IJavaModelStatusConstants#ELEMENT_DOES_NOT_EXIST 81 */ 82 boolean isDoesNotExist(); 83 } 84