mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 199268: [Editor] Show in Project Explorer fails outside of functions
This commit is contained in:
parent
04caf0d36f
commit
f08b682189
2 changed files with 10 additions and 9 deletions
|
@ -1047,7 +1047,7 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
|||
*/
|
||||
public boolean show(ShowInContext context) {
|
||||
ISelection selection= context.getSelection();
|
||||
if (selection != null) {
|
||||
if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) {
|
||||
selectReveal(selection);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1246,17 +1246,18 @@ public class CEditor extends TextEditor implements ISelectionChangedListener, IC
|
|||
ICElement ce= null;
|
||||
try {
|
||||
ce= SelectionConverter.getElementAtOffset(this);
|
||||
if (ce instanceof ITranslationUnit) {
|
||||
ce = null;
|
||||
}
|
||||
} catch (CModelException ex) {
|
||||
ce= null;
|
||||
}
|
||||
if (ce != null) {
|
||||
final ISelection selection= new StructuredSelection(ce);
|
||||
return new IShowInSource() {
|
||||
public ShowInContext getShowInContext() {
|
||||
return new ShowInContext(getEditorInput(), selection);
|
||||
}
|
||||
};
|
||||
}
|
||||
final ISelection selection= ce != null ? new StructuredSelection(ce) : null;
|
||||
return new IShowInSource() {
|
||||
public ShowInContext getShowInContext() {
|
||||
return new ShowInContext(getEditorInput(), selection);
|
||||
}
|
||||
};
|
||||
}
|
||||
if (ProjectionAnnotationModel.class.equals(required)) {
|
||||
if (fProjectionSupport != null) {
|
||||
|
|
Loading…
Add table
Reference in a new issue