Home » Newcomers » Newcomers » What to do about discouraged access? E.g. org.eclipse.team.internal.ui.ITeamUIImages
What to do about discouraged access? E.g. org.eclipse.team.internal.ui.ITeamUIImages [message #113982] |
Wed, 02 November 2005 13:14  |
Eclipse User |
|
|
|
I've inherited some code for an Eclipse plugin which was working fine. I
then recently upgrade to Eclipse 3.2 and now I'm getting warnings about
"Discouraged access". I'm assuming this is something like Sun's concept of
@Deprecated, but I don't know what to do to replicate the desired
functionality without using discouraged-access API.
As a concrete example, I've got an expression that reads
" TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).cr eateImage(); ",
where "ITeamUIImages.IMG_KEY_LOCK" is marked as being discouraged-access. I
couldn't find ITeamUIImages anywhere in the JavaDocs for the Eclipse API, so
how can I find out what I should use instead, assuming I want to remove
references to it?
While it'd be nice to have an answer to the specific example above, I'm
actually sort of looking for a general solution. Once you find out your code
is using discouraged-access API, how can you, in general, find out the
"proper" way to implement whatever you're trying to do? Is there any
documentation on this?
- Oliver
|
|
|
Re: What to do about discouraged access? E.g. org.eclipse.team.internal.ui.ITeamUIImages [message #114168 is a reply to message #113982] |
Wed, 02 November 2005 16:39   |
Eclipse User |
|
|
|
Oliver Wong wrote:
> I've inherited some code for an Eclipse plugin which was working fine. I
> then recently upgrade to Eclipse 3.2 and now I'm getting warnings about
> "Discouraged access". I'm assuming this is something like Sun's concept of
> @Deprecated, but I don't know what to do to replicate the desired
> functionality without using discouraged-access API.
>
> As a concrete example, I've got an expression that reads
> " TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).cr eateImage(); ",
> where "ITeamUIImages.IMG_KEY_LOCK" is marked as being discouraged-access. I
> couldn't find ITeamUIImages anywhere in the JavaDocs for the Eclipse API, so
> how can I find out what I should use instead, assuming I want to remove
> references to it?
>
> While it'd be nice to have an answer to the specific example above, I'm
> actually sort of looking for a general solution. Once you find out your code
> is using discouraged-access API, how can you, in general, find out the
> "proper" way to implement whatever you're trying to do? Is there any
> documentation on this?
>
> - Oliver
>
>
Oliver,
This does not mean the same thing as deprecated. It means that this
Java element (class, method or field) is not part of the API. For the
example you gave, note the word "internal" in the package name. The
element is not deprecated, but you should not be using it either.
Steve
|
|
|
Re: What to do about discouraged access? E.g. org.eclipse.team.internal.ui.ITeamUIImages [message #114177 is a reply to message #114168] |
Wed, 02 November 2005 17:03   |
Eclipse User |
|
|
|
"Steve Wasleski" <wasleski@us.ibm.com> wrote in message
news:dkbbmd$4rt$1@news.eclipse.org...
> Oliver Wong wrote:
>> I've inherited some code for an Eclipse plugin which was working
>> fine. I then recently upgrade to Eclipse 3.2 and now I'm getting warnings
>> about "Discouraged access". I'm assuming this is something like Sun's
>> concept of @Deprecated, but I don't know what to do to replicate the
>> desired functionality without using discouraged-access API.
>>
>> As a concrete example, I've got an expression that reads
>> " TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).cr eateImage(); ",
>> where "ITeamUIImages.IMG_KEY_LOCK" is marked as being discouraged-access.
>> I couldn't find ITeamUIImages anywhere in the JavaDocs for the Eclipse
>> API, so how can I find out what I should use instead, assuming I want to
>> remove references to it?
>>
>> While it'd be nice to have an answer to the specific example above,
>> I'm actually sort of looking for a general solution. Once you find out
>> your code is using discouraged-access API, how can you, in general, find
>> out the "proper" way to implement whatever you're trying to do? Is there
>> any documentation on this?
>>
>> - Oliver
> Oliver,
>
> This does not mean the same thing as deprecated. It means that this Java
> element (class, method or field) is not part of the API. For the example
> you gave, note the word "internal" in the package name. The element is
> not deprecated, but you should not be using it either.
Thanks for the responce. The issue still remains though of how am I
supposed to find out what I should use instead? Is it a case-by-case thing
and so I'm essentially out of luck? In the specific example I gave, it looks
like the goal is basically to load an image of a lock, with
getImageDescriptor acting like a Map from keys to images. If I can't use the
ITeamUIImages.IMG_KEY_LOCK as a key, what can I use to get the same image?
- Oliver
|
|
|
Re: What to do about discouraged access? E.g. org.eclipse.team.internal.ui.ITeamUIImages [message #114521 is a reply to message #114177] |
Thu, 03 November 2005 14:54  |
Eclipse User |
|
|
|
Oliver Wong wrote:
> "Steve Wasleski" <wasleski@us.ibm.com> wrote in message
> news:dkbbmd$4rt$1@news.eclipse.org...
>
>>Oliver Wong wrote:
>>
>>> I've inherited some code for an Eclipse plugin which was working
>>>fine. I then recently upgrade to Eclipse 3.2 and now I'm getting warnings
>>>about "Discouraged access". I'm assuming this is something like Sun's
>>>concept of @Deprecated, but I don't know what to do to replicate the
>>>desired functionality without using discouraged-access API.
>>>
>>> As a concrete example, I've got an expression that reads
>>>" TeamImages.getImageDescriptor(ITeamUIImages.IMG_KEY_LOCK).cr eateImage(); ",
>>>where "ITeamUIImages.IMG_KEY_LOCK" is marked as being discouraged-access.
>>>I couldn't find ITeamUIImages anywhere in the JavaDocs for the Eclipse
>>>API, so how can I find out what I should use instead, assuming I want to
>>>remove references to it?
>>>
>>> While it'd be nice to have an answer to the specific example above,
>>>I'm actually sort of looking for a general solution. Once you find out
>>>your code is using discouraged-access API, how can you, in general, find
>>>out the "proper" way to implement whatever you're trying to do? Is there
>>>any documentation on this?
>>>
>>> - Oliver
>>
>>Oliver,
>>
>>This does not mean the same thing as deprecated. It means that this Java
>>element (class, method or field) is not part of the API. For the example
>>you gave, note the word "internal" in the package name. The element is
>>not deprecated, but you should not be using it either.
>
>
> Thanks for the responce. The issue still remains though of how am I
> supposed to find out what I should use instead? Is it a case-by-case thing
> and so I'm essentially out of luck? In the specific example I gave, it looks
> like the goal is basically to load an image of a lock, with
> getImageDescriptor acting like a Map from keys to images. If I can't use the
> ITeamUIImages.IMG_KEY_LOCK as a key, what can I use to get the same image?
>
> - Oliver
>
>
Oliver,
The images themselves are not part of the api either, so you should not
be using them at all. The Team UI developers are free to move these
around and rename then as they wish since they are internal. Whoever
wrote your code originally made a mistake by relying on these images and
constants. It has always been the case that elements that are not
explicitly declared as part of the api are not api (any thing in an
internal package is not api - other things are not either). The
difference between 3.0 and 3.1 or 3.2 is that Eclipse is getting better
at detecting these violations.
It appears the Team UI developers do make some of their images part of
the api. See org.eclipse.team.ui.ISharedImages and
org.eclipse.team.ui.TeamImages. If they decide to share this particular
one, I think they would move its key definition into ISharedImages. You
could open an enhancement request in bugzilla asking for this.
Otherwise, you should create your own image in your plugin and use it
instead.
Steve
|
|
|
Goto Forum:
Current Time: Mon May 12 00:44:39 EDT 2025
Powered by FUDForum. Page generated in 0.11513 seconds
|