Java 类org.eclipse.ui.texteditor.MarkerAnnotation 实例源码

项目:ec4e    文件:EditorConfigTextHover.java   
/***
 * Returns true if it exists a marker annotation in the given offset and false
 * otherwise.
 *
 * @param textViewer
 * @param offset
 * @return true if it exists a marker annotation in the given offset and false
 *         otherwise.
 */
private static boolean hasProblem(ITextViewer textViewer, int offset) {
    if (!(textViewer instanceof ISourceViewer)) {
        return false;
    }

    IAnnotationModel annotationModel = ((ISourceViewer) textViewer).getAnnotationModel();
    Iterator<Annotation> iter = (annotationModel instanceof IAnnotationModelExtension2)
            ? ((IAnnotationModelExtension2) annotationModel).getAnnotationIterator(offset, 1, true, true)
            : annotationModel.getAnnotationIterator();
    while (iter.hasNext()) {
        Annotation ann = iter.next();
        if (ann instanceof MarkerAnnotation) {
            return true;
        }
    }
    return false;
}
项目:mesfavoris    文件:BookmarkAnnotationImageProvider.java   
@Override
public Image getManagedImage(Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation)) {
        return null;
    }
    try {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
        IMarker marker = markerAnnotation.getMarker();
        if (!BookmarksMarkers.MARKER_TYPE.equals(marker.getType())) {
            return null;
        }
        String attributeBookmarkId = (String) marker.getAttribute(BookmarksMarkers.BOOKMARK_ID);
        Optional<BookmarkNumber> bookmarkNumber = numberedBookmarks
                .getBookmarkNumber(new BookmarkId(attributeBookmarkId));
        return getBookmarkAnnotationImage(bookmarkNumber);
    } catch (CoreException e) {
        return null;
    }
}
项目:bts    文件:AnnotationIssueProcessor.java   
protected List<Annotation> getAnnotationsToRemove(IProgressMonitor monitor) {
    if (monitor.isCanceled() || annotationModel == null) {
        return Lists.newArrayList();
    }
    @SuppressWarnings("unchecked")
    Iterator<Annotation> annotationIterator = annotationModel.getAnnotationIterator();
    List<Annotation> toBeRemoved = Lists.newArrayList();
    while (annotationIterator.hasNext()) {
        if (monitor.isCanceled()) {
            return toBeRemoved;
        }
        Annotation annotation = annotationIterator.next();
        String type = annotation.getType();
        if (isRelevantAnnotationType(type)) {
            if (!(annotation instanceof MarkerAnnotation)) {
                toBeRemoved.add(annotation);
            }
        }
    }
    return toBeRemoved;
}
项目:bts    文件:XtextQuickAssistProcessor.java   
public boolean canFix(Annotation annotation) {
    if (annotation.isMarkedDeleted())
        return false;

    // non-persisted annotation
    if (annotation instanceof XtextAnnotation) {
        XtextAnnotation a = (XtextAnnotation) annotation;
        return getResolutionProvider().hasResolutionFor(a.getIssueCode());
    }

    // persisted markerAnnotation
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
        if (!markerAnnotation.isQuickFixableStateSet())
            markerAnnotation.setQuickFixable(getResolutionProvider().hasResolutionFor(
                    issueUtil.getCode(markerAnnotation)));
        return markerAnnotation.isQuickFixable();
    }

    if (annotation instanceof SpellingAnnotation) {
        return true;
    }

    return false;
}
项目:velocity-edit    文件:VelocityAnnotationHover.java   
/**
 * Returns one marker which includes the ruler's line of activity.
 */
