1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Changed return type of CEditor.getInputCElement to be IWorkingCopy. The

method already returned a working copy before this change but it was
implicit.
This commit is contained in:
Sergey Prigogin 2012-04-30 16:22:49 -07:00
parent 5bf7b89b5f
commit 344f3979de

View file

@ -1609,12 +1609,12 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
}
/**
* Returns the C element wrapped by this editors input.
* Returns the working copy wrapped by this editors input.
*
* @return the C element wrapped by this editors input.
* @return the working copy wrapped by this editors input.
* @since 3.0
*/
public ICElement getInputCElement () {
public IWorkingCopy getInputCElement () {
return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput());
}
@ -1950,13 +1950,13 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
* @return the most narrow element which includes the given offset
*/
protected ICElement getElementAt(int offset, boolean reconcile) {
ITranslationUnit unit= (ITranslationUnit) getInputCElement();
IWorkingCopy unit= getInputCElement();
if (unit != null) {
try {
if (reconcile && unit instanceof IWorkingCopy) {
if (reconcile) {
synchronized (unit) {
((IWorkingCopy) unit).reconcile();
unit.reconcile();
}
return unit.getElementAtOffset(offset);
} else if (unit.isStructureKnown() && unit.isConsistent() && !fIsReconciling) {
@ -1964,7 +1964,7 @@ public class CEditor extends TextEditor implements ICEditor, ISelectionChangedLi
}
} catch (CModelException x) {
CUIPlugin.log(x.getStatus());
// nothing found, be tolerant and go on
// Nothing found, be tolerant and go on.
}
}