1 11 package org.eclipse.jdt.internal.debug.ui.contentassist; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IStatus; 15 import org.eclipse.core.runtime.Status; 16 import org.eclipse.jdt.core.IType; 17 import org.eclipse.jdt.debug.ui.IJavaDebugUIConstants; 18 import org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin; 19 20 25 public class TypeContext implements IJavaDebugContentAssistContext { 26 27 private IType fType; 28 private int fPosition; 29 30 36 public TypeContext(IType type, int insertionPoistion) { 37 fType = type; 38 fPosition = insertionPoistion; 39 } 40 41 44 public IType getType() throws CoreException { 45 if (fType == null) { 46 unableToResolveType(); 47 } 48 return fType; 49 } 50 51 56 protected void unableToResolveType() throws CoreException { 57 IStatus status = new Status(IStatus.INFO, JDIDebugUIPlugin.getUniqueIdentifier(), IJavaDebugUIConstants.INTERNAL_ERROR, 58 Messages.TypeContext_0, null); 59 throw new CoreException(status); 60 } 61 62 65 public int getInsertionPosition() throws CoreException { 66 return fPosition; 67 } 68 69 72 public String [][] getLocalVariables() throws CoreException { 73 return new String [0][]; 74 } 75 76 79 public boolean isStatic() throws CoreException { 80 return false; 81 } 82 83 86 public String getSnippet(String snippet) throws CoreException { 87 return snippet; 88 } 89 90 } 91 | Popular Tags |