|
Re: openEditor in junit test refuses to open my editor, returns TextEditor [message #725555 is a reply to message #725475] |
Thu, 15 September 2011 07:09 |
Dani Megert Messages: 3802 Registered: July 2009 |
Senior Member |
|
|
On 14.09.2011 23:25, Jeff Johnston wrote:
> I have an editor set up to open Makefile.am and Makefile.in files. I
> have specified a contenttype extension with "am" file extension and
> "Makefile.am,Makefile.in" files specified. I also have the same
> specified in my Automake editor and I refer to the content type id
> there as well (perhaps overkill).
>
> In the Linux Tools EPP, it works fine. If one clicks on a Makefile.am
> or Makefile.in file, it opens using the editor.
>
> In my junit test, I use Display.syncExec and create a Makefile.am file
> and then try and use:
>
>
> EditorPart openEditor = org.eclipse.ui.ide.IDE.openEditor(
> workbench.getActiveWorkbenchWindow().getActivePage(),
> makefileAmFile,
> true);
>
> I then cast this to an AutomakeEditor to test various aspects of the
> editor.
>
> When I run this test, I keep getting a ClassCastException because
> openEditor keeps giving me back a TextEditor and not an AutomakeEditor.
>
> Any ideas why this works in normal Eclipse (i.e. double-clicking on a
> Makefile.am file brings up the right editor) but not under the junit
> test framework?
I see two possible reasons:
1) You manually defined the content type or default editor in your
normal Eclipse and hence it is missing when running the test
2) The bundle which defines the content type is not part of the required
bundles.
Dani
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02383 seconds