本文整理匯總了Java中org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor類的典型用法代碼示例。如果您正苦於以下問題:Java JavaCorrectionProcessor類的具體用法?Java JavaCorrectionProcessor怎麽用?Java JavaCorrectionProcessor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JavaCorrectionProcessor類屬於org.eclipse.jdt.internal.ui.text.correction包,在下文中一共展示了JavaCorrectionProcessor類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: collectAssists
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
protected static final ArrayList collectAssists(IInvocationContext context, Class[] filteredTypes)
throws CoreException {
ArrayList proposals = new ArrayList();
IStatus status =
JavaCorrectionProcessor.collectAssists(context, new IProblemLocation[0], proposals);
assertStatusOk(status);
if (!proposals.isEmpty()) {
assertTrue("should be marked as 'has assist'", JavaCorrectionProcessor.hasAssists(context));
}
if (filteredTypes != null && filteredTypes.length > 0) {
for (Iterator iter = proposals.iterator(); iter.hasNext(); ) {
if (isFiltered(iter.next(), filteredTypes)) {
iter.remove();
}
}
}
return proposals;
}
示例2: initializeImage
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private void initializeImage() {
// http://bugs.eclipse.org/bugs/show_bug.cgi?id=18936
if (!fImageInitialized) {
initializeImages();
if (!isQuickFixableStateSet())
setQuickFixable(isProblem() && indicateQuixFixableProblems() && JavaCorrectionProcessor.hasCorrections(this)); // no light bulb for tasks
if (isQuickFixable()) {
if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(getType()))
fImage= fgQuickFixErrorImage;
else
fImage= fgQuickFixImage;
} else {
String type= getType();
if (JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(type))
fImage= fgTaskImage;
else if (JavaMarkerAnnotation.INFO_ANNOTATION_TYPE.equals(type))
fImage= fgInfoImage;
else if (JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE.equals(type))
fImage= fgWarningImage;
else if (JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE.equals(type))
fImage= fgErrorImage;
}
fImageInitialized= true;
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:26,代碼來源:CompilationUnitDocumentProvider.java
示例3: getJavaAnnotationFixes
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private ICompletionProposal[] getJavaAnnotationFixes(IJavaAnnotation javaAnnotation) {
ProblemLocation location= new ProblemLocation(position.getOffset(), position.getLength(), javaAnnotation);
ICompilationUnit cu= javaAnnotation.getCompilationUnit();
if (cu == null)
return NO_PROPOSALS;
ISourceViewer sourceViewer= null;
if (viewer instanceof ISourceViewer)
sourceViewer= (ISourceViewer) viewer;
IInvocationContext context= new AssistContext(cu, sourceViewer, location.getOffset(), location.getLength(), SharedASTProvider.WAIT_ACTIVE_ONLY);
if (!SpellingAnnotation.TYPE.equals(javaAnnotation.getType()) && !hasProblem(context.getASTRoot().getProblems(), location))
return NO_PROPOSALS;
ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
JavaCorrectionProcessor.collectCorrections(context, new IProblemLocation[] { location }, proposals);
Collections.sort(proposals, new CompletionProposalComparator());
return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
示例4: computeAssistProposals
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public Proposals computeAssistProposals(
IJavaProject project, String fqn, int offset, List<Problem> problems) throws CoreException {
ICompilationUnit compilationUnit;
IType type = project.findType(fqn);
if (type == null) {
return null;
}
if (type.isBinary()) {
throw new JavaModelException(
new JavaModelStatus(
IJavaModelStatusConstants.CORE_EXCEPTION,
"Can't calculate Quick Assist on binary file"));
} else {
compilationUnit = type.getCompilationUnit();
}
IBuffer buffer = compilationUnit.getBuffer();
ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
bufferManager.connect(compilationUnit.getPath(), LocationKind.IFILE, new NullProgressMonitor());
ITextFileBuffer textFileBuffer =
bufferManager.getTextFileBuffer(compilationUnit.getPath(), LocationKind.IFILE);
IDocument document = textFileBuffer.getDocument();
TextViewer viewer = new TextViewer(document, new Point(offset, 0));
AssistContext context = new AssistContext(compilationUnit, offset, 0);
ArrayList proposals = new ArrayList<>();
JavaCorrectionProcessor.collectProposals(context, problems, true, true, proposals);
return convertProposals(offset, compilationUnit, viewer, proposals);
}
示例5: assertCorrectContext
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
public static void assertCorrectContext(IInvocationContext context, ProblemLocation problem) {
if (problem.getProblemId() != 0) {
if (!JavaCorrectionProcessor.hasCorrections(
context.getCompilationUnit(), problem.getProblemId(), problem.getMarkerType())) {
assertTrue("Problem type not marked with light bulb: " + problem, false);
}
}
}
示例6: collectCorrections
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
protected static ArrayList collectCorrections(
IInvocationContext context, IProblemLocation problem) throws CoreException {
ArrayList proposals = new ArrayList();
IStatus status =
JavaCorrectionProcessor.collectCorrections(
context, new IProblemLocation[] {problem}, proposals);
assertStatusOk(status);
return proposals;
}
示例7: getMarkerAnnotationFixes
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private ICompletionProposal[] getMarkerAnnotationFixes(MarkerAnnotation markerAnnotation) {
if (markerAnnotation.isQuickFixableStateSet() && !markerAnnotation.isQuickFixable())
return NO_PROPOSALS;
IMarker marker= markerAnnotation.getMarker();
ICompilationUnit cu= getCompilationUnit(marker);
if (cu == null)
return NO_PROPOSALS;
IEditorInput input= EditorUtility.getEditorInput(cu);
if (input == null)
return NO_PROPOSALS;
IAnnotationModel model= JavaUI.getDocumentProvider().getAnnotationModel(input);
if (model == null)
return NO_PROPOSALS;
ISourceViewer sourceViewer= null;
if (viewer instanceof ISourceViewer)
sourceViewer= (ISourceViewer) viewer;
AssistContext context= new AssistContext(cu, sourceViewer, position.getOffset(), position.getLength());
ArrayList<IJavaCompletionProposal> proposals= new ArrayList<IJavaCompletionProposal>();
JavaCorrectionProcessor.collectProposals(context, model, new Annotation[] { markerAnnotation }, true, false, proposals);
return proposals.toArray(new ICompletionProposal[proposals.size()]);
}
示例8: findJavaAnnotation
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private void findJavaAnnotation() {
fPosition= null;
fAnnotation= null;
fHasCorrection= false;
AbstractMarkerAnnotationModel model= getAnnotationModel();
IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();
IDocument document= getDocument();
if (model == null)
return ;
boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
Iterator<Annotation> iter= model.getAnnotationIterator();
int layer= Integer.MIN_VALUE;
while (iter.hasNext()) {
Annotation annotation= iter.next();
if (annotation.isMarkedDeleted())
continue;
int annotationLayer= layer;
if (annotationAccess != null) {
annotationLayer= annotationAccess.getLayer(annotation);
if (annotationLayer < layer)
continue;
}
Position position= model.getPosition(annotation);
if (!includesRulerLine(position, document))
continue;
AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
if (preference == null)
continue;
String key= preference.getVerticalRulerPreferenceKey();
if (key == null)
continue;
if (!fStore.getBoolean(key))
continue;
boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
if (!isReadOnly
&& (
((hasAssistLightbulb && annotation instanceof AssistAnnotation)
|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
fPosition= position;
fAnnotation= annotation;
fHasCorrection= true;
layer= annotationLayer;
continue;
} else if (!fHasCorrection) {
fPosition= position;
fAnnotation= annotation;
layer= annotationLayer;
}
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:62,代碼來源:JavaSelectAnnotationRulerAction.java
示例9: isQuickFixTarget
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private boolean isQuickFixTarget(Annotation a) {
return JavaCorrectionProcessor.hasCorrections(a) || a instanceof AssistAnnotation;
}
示例10: showQuickFix
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private boolean showQuickFix(IJavaAnnotation annotation) {
return fShowQuickFixIcon && annotation.isProblem() && JavaCorrectionProcessor.hasCorrections((Annotation) annotation);
}
示例11: isIncluded
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private boolean isIncluded(IJavaAnnotation annotation, boolean showTemporaryProblems) {
// XXX: see https://bugs.eclipse.org/bugs/show_bug.cgi?id=138601
if (annotation instanceof ProblemAnnotation && JavaMarkerAnnotation.TASK_ANNOTATION_TYPE.equals(annotation.getType()))
return false;
if (!annotation.isProblem())
return true;
if (annotation.isMarkedDeleted() && !annotation.hasOverlay())
return true;
if (annotation.hasOverlay() && !annotation.isMarkedDeleted())
return true;
if (annotation.hasOverlay())
return (!isIncluded(annotation.getOverlay(), showTemporaryProblems));
return showTemporaryProblems && JavaCorrectionProcessor.hasCorrections((Annotation)annotation);
}
示例12: findJavaAnnotation
import org.eclipse.jdt.internal.ui.text.correction.JavaCorrectionProcessor; //導入依賴的package包/類
private void findJavaAnnotation() {
fPosition= null;
fAnnotation= null;
fHasCorrection= false;
AbstractMarkerAnnotationModel model= getAnnotationModel();
IAnnotationAccessExtension annotationAccess= getAnnotationAccessExtension();
IDocument document= getDocument();
if (model == null)
return ;
boolean hasAssistLightbulb= fStore.getBoolean(PreferenceConstants.EDITOR_QUICKASSIST_LIGHTBULB);
Iterator<Annotation> iter= model.getAnnotationIterator();
int layer= Integer.MIN_VALUE;
while (iter.hasNext()) {
Annotation annotation= iter.next();
if (annotation.isMarkedDeleted())
continue;
int annotationLayer= layer;
if (annotationAccess != null) {
annotationLayer= annotationAccess.getLayer(annotation);
if (annotationLayer < layer)
continue;
}
Position position= model.getPosition(annotation);
if (!includesRulerLine(position, document))
continue;
boolean isReadOnly= fTextEditor instanceof ITextEditorExtension && ((ITextEditorExtension)fTextEditor).isEditorInputReadOnly();
if (!isReadOnly
&& (
((hasAssistLightbulb && annotation instanceof AssistAnnotation)
|| JavaCorrectionProcessor.hasCorrections(annotation)))) {
fPosition= position;
fAnnotation= annotation;
fHasCorrection= true;
layer= annotationLayer;
continue;
} else if (!fHasCorrection) {
AnnotationPreference preference= fAnnotationPreferenceLookup.getAnnotationPreference(annotation);
if (preference == null)
continue;
String key= preference.getVerticalRulerPreferenceKey();
if (key == null)
continue;
if (fStore.getBoolean(key)) {
fPosition= position;
fAnnotation= annotation;
layer= annotationLayer;
}
}
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:61,代碼來源:JavaSelectAnnotationRulerAction.java