mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
NPE in C/C++-search, bug 192205
This commit is contained in:
parent
4b6912f7b5
commit
db60b3f7b1
1 changed files with 21 additions and 20 deletions
|
@ -67,31 +67,32 @@ public class PDOMSearchResult extends AbstractTextSearchResult implements IEdito
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFileName(IEditorPart editor) {
|
private String getFileName(IEditorPart editor) {
|
||||||
IEditorInput input = editor.getEditorInput();
|
final IEditorInput input= editor.getEditorInput();
|
||||||
|
IPath path= null;
|
||||||
if (input instanceof FileEditorInput) {
|
if (input instanceof FileEditorInput) {
|
||||||
FileEditorInput fileInput = (FileEditorInput)input;
|
final FileEditorInput fileInput = (FileEditorInput)input;
|
||||||
return fileInput.getFile().getLocation().toOSString();
|
path= fileInput.getFile().getLocation();
|
||||||
} else if (input instanceof ExternalEditorInput) {
|
} else if (input instanceof ExternalEditorInput) {
|
||||||
ExternalEditorInput extInput = (ExternalEditorInput)input;
|
final ExternalEditorInput extInput = (ExternalEditorInput)input;
|
||||||
return extInput.getStorage().getFullPath().toOSString();
|
path= extInput.getStorage().getFullPath();
|
||||||
} else if (input instanceof IStorageEditorInput) {
|
} else if (input instanceof IStorageEditorInput) {
|
||||||
try {
|
try {
|
||||||
IStorage storage = ((IStorageEditorInput)input).getStorage();
|
final IStorage storage= ((IStorageEditorInput)input).getStorage();
|
||||||
if (storage.getFullPath() != null) {
|
path= storage.getFullPath();
|
||||||
return storage.getFullPath().toOSString();
|
|
||||||
}
|
|
||||||
} catch (CoreException exc) {
|
} catch (CoreException exc) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
} else if (input instanceof IPathEditorInput) {
|
} else if (input instanceof IPathEditorInput) {
|
||||||
IPath path= ((IPathEditorInput)input).getPath();
|
path= ((IPathEditorInput)input).getPath();
|
||||||
return path.toOSString();
|
} else {
|
||||||
}
|
|
||||||
ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class);
|
ILocationProvider provider= (ILocationProvider) input.getAdapter(ILocationProvider.class);
|
||||||
if (provider != null) {
|
if (provider != null) {
|
||||||
IPath path= provider.getPath(input);
|
path= provider.getPath(input);
|
||||||
return path.toOSString();
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (path != null)
|
||||||
|
return path.toOSString();
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue