1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 91292

This commit is contained in:
Bogdan Gheorghe 2005-04-14 05:17:49 +00:00
parent 6c706f31ae
commit fc2141e160
2 changed files with 31 additions and 2 deletions

View file

@ -137,6 +137,31 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
ITextEditor textEditor= (ITextEditor) editorPart;
textEditor.selectAndReveal(searchMatch.startOffset, searchMatch.endOffset - searchMatch.startOffset);
}
//TODO: Put in once we have marker support for External Translation Units
/* //Get all the CProjects off the model
ICProject[] cprojects = CoreModel.getDefault().getCModel().getCProjects();
ICProject containingProject=null;
ICElement celem = null;
//Find the CProject that the element belongs to
for (int i=0; i<cprojects.length; i++){
celem = cprojects[i].findElement(searchMatch.referringElement);
containingProject=celem.getCProject();
if (containingProject != null)
break;
}
//Create a translation unit, open in editor
ITranslationUnit unit = CoreModel.getDefault().createTranslationUnitFrom(containingProject, searchMatch.path);
IEditorPart editorPart = null;
if (unit != null) {
editorPart = EditorUtility.openInEditor(unit);
}
//Show with marker
if (editorPart instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editorPart;
showWithMarker(textEditor,(IFile) celem.getUnderlyingResource(),searchMatch.startOffset, searchMatch.endOffset - searchMatch.startOffset);
}*/
} catch (CModelException e) {}
catch (CoreException e) {}
}

View file

@ -20,7 +20,6 @@ import org.eclipse.cdt.internal.ui.text.contentassist.CCompletionProcessor2;
import org.eclipse.cdt.internal.ui.text.contentassist.ContentAssistPreference;
import org.eclipse.cdt.ui.CElementContentProvider;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.ui.IWorkingCopyManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.dialogs.IDialogSettings;
@ -50,6 +49,7 @@ import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
import org.eclipse.jface.text.rules.RuleBasedScanner;
import org.eclipse.jface.text.source.IAnnotationHover;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.SourceViewerConfiguration;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
@ -208,6 +208,10 @@ public class CSourceViewerConfiguration extends TextSourceViewerConfiguration {
IContentAssistProcessor processor = null;
IWorkingCopy workingCopy = CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(getEditor().getEditorInput());
if (workingCopy == null)
return null;
IResource resource = workingCopy.getResource();
if (resource != null) {
IProject project = resource.getProject();