diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index e56c3634b5e..7021bf8dca8 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,8 @@ +2005-06-29 Alain Magloire + Fix PR 102159: NPE in the referencesSearchGroup: fillcontextMenu. + * src/org/eclipse/cdt/internal/ui/editor/CEditor.java + * src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java + 2005-06-25 Alain Magloire Fix PR 98458: extra semicolon in namespace wizard class. * src/org/eclipse/cdt/internal/ui/wizards/classwizard/NewClassCodeGenerator.java diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java index 328e3cc5798..d007bc9aebe 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/CEditor.java @@ -236,6 +236,9 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS if (fProjectionModelUpdater != null) { fProjectionModelUpdater.initialize(); } + if (fCEditorErrorTickUpdater != null) { + fCEditorErrorTickUpdater.updateEditorImage(getInputCElement()); + } } /** @@ -247,10 +250,24 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IS } /** - * Gets the current input - * @return IFile Input file. + * Returns the C element wrapped by this editors input. + * + * @return the C element wrapped by this editors input. + * @since 3.0 */ - public IFile getInputFile() { + public ICElement getInputCElement () { + return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditorInput()); + } + + /** + * Gets the current IFile input. + * This method will be remove after cdt-3.0. + * We can not guaranty that the input is an IFile, it may + * an external file. Clients should test for null or use getInputCElement() + * @deprecated use CEditor.getInputCElement(). + * @return IFile Input file or null if input is not and IFileEditorInput. + */ + public IFile getInputFile() { IEditorInput editorInput = getEditorInput(); if (editorInput != null) { if ((editorInput instanceof IFileEditorInput)) { diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java index 7b8b7bc2511..48b2e0d2319 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/search/actions/ReferencesSearchGroup.java @@ -83,8 +83,9 @@ public class ReferencesSearchGroup extends ActionGroup { } if (fEditor != null){ - IFile fileInput= fEditor.getInputFile(); - ICDTIndexer indexer = CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(fileInput.getProject()); + //IFile fileInput= fEditor.getInputFile(); + ICElement celement = fEditor.getInputCElement(); + ICDTIndexer indexer = CCorePlugin.getDefault().getCoreModel().getIndexManager().getIndexerForProject(celement.getCProject().getProject()); if (indexer != null){ setReferenceMenuEnabled(indexer.getIndexerFeatures()); }