protected IMarker getMarkerForLine(ISourceViewer aViewer, int aLine)
{
    IMarker marker = null;
    IAnnotationModel model = aViewer.getAnnotationModel();
    if (model != null)
    {
        Iterator e = model.getAnnotationIterator();
        while (e.hasNext())
        {
            Object o = e.next();
            if (o instanceof MarkerAnnotation)
            {
                MarkerAnnotation a = (MarkerAnnotation) o;
                if (compareRulerLine(model.getPosition(a), aViewer.getDocument(), aLine) != 0)
                {
                    marker = a.getMarker();
                }
            }
        }
    }
    return marker;
}
项目:velocity-edit    文件:VelocityEditor.java   
/**
 * DOCUMENT ME!
 * 
 * @param aMessage
 *            DOCUMENT ME!
 * @param aLine
 *            DOCUMENT ME!
 */
public void addProblemMarker(String aMessage, int aLine, int severity)
{
    IFile file = ((IFileEditorInput) getEditorInput()).getFile();
    try
    {
        IMarker marker = file.createMarker(IMarker.PROBLEM);
        marker.setAttribute(IMarker.SEVERITY, severity);
        marker.setAttribute(IMarker.MESSAGE, aMessage);
        marker.setAttribute(IMarker.LINE_NUMBER, aLine);
        Position pos = new Position(getDocument().getLineOffset(aLine - 1));
        getSourceViewer().getAnnotationModel().addAnnotation(new MarkerAnnotation(marker), pos);
    }
    catch (Exception e)
    {
        VelocityPlugin.log(e);
    }
}
项目:velocity-edit    文件:AnnotationHover.java   
/**
 * Returns one marker which includes the ruler's line of activity.
 */
