Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage?
How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335112] Mon, 23 March 2009 14:54 Go to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 55
Registered: July 2009
Member
Hi all.
In my application I have added the
"org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages of
the Preference dialog. In my "Problem view" I get a following warning:

"Access to referenced class
'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute 'class' is
discouraged plugin.xml ..."

I would like to remove this warning, so I have tried to do as described
here:
http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
Unfortunately, it doesn't work. The warning is still there. I add the
following lines to the .classpath file:

<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible"
pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
</accessrules>
</classpathentry>

What am I doing wrong?

Thanks in advance,
Anders Baumann
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335122 is a reply to message #335112] Mon, 23 March 2009 16:47 Go to previous messageGo to next message
Walter Harley is currently offline Walter HarleyFriend
Messages: 847
Registered: July 2009
Senior Member
"Anders Baumann" <anb@maconomy.dk> wrote in message
news:gq87rv$rgb$1@build.eclipse.org...
> Hi all.
> In my application I have added the
> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
> of the Preference dialog. In my "Problem view" I get a following warning:
>
> "Access to referenced class
> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute 'class'
> is discouraged plugin.xml ..."
>
> I would like to remove this warning, so I have tried to do as described
> here:
> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
> Unfortunately, it doesn't work. The warning is still there. I add the
> following lines to the .classpath file:
>
> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
> <accessrules>
> <accessrule kind="accessible"
> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
> </accessrules>
> </classpathentry>
>
> What am I doing wrong?


You're using an internal interface. Eclipse is warning you that you're
using code that is likely to change in a future version, thus breaking your
plug-in. In other words, by doing this you're committing to updating your
plug-in with every version of Eclipse (not to mention distributing multiple
versions of your plug-in). You should make sure to set version ranges in
your plug-in dependencies.

The reason your effort to suppress the warning didn't work appears to be
that you are missing a "/keys" in the access pattern.
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335150 is a reply to message #335122] Tue, 24 March 2009 09:00 Go to previous messageGo to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 55
Registered: July 2009
Member
Hi Walter.
Thanks for your answer. You were right. I did miss the "/keys" in the access
pattern. Unfortunately the warning is still there. My .classpath now
contains:

<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
<accessrule kind="accessible"
pattern="org/eclipse/ui/internal/keys/NewKeysPreferencePage "/>
</accessrules>
</classpathentry>

It seems to me that access rules like the one above work for normal Java
classes, but not for XML files like .classpath.

Is there a better or other way to use the NewKeysPreferencePage in my
preference dialog? It must be a very common thing to have a "Keys"
preference page in a RCP application.

Thanks in advance,
Anders Baumann





"Walter Harley" <eclipse@cafewalter.com> wrote in message
news:gq8efb$tr5$1@build.eclipse.org...
> "Anders Baumann" <anb@maconomy.dk> wrote in message
> news:gq87rv$rgb$1@build.eclipse.org...
>> Hi all.
>> In my application I have added the
>> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
>> of the Preference dialog. In my "Problem view" I get a following warning:
>>
>> "Access to referenced class
>> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute 'class'
>> is discouraged plugin.xml ..."
>>
>> I would like to remove this warning, so I have tried to do as described
>> here:
>> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
>> Unfortunately, it doesn't work. The warning is still there. I add the
>> following lines to the .classpath file:
>>
>> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
>> <accessrules>
>> <accessrule kind="accessible"
>> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
>> </accessrules>
>> </classpathentry>
>>
>> What am I doing wrong?
>
>
> You're using an internal interface. Eclipse is warning you that you're
> using code that is likely to change in a future version, thus breaking
> your plug-in. In other words, by doing this you're committing to updating
> your plug-in with every version of Eclipse (not to mention distributing
> multiple versions of your plug-in). You should make sure to set version
> ranges in your plug-in dependencies.
>
> The reason your effort to suppress the warning didn't work appears to be
> that you are missing a "/keys" in the access pattern.
>
>
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335160 is a reply to message #335122] Tue, 24 March 2009 13:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 3/23/2009 12:47 PM, Walter Harley wrote:
> "Anders Baumann"<anb@maconomy.dk> wrote in message
> news:gq87rv$rgb$1@build.eclipse.org...
>> Hi all.
>> In my application I have added the
>> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
>> of the Preference dialog. In my "Problem view" I get a following warning:
>>
>> "Access to referenced class
>> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute 'class'
>> is discouraged plugin.xml ..."
>>
>> I would like to remove this warning, so I have tried to do as described
>> here:
>> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
>> Unfortunately, it doesn't work. The warning is still there. I add the
>> following lines to the .classpath file:
>>
>> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
>> <accessrules>
>> <accessrule kind="accessible"
>> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
>> </accessrules>
>> </classpathentry>
>>
>> What am I doing wrong?
>
>
> You're using an internal interface. Eclipse is warning you that you're
> using code that is likely to change in a future version, thus breaking your
> plug-in. In other words, by doing this you're committing to updating your
> plug-in with every version of Eclipse (not to mention distributing multiple
> versions of your plug-in). You should make sure to set version ranges in
> your plug-in dependencies.
>
> The reason your effort to suppress the warning didn't work appears to be
> that you are missing a "/keys" in the access pattern.

