[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Creating a new Editor
|
Hello everyone,
I am new here, so please point me to the correct newsgroup if this is
not the right newsgroup to ask the following question.
I am trying to develop a new editor for all the files with extension
cfe. I followed all the steps that are shown in numerous tutorials for
creating an editor but for some reason what works for everyone is not
working for me. I created a CfeEditor class (extends EditorPart) with
the following init() function.
*******************************************************************
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.FileEditorInput;
public void init(IEditorSite site, IEditorInput input)
throws PartInitException
{
setSite(site);
setInput(input);
System.out.println("INPUT: "+input.getClass());
if(input instanceof FileEditorInput)
{
System.out.println("input is an instance of FileEditorInput.");
}
else
{
System.out.println("input is NOT an instance of FileEditorInput");
}
}
*******************************************************************
I got the following output:
*******************************************************************
INPUT: class org.eclipse.ui.part.FileEditorInput
input is NOT an instance of FileEditorInput
*******************************************************************
(Note I tried using instanceof IFileEditorInput instead of
FileEditorInput, but got the same results)
This is very confusing because if input is of the class FileEditorInput
then it SHOULD be an instance of FileEditorInput. Once this works, I
want to get to the file (for parsing) by using
((FileEditorInput)input).getFile(). If I don't check for the instance
then it throws an ClassCastException.
Please help...
Thanks,
Peyush