protected IMarker getMarkerForLine(ISourceViewer aViewer, int aLine) {
    IMarker marker = null;
    IAnnotationModel model = aViewer.getAnnotationModel();
    if (model != null) {
        Iterator e = model.getAnnotationIterator();
        while (e.hasNext()) {
            Object o = e.next();
            if (o instanceof MarkerAnnotation) {
                MarkerAnnotation a = (MarkerAnnotation)o;
                if (compareRulerLine(model.getPosition(a),
                        aViewer.getDocument(), aLine) != 0) {
                    marker = a.getMarker();
                }
            }
        }
    }
    return marker;
}
项目:KaiZen-OpenAPI-Editor    文件:JsonQuickAssistProcessor.java   
protected List<IMarker> getMarkersFor(ISourceViewer sourceViewer, int lineOffset, int lineLength) {
    List<IMarker> result = Lists.newArrayList();
    IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
    Iterator annotationIter = annotationModel.getAnnotationIterator();
    while (annotationIter.hasNext()) {
        Object annotation = annotationIter.next();
        if (annotation instanceof MarkerAnnotation) {
            MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
            IMarker marker = markerAnnotation.getMarker();
            Position markerPosition = annotationModel.getPosition(markerAnnotation);
            if (markerPosition != null && markerPosition.overlapsWith(lineOffset, lineLength)) {
                result.add(marker);
            }
        }
    }
    return result;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
@Override
protected void updateMarkerViews(Annotation annotation) {
    if (annotation instanceof IJavaAnnotation) {
        Iterator<IJavaAnnotation> e= ((IJavaAnnotation) annotation).getOverlaidIterator();
        if (e != null) {
            while (e.hasNext()) {
                Object o= e.next();
                if (o instanceof MarkerAnnotation) {
                    super.updateMarkerViews((MarkerAnnotation)o);
                    return;
                }
            }
        }
        return;
    }
    super.updateMarkerViews(annotation);
}
项目:Eclipse-Postfix-Code-Completion    文件:CompilationUnitAnnotationModelEvent.java   
private void testIfProblemMarker(Annotation annotation) {
    if (fIncludesProblemMarkerAnnotations) {
        return;
    }
    if (annotation instanceof JavaMarkerAnnotation) {
        fIncludesProblemMarkerAnnotations= ((JavaMarkerAnnotation) annotation).isProblem();
    } else if (annotation instanceof MarkerAnnotation) {
        try {
            IMarker marker= ((MarkerAnnotation) annotation).getMarker();
            if (!marker.exists() || marker.isSubtypeOf(IMarker.PROBLEM)) {
                fIncludesProblemMarkerAnnotations= true;
            }
        } catch (CoreException e) {
            JavaPlugin.log(e);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
@Override
protected void updateMarkerViews(Annotation annotation) {
    if (annotation instanceof IJavaAnnotation) {
        Iterator<IJavaAnnotation> e= ((IJavaAnnotation) annotation).getOverlaidIterator();
        if (e != null) {
            while (e.hasNext()) {
                Object o= e.next();
                if (o instanceof MarkerAnnotation) {
                    super.updateMarkerViews((MarkerAnnotation)o);
                    return;
                }
            }
        }
        return;
    }
    super.updateMarkerViews(annotation);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CompilationUnitAnnotationModelEvent.java   
private void testIfProblemMarker(Annotation annotation) {
    if (fIncludesProblemMarkerAnnotations) {
        return;
    }
    if (annotation instanceof JavaMarkerAnnotation) {
        fIncludesProblemMarkerAnnotations= ((JavaMarkerAnnotation) annotation).isProblem();
    } else if (annotation instanceof MarkerAnnotation) {
        try {
            IMarker marker= ((MarkerAnnotation) annotation).getMarker();
            if (!marker.exists() || marker.isSubtypeOf(IMarker.PROBLEM)) {
                fIncludesProblemMarkerAnnotations= true;
            }
        } catch (CoreException e) {
            JavaPlugin.log(e);
        }
    }
}
项目:Pydev    文件:OrganizeImportsFixesUnused.java   
private void findAndDeleteUnusedImports(PySelection ps, PyEdit edit, IDocumentExtension4 doc, IFile f)
        throws Exception {
    Iterator<MarkerAnnotationAndPosition> it;
    if (edit != null) {
        it = edit.getPySourceViewer().getMarkerIterator();
    } else {

        IMarker markers[] = f.findMarkers(IMiscConstants.PYDEV_ANALYSIS_PROBLEM_MARKER, true, IResource.DEPTH_ZERO);
        MarkerAnnotationAndPosition maap[] = new MarkerAnnotationAndPosition[markers.length];
        int ix = 0;
        for (IMarker m : markers) {
            int start = (Integer) m.getAttribute(IMarker.CHAR_START);
            int end = (Integer) m.getAttribute(IMarker.CHAR_END);
            maap[ix++] =
                    new MarkerAnnotationAndPosition(new MarkerAnnotation(m), new Position(start, end - start));
        }
        it = Arrays.asList(maap).iterator();
    }
    ArrayList<MarkerAnnotationAndPosition> unusedImportsMarkers = getUnusedImports(it);
    sortInReverseDocumentOrder(unusedImportsMarkers);
    deleteImports(doc, ps, unusedImportsMarkers);

}
项目:goclipse    文件:ExternalBreakpointWatcher.java   
protected void updateMarkerAnnotation(IMarker marker) {

    Iterator<Annotation> iter = annotationModel.getAnnotationIterator();

    for (Annotation ann : (Iterable<Annotation>) () -> iter) {
        if(ann instanceof MarkerAnnotation) {
            MarkerAnnotation markerAnnotation = (MarkerAnnotation) ann;
            if(markerAnnotation.getMarker().equals(marker)) {

                Position position = annotationModel.getPosition(markerAnnotation);

                // Trigger a model update.
                annotationModelExt.modifyAnnotationPosition(markerAnnotation, position);

                return;
            }
        }
    }
}
项目:eclipse-batch-editor    文件:BatchSourceViewerConfiguration.java   
@Override
protected boolean isIncluded(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        return true;
    }
    /* we do not support other annotations */
    return false;
}
项目:eclipse-bash-editor    文件:BashSourceViewerConfiguration.java   
@Override
protected boolean isIncluded(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        return true;
    }
    /* we do not support other annotations */
    return false;
}
项目:egradle    文件:GroovyEditorAnnotationHoover.java   
@Override
protected boolean isIncluded(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        return true;
    }
    /* we do not support other annotations */
    return false;
}
项目:texlipse    文件:TexAnnotationHover.java   
/**
 * Find a problem marker from the given line and return its error message.
 * 
 * @param sourceViewer the source viewer
 * @param lineNumber line number in the file, starting from zero
 * @return the message of the marker of null, if no marker at the specified line
 */
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber) {
    IDocument document= sourceViewer.getDocument();
    IAnnotationModel model= sourceViewer.getAnnotationModel();

    if (model == null)
        return null;

    List<String> lineMarkers = null;

    Iterator<Annotation> e= model.getAnnotationIterator();
    while (e.hasNext()) {
        Annotation o= e.next();
        if (o instanceof MarkerAnnotation) {
            MarkerAnnotation a= (MarkerAnnotation) o;
            if (isRulerLine(model.getPosition(a), document, lineNumber)) {
                if (lineMarkers == null)
                    lineMarkers = new LinkedList<String>();
                lineMarkers.add(a.getMarker().getAttribute(IMarker.MESSAGE, null));
            }
        }
    }
    if (lineMarkers != null)
        return getMessage(lineMarkers);

    return null;
}
项目:bts    文件:IssueUtil.java   
public Issue getIssueFromAnnotation(Annotation annotation) {
    if (annotation instanceof XtextAnnotation) {
        XtextAnnotation xtextAnnotation = (XtextAnnotation) annotation;
        return xtextAnnotation.getIssue();
    } else if(annotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation)annotation;
        return createIssue(markerAnnotation.getMarker());
    } else
        return null;
}
项目:bts    文件:IssueUtil.java   
public String getCode(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation ma = (MarkerAnnotation) annotation;
        return getCode(ma.getMarker());
    }
    if (annotation instanceof XtextAnnotation) {
        XtextAnnotation xa = (XtextAnnotation) annotation;
        return xa.getIssueCode();   
    }
    return null;
}
项目:bts    文件:IssueUtil.java   
public String[] getIssueData(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation ma = (MarkerAnnotation) annotation;
        return getIssueData(ma.getMarker());
    }
    if (annotation instanceof XtextAnnotation) {
        XtextAnnotation xa = (XtextAnnotation) annotation;
        return xa.getIssueData();   
    }
    return null;
}
项目:bts    文件:IssueUtil.java   
public URI getUriToProblem(Annotation annotation) {
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation ma = (MarkerAnnotation) annotation;
        return getUriToProblem(ma.getMarker());
    }
    if (annotation instanceof XtextAnnotation) {
        XtextAnnotation xa = (XtextAnnotation) annotation;
        return xa.getUriToProblem();
    }
    return null;
}
项目:bts    文件:AnnotationIssueProcessor.java   
protected void updateMarkerAnnotations(IProgressMonitor monitor) {
    if (monitor.isCanceled()) {
        return;
    }

    Iterator<MarkerAnnotation> annotationIterator = Iterators.filter(annotationModel.getAnnotationIterator(),
            MarkerAnnotation.class);

    // every markerAnnotation produced by fast validation can be marked as deleted.
    // If its predicate still holds, the validation annotation will be covered anyway.
    while (annotationIterator.hasNext() && !monitor.isCanceled()) {
        final MarkerAnnotation annotation = annotationIterator.next();
        if (!annotation.isMarkedDeleted())
            try {
                if (isRelevantAnnotationType(annotation.getType())) {
                    boolean markAsDeleted = annotation.getMarker().isSubtypeOf(MarkerTypes.FAST_VALIDATION);
                    if (markAsDeleted) {
                        annotation.markDeleted(true);
                        queueOrFireAnnotationChangedEvent(annotation);
                    }
                }
            } catch (CoreException e) {
                // marker type cannot be resolved - keep state of annotation
            }
    }
    fireQueuedEvents();
}
项目:bts    文件:XtextEditor.java   
private boolean isProblemMarkerAnnotation(final Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation))
        return false;
    try {
        return (((MarkerAnnotation) annotation).getMarker().isSubtypeOf(IMarker.PROBLEM));
    } catch (final CoreException e) {
        return false;
    }
}
项目:bts    文件:XtextMarkerAnnotationImageProvider.java   
private Map<String, Image> getImages(Annotation annotation) {
    if(annotation.isMarkedDeleted())
        return XtextPluginImages.getAnnotationImagesDeleted();
    else {
        if (annotation instanceof MarkerAnnotation) {
            MarkerAnnotation ma = (MarkerAnnotation) annotation;
            if(ma.isQuickFixableStateSet() && ma.isQuickFixable())
                return XtextPluginImages.getAnnotationImagesFixable();
        }
        return XtextPluginImages.getAnnotationImagesNonfixable();
    }
}
项目:bts    文件:XtextResourceMarkerAnnotationModel.java   
@Override
protected MarkerAnnotation createMarkerAnnotation(IMarker marker) {
    MarkerAnnotation annotation = super.createMarkerAnnotation(marker);
    String issueCode = issueUtil.getCode(annotation);
    annotation.setQuickFixable(issueResolutionProvider.hasResolutionFor(issueCode));
    return annotation;
}
项目:KaiZen-OpenAPI-Editor    文件:JsonQuickAssistProcessor.java   
@Override
public boolean canFix(Annotation annotation) {
    if (annotation.isMarkedDeleted()) {
        return false;
    }
    if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
        if (!markerAnnotation.isQuickFixableStateSet()) {
            markerAnnotation.setQuickFixable(quickFixer.hasResolutions(markerAnnotation.getMarker()));
        }
        return markerAnnotation.isQuickFixable();
    }
    return false;
}
项目:Eclipse-Postfix-Code-Completion    文件:ProblemsLabelDecorator.java   
private IMarker isAnnotationInRange(IAnnotationModel model, Annotation annot, ISourceReference sourceElement) throws CoreException {
    if (annot instanceof MarkerAnnotation) {
        if (sourceElement == null || isInside(model.getPosition(annot), sourceElement)) {
            IMarker marker= ((MarkerAnnotation) annot).getMarker();
            if (marker.exists() && marker.isSubtypeOf(IMarker.PROBLEM)) {
                return marker;
            }
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
/**
 * Tells whether the given annotation stands for a problem marker.
 *
 * @param annotation the annotation
 * @return <code>true</code> if it is a problem marker
 * @since 3.4
 */
private static boolean isProblemMarkerAnnotation(Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation))
        return false;
    try {
        return(((MarkerAnnotation)annotation).getMarker().isSubtypeOf(IMarker.PROBLEM));
    } catch (CoreException e) {
        return false;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaAnnotationIterator.java   
private static boolean isProblemMarkerAnnotation(Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation))
        return false;
    try {
        return(((MarkerAnnotation)annotation).getMarker().isSubtypeOf(IMarker.PROBLEM));
    } catch (CoreException e) {
        return false;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:ProblemHover.java   
@Override
public ICompletionProposal[] getCompletionProposals() {
    if (annotation instanceof IJavaAnnotation) {
        ICompletionProposal[] result= getJavaAnnotationFixes((IJavaAnnotation) annotation);
        if (result.length > 0)
            return result;
    }

    if (annotation instanceof MarkerAnnotation)
        return getMarkerAnnotationFixes((MarkerAnnotation) annotation);

    return NO_PROPOSALS;
}
项目:Eclipse-Postfix-Code-Completion    文件:ProblemHover.java   
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()]);
}
项目:eclipse-wtp-webresources    文件:WebResourceQuickFixProcessor.java   
@Override
public boolean canFix(Annotation annotation) {
    boolean result = false;

    String text = null;
    if (annotation instanceof TemporaryAnnotation) {
        TemporaryAnnotation tempAnnotation = (TemporaryAnnotation) annotation;
        int problemID = tempAnnotation.getProblemID();
        text = tempAnnotation.getText();

        if (problemID == 0 && text != null)
            result = true;
    } else if (annotation instanceof MarkerAnnotation) {
        MarkerAnnotation markerAnnotation = (MarkerAnnotation) annotation;
        text = markerAnnotation.getText();
        IMarker marker = markerAnnotation.getMarker();
        IResource resource = marker == null ? null : marker.getResource();
        if (resource != null && resource.exists()
                && resource.isAccessible() && text != null) {
            result = true;
        }
    }

    result = result && isWebResourceError(text);

    return result;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ProblemsLabelDecorator.java   
private IMarker isAnnotationInRange(IAnnotationModel model, Annotation annot, ISourceReference sourceElement) throws CoreException {
    if (annot instanceof MarkerAnnotation) {
        if (sourceElement == null || isInside(model.getPosition(annot), sourceElement)) {
            IMarker marker= ((MarkerAnnotation) annot).getMarker();
            if (marker.exists() && marker.isSubtypeOf(IMarker.PROBLEM)) {
                return marker;
            }
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
/**
 * Tells whether the given annotation stands for a problem marker.
 *
 * @param annotation the annotation
 * @return <code>true</code> if it is a problem marker
 * @since 3.4
 */
private static boolean isProblemMarkerAnnotation(Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation))
        return false;
    try {
        return(((MarkerAnnotation)annotation).getMarker().isSubtypeOf(IMarker.PROBLEM));
    } catch (CoreException e) {
        return false;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaAnnotationIterator.java   
private static boolean isProblemMarkerAnnotation(Annotation annotation) {
    if (!(annotation instanceof MarkerAnnotation))
        return false;
    try {
        return(((MarkerAnnotation)annotation).getMarker().isSubtypeOf(IMarker.PROBLEM));
    } catch (CoreException e) {
        return false;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ProblemHover.java   
@Override
public ICompletionProposal[] getCompletionProposals() {
    if (annotation instanceof IJavaAnnotation) {
        ICompletionProposal[] result= getJavaAnnotationFixes((IJavaAnnotation) annotation);
        if (result.length > 0)
            return result;
    }

    if (annotation instanceof MarkerAnnotation)
        return getMarkerAnnotationFixes((MarkerAnnotation) annotation);

    return NO_PROPOSALS;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ProblemHover.java   
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()]);
}
项目:birt    文件:ScriptDocumentProvider.java   
public void beforeChangeText()
{       
    for (Iterator e= getAnnotationIterator(true); e.hasNext();) {
        Object o= e.next();
        if (o instanceof MarkerAnnotation) {
            MarkerAnnotation a= (MarkerAnnotation) o;

            //System.out.println(a.getType( ));
            IMarker mark = a.getMarker( );
            try
            {
                if (mark == null || !getId( ).equals( mark.getAttribute( SUBNAME ) ))
                {
                    continue;
                }
                if (!(ScriptDocumentProvider.MARK_TYPE.equals( a.getMarker( ).getType( ))))
                {
                    continue;
                }
            }
            catch ( CoreException e1 )
            {
                continue;
            }
            Position p= getPosition( a );
            if (p != null && !p.isDeleted( )) {
                Position tempCopy = new Position(p.getOffset(),p.getLength());
                markMap.put( a, tempCopy );
            }
        }
    }

    change = true;
}
项目:birt    文件:ScriptDocumentProvider.java   
protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged)throws BadLocationException
{
    if (annotation instanceof MarkerAnnotation)
    {
        IMarker marker = ((MarkerAnnotation)annotation).getMarker( );
        if (marker != null)
        {
            try
            {
                if (!getId( ).equals( marker.getAttribute( SUBNAME ) ))
                {
                    return;
                }
                if (!(ScriptDocumentProvider.MARK_TYPE.equals( marker.getType( ))))
                {
                    return;
                }

            }
            catch ( CoreException e )
            {
                //do nothing now
            }
        }
    }
    super.addAnnotation( annotation, position, fireModelChanged );
}