Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to get a TextViewer from IEditorPart ?
How to get a TextViewer from IEditorPart ? [message #252694] Wed, 16 April 2008 11:51 Go to next message
Eclipse UserFriend
Originally posted by: reg.zhuce.163.com

It's in the method:
public void setActiveEditor(IAction action, IEditorPart targetEditor).
Re: How to get a TextViewer from IEditorPart ? [message #252701 is a reply to message #252694] Wed, 16 April 2008 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reg.zhuce.163.com

dazh 写道:
> It's in the method:
> public void setActiveEditor(IAction action, IEditorPart targetEditor).
I know I can do like this:
((JavaEditor)targetEditor).getViewer()
But it's told
"Discouraged access: The type JavaEditor is not accessible due to
restriction on
required library"
Is there any way alternative?
Re: How to get a TextViewer from IEditorPart ? [message #252733 is a reply to message #252701] Thu, 17 April 2008 04:26 Go to previous messageGo to next message
Eclipse UserFriend
dazh wrote:
> dazh 写道:
>
>> It's in the method:
>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>
> I know I can do like this:
> ((JavaEditor)targetEditor).getViewer()
> But it's told
> "Discouraged access: The type JavaEditor is not accessible due to
> restriction on
> required library"
> Is there any way alternative?
>
No. The viewer must not be accessed unless it is your own editor.

Dani
Re: How to get a TextViewer from IEditorPart ? [message #252742 is a reply to message #252733] Thu, 17 April 2008 09:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reg.zhuce.163.com

Daniel Megert 写道:
> dazh wrote:
>> dazh 写道:
>>
>>> It's in the method:
>>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>>
>> I know I can do like this:
>> ((JavaEditor)targetEditor).getViewer()
>> But it's told
>> "Discouraged access: The type JavaEditor is not accessible due to
>> restriction on
>> required library"
>> Is there any way alternative?
>>
> No. The viewer must not be accessed unless it is your own editor.
>
> Dani
Thanks
Then if I want to customize ContentAssistant which has to access viewer,
I must implement a editor?
That's terrible.
Re: How to get a TextViewer from IEditorPart ? [message #252793 is a reply to message #252742] Fri, 18 April 2008 03:06 Go to previous messageGo to next message
Eclipse UserFriend
dazh wrote:
> Daniel Megert 写道:
>
>> dazh wrote:
>>
>>> dazh 写道:
>>>
>>>
>>>> It's in the method:
>>>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>>>
>>>>
>>> I know I can do like this:
>>> ((JavaEditor)targetEditor).getViewer()
>>> But it's told
>>> "Discouraged access: The type JavaEditor is not accessible due to
>>> restriction on
>>> required library"
>>> Is there any way alternative?
>>>
>>>
>> No. The viewer must not be accessed unless it is your own editor.
>>
>> Dani
>>
> Thanks
> Then if I want to customize ContentAssistant which has to access viewer,
> I must implement a editor?
> That's terrible.
>
No it is not. You can register a completion proposal computer via
extension point.

Dani
Re: How to get a TextViewer from IEditorPart ? [message #252917 is a reply to message #252793] Wed, 23 April 2008 05:52 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: reg.zhuce.163.com

Daniel Megert 写道:
> dazh wrote:
>> Daniel Megert 写道:
>>
>>> dazh wrote:
>>>
>>>> dazh 写道:
>>>>
>>>>
>>>>> It's in the method:
>>>>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>>>>
>>>>>
>>>> I know I can do like this:
>>>> ((JavaEditor)targetEditor).getViewer()
>>>> But it's told
>>>> "Discouraged access: The type JavaEditor is not accessible due to
>>>> restriction on
>>>> required library"
>>>> Is there any way alternative?
>>>>
>>>>
>>> No. The viewer must not be accessed unless it is your own editor.
>>>
>>> Dani
>>>
>> Thanks
>> Then if I want to customize ContentAssistant which has to access viewer,
>> I must implement a editor?
>> That's terrible.
>>
> No it is not. You can register a completion proposal computer via
> extension point.
>
> Dani
Really? That's exiting.
I tried a lot of extension points, such as
org.eclipse.jdt.ui.javaCompletionProposalComputer.
But it throws exceptions, and I do not know why at all.
How can I realize it via extension point? Would you give any details?
Re: How to get a TextViewer from IEditorPart ? [message #252939 is a reply to message #252917] Wed, 23 April 2008 12:16 Go to previous messageGo to next message
Eclipse UserFriend
dazh wrote:
> Daniel Megert 写道:
>
>> dazh wrote:
>>
>>> Daniel Megert 写道:
>>>
>>>
>>>> dazh wrote:
>>>>
>>>>
>>>>> dazh 写道:
>>>>>
>>>>>
>>>>>
>>>>>> It's in the method:
>>>>>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>>>>>
>>>>>>
>>>>>>
>>>>> I know I can do like this:
>>>>> ((JavaEditor)targetEditor).getViewer()
>>>>> But it's told
>>>>> "Discouraged access: The type JavaEditor is not accessible due to
>>>>> restriction on
>>>>> required library"
>>>>> Is there any way alternative?
>>>>>
>>>>>
>>>>>
>>>> No. The viewer must not be accessed unless it is your own editor.
>>>>
>>>> Dani
>>>>
>>>>
>>> Thanks
>>> Then if I want to customize ContentAssistant which has to access viewer,
>>> I must implement a editor?
>>> That's terrible.
>>>
>>>
>> No it is not. You can register a completion proposal computer via
>> extension point.
>>
>> Dani
>>
> Really? That's exiting.
> I tried a lot of extension points, such as
> org.eclipse.jdt.ui.javaCompletionProposalComputer.
> But it throws exceptions, and I do not know why at all.
> How can I realize it via extension point? Would you give any details?
>
Just look how other do it, e.g. jdt.ui itself uses the extension point.
So, I suggest you start there.

Dani
Re: How to get a TextViewer from IEditorPart ? [message #252956 is a reply to message #252939] Thu, 24 April 2008 03:03 Go to previous message
Eclipse UserFriend
Originally posted by: reg.zhuce.163.com

Daniel Megert 写道:
> dazh wrote:
>> Daniel Megert 写道:
>>
>>> dazh wrote:
>>>
>>>> Daniel Megert 写道:
>>>>
>>>>
>>>>> dazh wrote:
>>>>>
>>>>>
>>>>>> dazh 写道:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> It's in the method:
>>>>>>> public void setActiveEditor(IAction action, IEditorPart targetEditor).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>> I know I can do like this:
>>>>>> ((JavaEditor)targetEditor).getViewer()
>>>>>> But it's told
>>>>>> "Discouraged access: The type JavaEditor is not accessible due to
>>>>>> restriction on
>>>>>> required library"
>>>>>> Is there any way alternative?
>>>>>>
>>>>>>
>>>>>>
>>>>> No. The viewer must not be accessed unless it is your own editor.
>>>>>
>>>>> Dani
>>>>>
>>>>>
>>>> Thanks
>>>> Then if I want to customize ContentAssistant which has to access viewer,
>>>> I must implement a editor?
>>>> That's terrible.
>>>>
>>>>
>>> No it is not. You can register a completion proposal computer via
>>> extension point.
>>>
>>> Dani
>>>
>> Really? That's exiting.
>> I tried a lot of extension points, such as
>> org.eclipse.jdt.ui.javaCompletionProposalComputer.
>> But it throws exceptions, and I do not know why at all.
>> How can I realize it via extension point? Would you give any details?
>>
> Just look how other do it, e.g. jdt.ui itself uses the extension point.
> So, I suggest you start there.
>
> Dani
Thank you for your suggestion.
In fact,I have looked lots of code before I asked here.
I have fixed the exception.
But it seems that the plug-in isn't loaded at all.
How can I trigger it?
What's more, how can I define other auto-activation-characters different
from the built-in ones, such as '#'?
Previous Topic:Is there any extension points for JavaSourceViewerConfiguration
Next Topic:java parser
Goto Forum:
  


Current Time: Sun Apr 27 10:13:42 EDT 2025

Powered by FUDForum. Page generated in 0.03061 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top