mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 02:36:01 +02:00
Bug 371144 - There seems to be no easy way to add custom marker annotations to non-workspace file
This commit is contained in:
parent
d4f69c801e
commit
1bc41d348f
1 changed files with 15 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others.
|
* Copyright (c) 2002, 2012 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -44,13 +44,20 @@ public class ExternalSearchDocumentProvider extends TextFileDocumentProvider {
|
||||||
@Override
|
@Override
|
||||||
protected FileInfo createFileInfo(Object element) throws CoreException {
|
protected FileInfo createFileInfo(Object element) throws CoreException {
|
||||||
final FileInfo info= super.createFileInfo(element);
|
final FileInfo info= super.createFileInfo(element);
|
||||||
if (info != null && info.fModel == null) {
|
if (info != null) {
|
||||||
info.fModel= createAnnotationModel(element);
|
IAnnotationModel originalModel = info.fModel;
|
||||||
if (info.fModel != null) {
|
IAnnotationModel externalSearchModel = createAnnotationModel(element);
|
||||||
IAnnotationModel fileBufferAnnotationModel= info.fTextFileBuffer.getAnnotationModel();
|
if (externalSearchModel != null) {
|
||||||
if (fileBufferAnnotationModel != null) {
|
info.fModel= externalSearchModel;
|
||||||
((AnnotationModel)info.fModel).addAnnotationModel("fileBufferModel", fileBufferAnnotationModel); //$NON-NLS-1$
|
IAnnotationModel fileBufferModel= info.fTextFileBuffer.getAnnotationModel();
|
||||||
|
if (fileBufferModel != null) {
|
||||||
|
((AnnotationModel) externalSearchModel).addAnnotationModel("fileBufferModel", fileBufferModel); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
if (originalModel != null && originalModel != fileBufferModel) {
|
||||||
|
((AnnotationModel) externalSearchModel).addAnnotationModel("originalModel", originalModel); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.fModel != null) {
|
||||||
setUpSynchronization(info);
|
setUpSynchronization(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,8 +111,7 @@ public class ExternalSearchDocumentProvider extends TextFileDocumentProvider {
|
||||||
private IAnnotationModel createExternalSearchAnnotationModel(ExternalEditorInput externalInput) {
|
private IAnnotationModel createExternalSearchAnnotationModel(ExternalEditorInput externalInput) {
|
||||||
IPath location = externalInput.getPath();
|
IPath location = externalInput.getPath();
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
IResource markerResource = externalInput.getMarkerResource();
|
return createExternalSearchAnnotationModel(location, null);
|
||||||
return createExternalSearchAnnotationModel(location, markerResource);
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue