mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix for bug 150045 - "Link with editor" does not work in C/C++ Projects view
This commit is contained in:
parent
dbf585a067
commit
468da823b3
1 changed files with 15 additions and 5 deletions
|
@ -7,8 +7,8 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Anton Leherbauer (Wind River Systems) - Fix bug 148114
|
|
||||||
* Markus Schorn (Wind River Systems)
|
* Markus Schorn (Wind River Systems)
|
||||||
|
* Anton Leherbauer (Wind River Systems) - Fix bug 150045
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.internal.ui.cview;
|
package org.eclipse.cdt.internal.ui.cview;
|
||||||
|
|
||||||
|
@ -105,6 +105,7 @@ import org.eclipse.cdt.internal.ui.dnd.ResourceTransferDragAdapter;
|
||||||
import org.eclipse.cdt.internal.ui.dnd.ResourceTransferDropAdapter;
|
import org.eclipse.cdt.internal.ui.dnd.ResourceTransferDropAdapter;
|
||||||
import org.eclipse.cdt.internal.ui.dnd.TransferDragSourceListener;
|
import org.eclipse.cdt.internal.ui.dnd.TransferDragSourceListener;
|
||||||
import org.eclipse.cdt.internal.ui.dnd.TransferDropTargetListener;
|
import org.eclipse.cdt.internal.ui.dnd.TransferDropTargetListener;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput;
|
||||||
import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
|
import org.eclipse.cdt.internal.ui.preferences.CPluginPreferencePage;
|
||||||
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
import org.eclipse.cdt.internal.ui.util.EditorUtility;
|
||||||
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
|
import org.eclipse.cdt.internal.ui.util.ProblemTreeViewer;
|
||||||
|
@ -625,16 +626,25 @@ public class CView extends ViewPart implements ISetSelectionTarget, IPropertyCha
|
||||||
}
|
}
|
||||||
|
|
||||||
IEditorInput input = editor.getEditorInput();
|
IEditorInput input = editor.getEditorInput();
|
||||||
|
Object linkElement = null;
|
||||||
if (input instanceof IFileEditorInput) {
|
if (input instanceof IFileEditorInput) {
|
||||||
CoreModel factory = CoreModel.getDefault();
|
CoreModel factory = CoreModel.getDefault();
|
||||||
IFileEditorInput fileInput = (IFileEditorInput) input;
|
IFileEditorInput fileInput = (IFileEditorInput) input;
|
||||||
IFile file = fileInput.getFile();
|
IFile file = fileInput.getFile();
|
||||||
ICElement celement = factory.create(file);
|
ICElement celement = factory.create(file);
|
||||||
if (celement != null) {
|
if (celement != null) {
|
||||||
ISelection newSelection = new StructuredSelection(celement);
|
linkElement = celement;
|
||||||
if (!viewer.getSelection().equals(newSelection)) {
|
} else {
|
||||||
viewer.setSelection(newSelection);
|
linkElement = file;
|
||||||
}
|
}
|
||||||
|
} else if (input instanceof ITranslationUnitEditorInput) {
|
||||||
|
ITranslationUnitEditorInput tuInput = (ITranslationUnitEditorInput) input;
|
||||||
|
linkElement = tuInput.getTranslationUnit();
|
||||||
|
}
|
||||||
|
if (linkElement != null) {
|
||||||
|
ISelection newSelection = new StructuredSelection(linkElement);
|
||||||
|
if (!viewer.getSelection().equals(newSelection)) {
|
||||||
|
viewer.setSelection(newSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue