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