1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-16 04:35:45 +02:00

Merge in fix submitted by Alex Chapiro for NPE in CView

This commit is contained in:
Sebastien Marineau 2002-08-26 22:11:42 +00:00
parent 43f276c433
commit b6d69ba0e1

View file

@ -998,10 +998,11 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
IEditorReference[] editorReferences = page.getEditorReferences(); IEditorReference[] editorReferences = page.getEditorReferences();
for (int i = 0; i < editorReferences.length; ++i) { for (int i = 0; i < editorReferences.length; ++i) {
IEditorPart editor = editorReferences[i].getEditor(false); IEditorPart editor = editorReferences[i].getEditor(false);
IEditorInput input = editor.getEditorInput(); if(null != editor) {
if (input instanceof IFileEditorInput IEditorInput input = editor.getEditorInput();
&& file.equals(((IFileEditorInput)input).getFile())) { if (input instanceof IFileEditorInput && file.equals(((IFileEditorInput)input).getFile())) {
page.bringToTop(editor); page.bringToTop(editor);
}
return; return;
} }
} }
@ -1014,15 +1015,16 @@ public class CView extends ViewPart implements IMenuListener, ISetSelectionTarge
IEditorReference editorReferences[] = page.getEditorReferences(); IEditorReference editorReferences[] = page.getEditorReferences();
for (int i = 0; i < editorReferences.length; ++i) { for (int i = 0; i < editorReferences.length; ++i) {
IEditorPart editor = editorReferences[i].getEditor(false); IEditorPart editor = editorReferences[i].getEditor(false);
IEditorInput input = editor.getEditorInput(); if(null != editor) {
if (input instanceof IFileEditorInput IEditorInput input = editor.getEditorInput();
&& res.equals(((IFileEditorInput)input).getFile())) { if (input instanceof IFileEditorInput && res.equals(((IFileEditorInput)input).getFile())) {
page.bringToTop(editor); page.bringToTop(editor);
if (editor instanceof CEditor) { if (editor instanceof CEditor) {
CEditor e = (CEditor)editor; CEditor e = (CEditor)editor;
e.selectionChanged (new SelectionChangedEvent (e.getOutlinePage (), selection)); e.selectionChanged (new SelectionChangedEvent (e.getOutlinePage (),selection));
}
return;
} }
return;
} }
} }