1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-13 11:15:38 +02:00

Bug 539307 - Have Codan test suites open files in C editor, not Generic Editor

Change-Id: Icce2cfafe8e516ddad6abc30505bd4c67b062f47
This commit is contained in:
Nathan Ridge 2018-09-25 13:13:17 -04:00
parent 467aab5559
commit 0593f0b3af

View file

@ -19,7 +19,6 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
@ -34,6 +33,9 @@ import org.eclipse.ui.texteditor.ITextEditor;
* Utility tools to open editor and highlight the line
*/
public class CodanEditorUtility {
private static final String C_EDITOR_ID= "org.eclipse.cdt.ui.editor.CEditor"; //$NON-NLS-1$
/**
* @param fileUrl - file "url", like file:/tmp/a.c#22
* @throws PartInitException
@ -87,8 +89,7 @@ public class CodanEditorUtility {
efile = (IFile) markerResource;
if (efile != null) {
IWorkbenchPage page = getActivePage();
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file);
IEditorPart part = page.openEditor(new FileEditorInput(efile), desc.getId());
IEditorPart part = page.openEditor(new FileEditorInput(efile), C_EDITOR_ID);
return part;
}
File fileToOpen = new File(file);