// However we can only goto a selection when there is a single
// selected object - at least that is the Eclipse convention anyway.
if (structuredSelection.size() == 1 &&
structuredSelection.getFirstElement()
instanceof DeviceSearchMatch) {
DeviceSearchMatch match =
(DeviceSearchMatch) structuredSelection.getFirstElement();
// Find an editor with which to open the selected match resource.
IFile matchedFile = match.getFile();
IEditorDescriptor defaultEditorDescriptor =
PlatformUI.getWorkbench().getEditorRegistry().
getDefaultEditor(matchedFile.getName());
try {
// If device repository is active, workbenchPage returns it -
// it is wrong, this class can not be used for showing selection.
// We close all active device repository while expect active
// device editor or nothing active
IEditorPart editor;
while((editor=workbenchPage.getActiveEditor()) != null) {
if(editor instanceof MultiPageEditorPart) break;
workbenchPage.closeEditor(editor,false);
}
DeviceEditor deviceEditor = (DeviceEditor) workbenchPage.
openEditor(new FileEditorInput(matchedFile),
defaultEditorDescriptor.getId(), true);
deviceEditor.selectDevice(match.getDeviceName());
} catch (PartInitException e) {
EclipseCommonPlugin.handleError(ABPlugin.getDefault(), e);
}
}