I agree with Walter; you should leave the warning in place as a reminder
that you are doing something that is discouraged.
If you really want to remove the warning, it is easier to just use the
QuickFix (put cursor on the marked line of code and hit Ctrl+1) to
insert an @SuppressWarnings("restriction") annotation.

Hope this helps,
Eric
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335162 is a reply to message #335160] Tue, 24 March 2009 14:49 Go to previous messageGo to next message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 55
Registered: July 2009
Member
Hi Eric.
Thanks for your answer.
But how do I put a @SuppressWarnings("restriction") in an XML file? The
warning is in the plugin.xml.

Also, Is there a better or other way to use the NewKeysPreferencePage in my
preference dialog? It must be a very common thing to have a "Keys"
preference page in a RCP application.

Thanks in advance,
Anders Baumann



"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:gqaou6$peb$1@build.eclipse.org...
> On 3/23/2009 12:47 PM, Walter Harley wrote:
>> "Anders Baumann"<anb@maconomy.dk> wrote in message
>> news:gq87rv$rgb$1@build.eclipse.org...
>>> Hi all.
>>> In my application I have added the
>>> "org.eclipse.ui.internal.keys.NewKeysPreferencePage" as one of the pages
>>> of the Preference dialog. In my "Problem view" I get a following
>>> warning:
>>>
>>> "Access to referenced class
>>> 'org.eclipse.ui.internal.keys.NewKeysPreferencePage' in attribute
>>> 'class'
>>> is discouraged plugin.xml ..."
>>>
>>> I would like to remove this warning, so I have tried to do as described
>>> here:
>>> http://wiki.eclipse.org/DTP_Resolving_Internal_Discouraged_A ccess_Warnings.
>>> Unfortunately, it doesn't work. The warning is still there. I add the
>>> following lines to the .classpath file:
>>>
>>> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
>>> <accessrules>
>>> <accessrule kind="accessible"
>>> pattern="org/eclipse/ui/internal/NewKeysPreferencePage"/>
>>> </accessrules>
>>> </classpathentry>
>>>
>>> What am I doing wrong?
>>
>>
>> You're using an internal interface. Eclipse is warning you that you're
>> using code that is likely to change in a future version, thus breaking
>> your
>> plug-in. In other words, by doing this you're committing to updating
>> your
>> plug-in with every version of Eclipse (not to mention distributing
>> multiple
>> versions of your plug-in). You should make sure to set version ranges in
>> your plug-in dependencies.
>>
>> The reason your effort to suppress the warning didn't work appears to be
>> that you are missing a "/keys" in the access pattern.
>
> I agree with Walter; you should leave the warning in place as a reminder
> that you are doing something that is discouraged.
> If you really want to remove the warning, it is easier to just use the
> QuickFix (put cursor on the marked line of code and hit Ctrl+1) to insert
> an @SuppressWarnings("restriction") annotation.
>
> Hope this helps,
> Eric
Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335302 is a reply to message #335162] Tue, 31 March 2009 15:49 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Anders Baumann wrote:
> Hi Eric.
> Thanks for your answer.
> But how do I put a @SuppressWarnings("restriction") in an XML file? The
> warning is in the plugin.xml.
>
> Also, Is there a better or other way to use the NewKeysPreferencePage in my
> preference dialog? It must be a very common thing to have a "Keys"
> preference page in a RCP application.

Yes, use org.eclipse.ui.ExtensionFactory to add the preference page.
For example:
<page
name="%PreferencePages.NewKeys"
category="org.eclipse.ui.preferencePages.Workbench"
class="org.eclipse.ui.ExtensionFactory:newKeysPreferencePage "
id="org.eclipse.ui.preferencePages.Keys">
<keywordReference id="org.eclipse.ui.ide.keys"/>
</page>


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: How to remove an Internal Discouraged Access Warnings for NewKeysPreferencePage? [message #335313 is a reply to message #335302] Tue, 31 March 2009 18:49 Go to previous message
Anders Baumann is currently offline Anders BaumannFriend
Messages: 55
Registered: July 2009
Member
Thanks, Paul. You are the man!!

Best regards,
Anders


"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:gqte2g$uqu$1@build.eclipse.org...
> Anders Baumann wrote:
>> Hi Eric.
>> Thanks for your answer.
>> But how do I put a @SuppressWarnings("restriction") in an XML file? The
>> warning is in the plugin.xml.
>>
>> Also, Is there a better or other way to use the NewKeysPreferencePage in
>> my preference dialog? It must be a very common thing to have a "Keys"
>> preference page in a RCP application.
>
> Yes, use org.eclipse.ui.ExtensionFactory to add the preference page. For
> example:
> <page
> name="%PreferencePages.NewKeys"
> category="org.eclipse.ui.preferencePages.Workbench"
> class="org.eclipse.ui.ExtensionFactory:newKeysPreferencePage "
> id="org.eclipse.ui.preferencePages.Keys">
> <keywordReference id="org.eclipse.ui.ide.keys"/>
> </page>
>
>
> --
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://wiki.eclipse.org/Menus_Extension_Mapping
> http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm
Previous Topic:LTK copy refactoring
Next Topic:[Databinding] JFace Rhino Databinding
Goto Forum:
  


Current Time: Sun Sep 15 07:09:51 GMT 2024

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

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

Back to the top