Test [message #155069] |
Fri, 02 June 2006 10:24  |
Eclipse User |
|
|
|
Originally posted by: jebinjohanson.gmail.com
|
|
|
|
|
|
|
|
Re: Test [message #156699 is a reply to message #156596] |
Wed, 14 June 2006 01:50  |
Eclipse User |
|
|
|
Originally posted by: jebinjohanson.gmail.com
Hi ,
I have pasted the snippet.
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
IEditorPart editor = page.getActiveEditor();
IEditorInput editorInput = editor.getEditorInput();
/** this line gives the exception
IFile ifile = ((FileEditorInput) editor.getEditorInput()).getFile();
Also what do u mean by text editor..I cant get it..
Thanks in advance,
Jebin
"Rathish" <rathish_j@thbs.com> wrote in message
news:e6mjq7$vcs$1@utils.eclipse.org...
> ur editor is TextEditor right? ru implementing in the following way?
>
> IEditorInput input = getEditorInput();
> FileEditorInput fileInput = (FileEditorInput)input;
> IFile selectedFile = fileInput.getFile();
>
> im using the same code in my plugin but im not getting any type cast
> exception!! can u send ur the code fragment...
>
>
> "Jebin" <jebinjohanson@gmail.com> wrote in message
> news:e6mcaj$vpd$1@utils.eclipse.org...
>> Hi,
>>
>> I tried the solution u gave me. But i'm getting a Classcast Exception
>> while type casting IEditorInput to FileEditorInput. When i did a
>> getclass() to the result of getEditorInput(),i'm getting FileEditorInput.
>> But when i typecast it i get an exception.Do u have any idea?ANy help
>> will be much helpful.
>>
>> Jebin
>> "Rathish" <rathish_j@thbs.com> wrote in message
>> news:e6b6en$vg0$1@utils.eclipse.org...
>>> in editor we have function called getEditorInput(). which returns the
>>> object of IEditorInput, typecast the input to FileEditorInput... from
>>> that u can find that file belong to which project, which
>>> container..etc..
>>>
>>> sample code..
>>> input = getEditorInput();
>>> fileInput = (FileEditorInput)input;
>>> selectedFile = fileInput.getFile();
>>>
>>> i think it may help u...(it addressing ur question?)
>>>
>>> regards
>>> rathish raj j
>>>
>>> "Jebin" <jebinjohanson@gmail.com> wrote in message
>>> news:e6b1ch$84j$1@utils.eclipse.org...
>>>> Hi! Friends,
>>>>
>>>> I wanted to know that what could be the method by which we could find
>>>> out
>>>> the currently selected file.
>>>>
>>>> I'm writing a plugin which requires the currently opened file in the
>>>> Eclipse
>>>> editor. If there are multiple files opened file,then i need the
>>>> currently
>>>> selected file.
>>>>
>>>> I'm able to get all the projects in the workspace. But i'm not able to
>>>> proceed from there.
>>>>
>>>> Any type of help would be highly appreciated..
>>>>
>>>>
>>>> Thanks in advance,
>>>> Jebin
>>>>
>>>> ""Fabi
|
|
|
Powered by
FUDForum. Page generated in 0.08716 seconds