1 11 package org.eclipse.jdt.internal.ui.text.spelling; 12 13 import org.eclipse.jface.text.BadLocationException; 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.jface.text.IRegion; 16 17 import org.eclipse.jdt.core.compiler.CategorizedProblem; 18 19 24 public class CoreSpellingProblem extends CategorizedProblem { 25 26 public static final String MARKER_TYPE= "org.eclipse.jdt.internal.spelling"; 30 31 private int fSourceEnd= 0; 32 33 34 private int fLineNumber= 1; 35 36 37 private int fSourceStart= 0; 38 39 40 private String fMessage; 41 42 43 private String fWord; 44 45 46 private boolean fMatch; 47 48 49 private boolean fSentence; 50 51 52 private IDocument fDocument; 53 54 55 private String fOrigin; 56 57 70 public CoreSpellingProblem(int start, int end, int line, String message, String word, boolean match, boolean sentence, IDocument document, String origin) { 71 super(); 72 fSourceStart= start; 73 fSourceEnd= end; 74 fLineNumber= line; 75 fMessage= message; 76 fWord= word; 77 fMatch= match; 78 fSentence= sentence; 79 fDocument= document; 80 fOrigin= origin; 81 } 82 85 public String [] getArguments() { 86 87 String prefix= ""; String postfix= ""; 90 try { 91 92 IRegion line= fDocument.getLineInformationOfOffset(fSourceStart); 93 94 prefix= fDocument.get(line.getOffset(), fSourceStart - line.getOffset()); 95 postfix= fDocument.get(fSourceEnd + 1, line.getOffset() + line.getLength() - fSourceEnd); 96 97 } catch (BadLocationException exception) { 98 } 100 return new String [] { fWord, prefix, postfix, fSentence ? Boolean.toString(true) : Boolean.toString(false), fMatch ? Boolean.toString(true) : Boolean.toString(false) }; 101 } 102 103 106 public int getID() { 107 return JavaSpellingReconcileStrategy.SPELLING_PROBLEM_ID; 108 } 109 110 113 public String getMessage() { 114 return fMessage; 115 } 116 117 120 public char[] getOriginatingFileName() { 121 return fOrigin.toCharArray(); 122 } 123 124 127 public int getSourceEnd() { 128 return fSourceEnd; 129 } 130 131 134 public int getSourceLineNumber() { 135 return fLineNumber; 136 } 137 138 141 public int getSourceStart() { 142 return fSourceStart; 143 } 144 145 148 public boolean isError() { 149 return false; 150 } 151 152 155 public boolean isWarning() { 156 return true; 157 } 158 159 162 public void setSourceStart(int sourceStart) { 163 fSourceStart= sourceStart; 164 } 165 166 169 public void setSourceEnd(int sourceEnd) { 170 fSourceEnd= sourceEnd; 171 } 172 173 176 public void setSourceLineNumber(int lineNumber) { 177 fLineNumber= lineNumber; 178 } 179 180 183 public int getCategoryID() { 184 return CAT_JAVADOC; 185 } 186 187 190 public String getMarkerType() { 191 return MARKER_TYPE; 192 } 193 } 194 | Popular Tags |