mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-18 14:35:23 +02:00
Cosmetics.
This commit is contained in:
parent
f3f2671d48
commit
885f6f1b7e
4 changed files with 149 additions and 790 deletions
|
@ -105,9 +105,9 @@ public class ASTProblem extends ASTNode implements IASTProblem {
|
||||||
setOffset(startNumber);
|
setOffset(startNumber);
|
||||||
setLength(endNumber-startNumber);
|
setLength(endNumber-startNumber);
|
||||||
|
|
||||||
this.isError= isError;
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
|
this.isError= isError;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTProblem(int id, char[] arg, boolean isError) {
|
public ASTProblem(int id, char[] arg, boolean isError) {
|
||||||
|
|
|
@ -120,55 +120,38 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
fArguments= isProblem() ? problem.getArguments() : null;
|
fArguments= isProblem() ? problem.getArguments() : null;
|
||||||
setType(problem instanceof CoreSpellingProblem ?
|
setType(problem instanceof CoreSpellingProblem ?
|
||||||
SpellingAnnotation.TYPE : INDEXER_ANNOTATION_TYPE);
|
SpellingAnnotation.TYPE : INDEXER_ANNOTATION_TYPE);
|
||||||
if (problem instanceof IPersistableProblem)
|
if (problem instanceof IPersistableProblem) {
|
||||||
fMarkerType= ((IPersistableProblem) problem).getMarkerType();
|
fMarkerType= ((IPersistableProblem) problem).getMarkerType();
|
||||||
else
|
} else {
|
||||||
fMarkerType= null;
|
fMarkerType= null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#getArguments()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getArguments() {
|
public String[] getArguments() {
|
||||||
return fArguments;
|
return fArguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#getId()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return fId;
|
return fId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#isProblem()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isProblem() {
|
public boolean isProblem() {
|
||||||
return fIsProblem;
|
return fIsProblem;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#hasOverlay()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasOverlay() {
|
public boolean hasOverlay() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#getOverlay()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ICAnnotation getOverlay() {
|
public ICAnnotation getOverlay() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#addOverlaid(ICAnnotation)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void addOverlaid(ICAnnotation annotation) {
|
public void addOverlaid(ICAnnotation annotation) {
|
||||||
if (fOverlaids == null)
|
if (fOverlaids == null)
|
||||||
|
@ -176,9 +159,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
fOverlaids.add(annotation);
|
fOverlaids.add(annotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#removeOverlaid(ICAnnotation)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void removeOverlaid(ICAnnotation annotation) {
|
public void removeOverlaid(ICAnnotation annotation) {
|
||||||
if (fOverlaids != null) {
|
if (fOverlaids != null) {
|
||||||
|
@ -188,9 +168,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see ICAnnotation#getOverlaidIterator()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<ICAnnotation> getOverlaidIterator() {
|
public Iterator<ICAnnotation> getOverlaidIterator() {
|
||||||
if (fOverlaids != null)
|
if (fOverlaids != null)
|
||||||
|
@ -198,17 +175,11 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.ICAnnotation#getTranslationUnit()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ITranslationUnit getTranslationUnit() {
|
public ITranslationUnit getTranslationUnit() {
|
||||||
return fTranslationUnit;
|
return fTranslationUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipsecjdt.internal.ui.editor.ICAnnotation#getMarkerType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getMarkerType() {
|
public String getMarkerType() {
|
||||||
return fMarkerType;
|
return fMarkerType;
|
||||||
|
@ -235,7 +206,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object get(Position position) {
|
public Object get(Position position) {
|
||||||
|
|
||||||
Entry entry;
|
Entry entry;
|
||||||
|
|
||||||
// behind anchor
|
// behind anchor
|
||||||
|
@ -300,32 +270,22 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
* A marker updater which removes problems markers with length 0.
|
* A marker updater which removes problems markers with length 0.
|
||||||
*/
|
*/
|
||||||
public static class ProblemMarkerUpdater implements IMarkerUpdater {
|
public static class ProblemMarkerUpdater implements IMarkerUpdater {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor (executable extension).
|
* Default constructor (executable extension).
|
||||||
*/
|
*/
|
||||||
public ProblemMarkerUpdater() {
|
public ProblemMarkerUpdater() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.IMarkerUpdater#getAttribute()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getAttribute() {
|
public String[] getAttribute() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.IMarkerUpdater#getMarkerType()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getMarkerType() {
|
public String getMarkerType() {
|
||||||
return ICModelMarker.C_MODEL_PROBLEM_MARKER;
|
return ICModelMarker.C_MODEL_PROBLEM_MARKER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.texteditor.IMarkerUpdater#updateMarker(org.eclipse.core.resources.IMarker, org.eclipse.jface.text.IDocument, org.eclipse.jface.text.Position)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean updateMarker(IMarker marker, IDocument document, Position position) {
|
public boolean updateMarker(IMarker marker, IDocument document, Position position) {
|
||||||
if (position == null) {
|
if (position == null) {
|
||||||
|
@ -340,13 +300,14 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation model dealing with c marker annotations and temporary problems.
|
* Annotation model dealing with c marker annotations and temporary problems.
|
||||||
* Also acts as a problem requestor for its translation unit. Initially inactive. Must be explicitly
|
* Also acts as a problem requestor for its translation unit. Initially inactive.
|
||||||
* activated.
|
* Must be explicitly activated.
|
||||||
*/
|
*/
|
||||||
protected static class TranslationUnitAnnotationModel extends ResourceMarkerAnnotationModel implements IProblemRequestor, IProblemRequestorExtension {
|
protected static class TranslationUnitAnnotationModel extends ResourceMarkerAnnotationModel
|
||||||
|
implements IProblemRequestor, IProblemRequestorExtension {
|
||||||
|
|
||||||
private static class ProblemRequestorState {
|
private static class ProblemRequestorState {
|
||||||
boolean fInsideReportingSequence= false;
|
boolean fInsideReportingSequence;
|
||||||
List<IProblem> fReportedProblems;
|
List<IProblem> fReportedProblems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,13 +317,12 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
private ITranslationUnit fTranslationUnit;
|
private ITranslationUnit fTranslationUnit;
|
||||||
private List<ProblemAnnotation> fGeneratedAnnotations;
|
private List<ProblemAnnotation> fGeneratedAnnotations;
|
||||||
private IProgressMonitor fProgressMonitor;
|
private IProgressMonitor fProgressMonitor;
|
||||||
private boolean fIsActive= false;
|
private boolean fIsActive;
|
||||||
|
|
||||||
private ReverseMap fReverseMap= new ReverseMap();
|
private ReverseMap fReverseMap= new ReverseMap();
|
||||||
private List<CMarkerAnnotation> fPreviouslyOverlaid= null;
|
private List<CMarkerAnnotation> fPreviouslyOverlaid;
|
||||||
private List<CMarkerAnnotation> fCurrentlyOverlaid= new ArrayList<CMarkerAnnotation>();
|
private List<CMarkerAnnotation> fCurrentlyOverlaid= new ArrayList<CMarkerAnnotation>();
|
||||||
|
|
||||||
|
|
||||||
public TranslationUnitAnnotationModel(IResource resource) {
|
public TranslationUnitAnnotationModel(IResource resource) {
|
||||||
super(resource);
|
super(resource);
|
||||||
}
|
}
|
||||||
|
@ -380,10 +340,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return super.createMarkerAnnotation(marker);
|
return super.createMarkerAnnotation(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.ui.texteditor.AbstractMarkerAnnotationModel#createPositionFromMarker(org.eclipse.core.resources.IMarker)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Position createPositionFromMarker(IMarker marker) {
|
protected Position createPositionFromMarker(IMarker marker) {
|
||||||
int start= MarkerUtilities.getCharStart(marker);
|
int start= MarkerUtilities.getCharStart(marker);
|
||||||
|
@ -420,9 +376,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @see org.eclipse.jface.text.source.AnnotationModel#createAnnotationModelEvent()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected AnnotationModelEvent createAnnotationModelEvent() {
|
protected AnnotationModelEvent createAnnotationModelEvent() {
|
||||||
return new TranslationUnitAnnotationModelEvent(this, getResource());
|
return new TranslationUnitAnnotationModelEvent(this, getResource());
|
||||||
|
@ -439,9 +393,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return new Position(start, length);
|
return new Position(start, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestor#beginReporting()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void beginReporting() {
|
public void beginReporting() {
|
||||||
ProblemRequestorState state= fProblemRequestorState.get();
|
ProblemRequestorState state= fProblemRequestorState.get();
|
||||||
|
@ -449,9 +400,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
internalBeginReporting(false);
|
internalBeginReporting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.java.IProblemRequestorExtension#beginReportingSequence()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void beginReportingSequence() {
|
public void beginReportingSequence() {
|
||||||
ProblemRequestorState state= fProblemRequestorState.get();
|
ProblemRequestorState state= fProblemRequestorState.get();
|
||||||
|
@ -477,9 +425,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestor#acceptProblem(IProblem)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void acceptProblem(IProblem problem) {
|
public void acceptProblem(IProblem problem) {
|
||||||
if (isActive()) {
|
if (isActive()) {
|
||||||
|
@ -489,9 +434,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestor#endReporting()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void endReporting() {
|
public void endReporting() {
|
||||||
ProblemRequestorState state= fProblemRequestorState.get();
|
ProblemRequestorState state= fProblemRequestorState.get();
|
||||||
|
@ -499,9 +441,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
internalEndReporting(state);
|
internalEndReporting(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.cdt.internal.ui.text.java.IProblemRequestorExtension#endReportingSequence()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void endReportingSequence() {
|
public void endReportingSequence() {
|
||||||
ProblemRequestorState state= fProblemRequestorState.get();
|
ProblemRequestorState state= fProblemRequestorState.get();
|
||||||
|
@ -542,19 +481,15 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
fGeneratedAnnotations.clear();
|
fGeneratedAnnotations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reportedProblems != null && reportedProblems.size() > 0) {
|
if (reportedProblems != null) {
|
||||||
Iterator<IProblem> e= reportedProblems.iterator();
|
for (IProblem problem : reportedProblems) {
|
||||||
while (e.hasNext()) {
|
|
||||||
|
|
||||||
if (fProgressMonitor != null && fProgressMonitor.isCanceled()) {
|
if (fProgressMonitor != null && fProgressMonitor.isCanceled()) {
|
||||||
isCanceled= true;
|
isCanceled= true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
IProblem problem= e.next();
|
|
||||||
Position position= createPositionFromProblem(problem);
|
Position position= createPositionFromProblem(problem);
|
||||||
if (position != null) {
|
if (position != null) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ProblemAnnotation annotation= new ProblemAnnotation(problem, fTranslationUnit);
|
ProblemAnnotation annotation= new ProblemAnnotation(problem, fTranslationUnit);
|
||||||
overlayMarkers(position, annotation);
|
overlayMarkers(position, annotation);
|
||||||
|
@ -563,7 +498,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
|
|
||||||
temporaryProblemsChanged= true;
|
temporaryProblemsChanged= true;
|
||||||
} catch (BadLocationException x) {
|
} catch (BadLocationException x) {
|
||||||
// ignore invalid position
|
// Ignore invalid position
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -601,7 +536,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
fPreviouslyOverlaid.remove(annotation);
|
fPreviouslyOverlaid.remove(annotation);
|
||||||
fCurrentlyOverlaid.add(annotation);
|
fCurrentlyOverlaid.add(annotation);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -609,8 +543,9 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
Object value= getAnnotations(position);
|
Object value= getAnnotations(position);
|
||||||
if (value instanceof List<?>) {
|
if (value instanceof List<?>) {
|
||||||
List<?> list= (List<?>) value;
|
List<?> list= (List<?>) value;
|
||||||
for (Object element : list)
|
for (Object element : list) {
|
||||||
setOverlay(element, problemAnnotation);
|
setOverlay(element, problemAnnotation);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
setOverlay(value, problemAnnotation);
|
setOverlay(value, problemAnnotation);
|
||||||
}
|
}
|
||||||
|
@ -632,25 +567,16 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
fGeneratedAnnotations= null;
|
fGeneratedAnnotations= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestor#isActive()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isActive() {
|
public boolean isActive() {
|
||||||
return fIsActive;
|
return fIsActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestorExtension#setProgressMonitor(IProgressMonitor)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setProgressMonitor(IProgressMonitor monitor) {
|
public void setProgressMonitor(IProgressMonitor monitor) {
|
||||||
fProgressMonitor= monitor;
|
fProgressMonitor= monitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see IProblemRequestorExtension#setIsActive(boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setIsActive(boolean isActive) {
|
public void setIsActive(boolean isActive) {
|
||||||
if (fIsActive != isActive) {
|
if (fIsActive != isActive) {
|
||||||
|
@ -668,9 +594,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see AnnotationModel#addAnnotation(Annotation, Position, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException {
|
protected void addAnnotation(Annotation annotation, Position position, boolean fireModelChanged) throws BadLocationException {
|
||||||
|
@ -692,9 +615,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see AnnotationModel#removeAllAnnotations(boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void removeAllAnnotations(boolean fireModelChanged) {
|
protected void removeAllAnnotations(boolean fireModelChanged) {
|
||||||
super.removeAllAnnotations(fireModelChanged);
|
super.removeAllAnnotations(fireModelChanged);
|
||||||
|
@ -703,9 +623,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see AnnotationModel#removeAnnotation(Annotation, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) {
|
protected void removeAnnotation(Annotation annotation, boolean fireModelChanged) {
|
||||||
Position position= getPosition(annotation);
|
Position position= getPosition(annotation);
|
||||||
|
@ -727,16 +644,12 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class GlobalAnnotationModelListener implements IAnnotationModelListener, IAnnotationModelListenerExtension {
|
protected static class GlobalAnnotationModelListener implements IAnnotationModelListener, IAnnotationModelListenerExtension {
|
||||||
|
|
||||||
private ListenerList fListenerList;
|
private ListenerList fListenerList;
|
||||||
|
|
||||||
public GlobalAnnotationModelListener() {
|
public GlobalAnnotationModelListener() {
|
||||||
fListenerList= new ListenerList(ListenerList.IDENTITY);
|
fListenerList= new ListenerList(ListenerList.IDENTITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see IAnnotationModelListener#modelChanged(IAnnotationModel)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void modelChanged(IAnnotationModel model) {
|
public void modelChanged(IAnnotationModel model) {
|
||||||
Object[] listeners= fListenerList.getListeners();
|
Object[] listeners= fListenerList.getListeners();
|
||||||
|
@ -745,9 +658,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @see IAnnotationModelListenerExtension#modelChanged(AnnotationModelEvent)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void modelChanged(AnnotationModelEvent event) {
|
public void modelChanged(AnnotationModelEvent event) {
|
||||||
Object[] listeners= fListenerList.getListeners();
|
Object[] listeners= fListenerList.getListeners();
|
||||||
|
@ -775,9 +685,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
/** Annotation model listener added to all created CU annotation models */
|
/** Annotation model listener added to all created CU annotation models */
|
||||||
private GlobalAnnotationModelListener fGlobalAnnotationModelListener;
|
private GlobalAnnotationModelListener fGlobalAnnotationModelListener;
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public CDocumentProvider() {
|
public CDocumentProvider() {
|
||||||
super();
|
super();
|
||||||
IDocumentProvider parentProvider= new ExternalSearchDocumentProvider();
|
IDocumentProvider parentProvider= new ExternalSearchDocumentProvider();
|
||||||
|
@ -794,9 +701,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener);
|
CUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(fPropertyListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#connect(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void connect(Object element) throws CoreException {
|
public void connect(Object element) throws CoreException {
|
||||||
super.connect(element);
|
super.connect(element);
|
||||||
|
@ -811,8 +715,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
/**
|
/**
|
||||||
* Creates a translation unit from the given file.
|
* Creates a translation unit from the given file.
|
||||||
*
|
*
|
||||||
* @param file
|
* @param file the file from which to create the translation unit
|
||||||
* the file from which to create the translation unit
|
|
||||||
*/
|
*/
|
||||||
protected ITranslationUnit createTranslationUnit(IFile file) {
|
protected ITranslationUnit createTranslationUnit(IFile file) {
|
||||||
Object element = CoreModel.getDefault().create(file);
|
Object element = CoreModel.getDefault().create(file);
|
||||||
|
@ -820,7 +723,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return (ITranslationUnit) element;
|
return (ITranslationUnit) element;
|
||||||
}
|
}
|
||||||
if (element == null) {
|
if (element == null) {
|
||||||
// not in a source folder?
|
// Not in a source folder?
|
||||||
ICProject cproject= CoreModel.getDefault().create(file.getProject());
|
ICProject cproject= CoreModel.getDefault().create(file.getProject());
|
||||||
if (cproject != null) {
|
if (cproject != null) {
|
||||||
String contentTypeId= CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
|
String contentTypeId= CoreModel.getRegistedContentTypeId(file.getProject(), file.getName());
|
||||||
|
@ -832,25 +735,16 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createEmptyFileInfo()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected FileInfo createEmptyFileInfo() {
|
protected FileInfo createEmptyFileInfo() {
|
||||||
return new TranslationUnitInfo();
|
return new TranslationUnitInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createAnnotationModel(org.eclipse.core.resources.IFile)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected IAnnotationModel createAnnotationModel(IFile file) {
|
protected IAnnotationModel createAnnotationModel(IFile file) {
|
||||||
return new TranslationUnitAnnotationModel(file);
|
return new TranslationUnitAnnotationModel(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createFileInfo(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected FileInfo createFileInfo(Object element) throws CoreException {
|
protected FileInfo createFileInfo(Object element) throws CoreException {
|
||||||
ITranslationUnit original = null;
|
ITranslationUnit original = null;
|
||||||
|
@ -915,7 +809,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to synthesize an ITranslationUnit out of thin air.
|
* Tries to synthesize an ITranslationUnit out of thin air.
|
||||||
* @param location the file system location of the file in question
|
* @param location the file system location of the file in question
|
||||||
* @return a translation unit or <code>null</code>
|
* @return a translation unit or <code>null</code>
|
||||||
*/
|
*/
|
||||||
|
@ -931,7 +825,7 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to synthesize an ITranslationUnit out of thin air.
|
* Tries to synthesize an ITranslationUnit out of thin air.
|
||||||
* @param uri the URU of the file in question
|
* @param uri the URU of the file in question
|
||||||
* @return a translation unit or <code>null</code>
|
* @return a translation unit or <code>null</code>
|
||||||
*/
|
*/
|
||||||
|
@ -946,10 +840,6 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#disposeFileInfo(java.lang.Object,
|
|
||||||
* org.eclipse.ui.editors.text.TextFileDocumentProvider.FileInfo)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void disposeFileInfo(Object element, FileInfo info) {
|
protected void disposeFileInfo(Object element, FileInfo info) {
|
||||||
if (info instanceof TranslationUnitInfo) {
|
if (info instanceof TranslationUnitInfo) {
|
||||||
|
@ -1020,25 +910,17 @@ public class CDocumentProvider extends TextFileDocumentProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider#createSaveOperation(java.lang.Object, org.eclipse.jface.text.IDocument, boolean)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected DocumentProviderOperation createSaveOperation(final Object element, final IDocument document,
|
protected DocumentProviderOperation createSaveOperation(final Object element, final IDocument document,
|
||||||
final boolean overwrite) throws CoreException {
|
final boolean overwrite) throws CoreException {
|
||||||
final FileInfo info= getFileInfo(element);
|
final FileInfo info= getFileInfo(element);
|
||||||
if (info instanceof TranslationUnitInfo) {
|
if (info instanceof TranslationUnitInfo) {
|
||||||
return new DocumentProviderOperation() {
|
return new DocumentProviderOperation() {
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected void execute(IProgressMonitor monitor) throws CoreException {
|
protected void execute(IProgressMonitor monitor) throws CoreException {
|
||||||
commitWorkingCopy(monitor, element, (TranslationUnitInfo) info, overwrite);
|
commitWorkingCopy(monitor, element, (TranslationUnitInfo) info, overwrite);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @see org.eclipse.ui.editors.text.TextFileDocumentProvider.DocumentProviderOperation#getSchedulingRule()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public ISchedulingRule getSchedulingRule() {
|
public ISchedulingRule getSchedulingRule() {
|
||||||
if (info.fElement instanceof IFileEditorInput) {
|
if (info.fElement instanceof IFileEditorInput) {
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
* Anton Leherbauer (Wind River Systems) - Adapted for CDT
|
* Anton Leherbauer (Wind River Systems) - Adapted for CDT
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.internal.ui.editor;
|
package org.eclipse.cdt.internal.ui.editor;
|
||||||
|
|
||||||
import org.eclipse.jface.resource.ColorRegistry;
|
import org.eclipse.jface.resource.ColorRegistry;
|
||||||
|
@ -26,7 +25,6 @@ import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
* @since 4.0
|
* @since 4.0
|
||||||
*/
|
*/
|
||||||
public abstract class SemanticHighlighting {
|
public abstract class SemanticHighlighting {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the preference key, will be augmented by a prefix and a suffix for each preference
|
* @return the preference key, will be augmented by a prefix and a suffix for each preference
|
||||||
*/
|
*/
|
||||||
|
@ -126,5 +124,4 @@ public abstract class SemanticHighlighting {
|
||||||
return rgb;
|
return rgb;
|
||||||
return defaultRGB;
|
return defaultRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue