1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

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
This commit is contained in:
Alain Magloire 2005-06-30 02:36:00 +00:00
parent 288e94d28e
commit 7161893f55
3 changed files with 28 additions and 5 deletions

View file

@ -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

View file

@ -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 <code>null<code> or use getInputCElement()
* @deprecated use <code>CEditor.getInputCElement()</code>.
* @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)) {

View file

@ -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());
}