Custom Nature icon missing [message #77731] |
Wed, 18 June 2003 15:04 |
Eclipse User |
|
|
|
Originally posted by: bob.donovan.sdrc.com
Hi,
I have created a custom Nature for a project folder. The nature is set on
the project right during performFinish() [see code below] The problem is
that the custom icon doesn't show up on the project in the Navigator
window until after I exit the Eclipse runtime session and startup again.
Then I see the icon on the corner of the project.
Any ideas??
Bob
private void setProjectNature(IProject project, String nature) {
try {
IProjectDescription description = project.getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
System.arraycopy(natures, 0, newNatures, 0, natures.length);
newNatures[natures.length] = nature;
description.setNatureIds(newNatures);
project.setDescription(description, null);
} catch (CoreException e) {
}
}
<extension
point="org.eclipse.core.resources.natures"
id="ThinClientEnvNature"
name="Thin Client Environment Nature">
<runtime>
<run class="com.edsplm.tc.ent.ide.webtier.ui.ThinClientEnvNature ">
</run>
</runtime>
</extension>
<extension point="org.eclipse.ui.projectNatureImages">
<image
id="com.edsplm.tc.ent.ide.webtier.TestEnvNatureImage"
natureId="com.edsplm.tc.ent.ide.webtier.ThinClientEnvNature "
icon="icons/thinclientenv_ovr.gif">
</image>
</extension>
|
|
|
Re: Custom Nature icon missing [message #77854 is a reply to message #77731] |
Wed, 18 June 2003 16:15 |
Eclipse User |
|
|
|
Originally posted by: Kevin.clark.accessbc.com.nospam
Try adding:
project.refreshLocal(IResource.DEPTH_INFINITE, null);
It will perform a programmatic refresh on your project (which should also
update the icons). Put that line at the end of your performFinish() method.
Bob Donovan wrote:
> Hi,
> I have created a custom Nature for a project folder. The nature is set on
> the project right during performFinish() [see code below] The problem is
> that the custom icon doesn't show up on the project in the Navigator
> window until after I exit the Eclipse runtime session and startup again.
> Then I see the icon on the corner of the project.
> Any ideas??
> Bob
> private void setProjectNature(IProject project, String nature) {
> try {
> IProjectDescription description = project.getDescription();
> String[] natures = description.getNatureIds();
> String[] newNatures = new String[natures.length + 1];
> System.arraycopy(natures, 0, newNatures, 0, natures.length);
> newNatures[natures.length] = nature;
> description.setNatureIds(newNatures);
> project.setDescription(description, null);
> } catch (CoreException e) {
> }
> }
> <extension
> point="org.eclipse.core.resources.natures"
> id="ThinClientEnvNature"
> name="Thin Client Environment Nature">
> <runtime>
> <run class="com.edsplm.tc.ent.ide.webtier.ui.ThinClientEnvNature ">
> </run>
> </runtime>
> </extension>
> <extension point="org.eclipse.ui.projectNatureImages">
> <image
> id="com.edsplm.tc.ent.ide.webtier.TestEnvNatureImage"
> natureId="com.edsplm.tc.ent.ide.webtier.ThinClientEnvNature "
> icon="icons/thinclientenv_ovr.gif">
> </image>
> </extension>
|
|
|
Re: Custom Nature icon missing [message #78065 is a reply to message #77854] |
Wed, 18 June 2003 19:37 |
Eclipse User |
|
|
|
Originally posted by: bob.donovan.sdrc.com
Kevbo,
I tried this but it didn't work?? I put the line at the end of
performFinish() as you said, but it is having no effect.
Bob
Kevbo wrote:
> Try adding:
> project.refreshLocal(IResource.DEPTH_INFINITE, null);
> It will perform a programmatic refresh on your project (which should also
> update the icons). Put that line at the end of your performFinish() method.
> Bob Donovan wrote:
> > Hi,
> > I have created a custom Nature for a project folder. The nature is set on
> > the project right during performFinish() [see code below] The problem is
> > that the custom icon doesn't show up on the project in the Navigator
> > window until after I exit the Eclipse runtime session and startup again.
> > Then I see the icon on the corner of the project.
> > Any ideas??
> > Bob
> > private void setProjectNature(IProject project, String nature) {
> > try {
> > IProjectDescription description = project.getDescription();
> > String[] natures = description.getNatureIds();
> > String[] newNatures = new String[natures.length + 1];
> > System.arraycopy(natures, 0, newNatures, 0, natures.length);
> > newNatures[natures.length] = nature;
> > description.setNatureIds(newNatures);
> > project.setDescription(description, null);
> > } catch (CoreException e) {
> > }
> > }
> > <extension
> > point="org.eclipse.core.resources.natures"
> > id="ThinClientEnvNature"
> > name="Thin Client Environment Nature">
> > <runtime>
> > <run class="com.edsplm.tc.ent.ide.webtier.ui.ThinClientEnvNature ">
> > </run>
> > </runtime>
> > </extension>
> > <extension point="org.eclipse.ui.projectNatureImages">
> > <image
> > id="com.edsplm.tc.ent.ide.webtier.TestEnvNatureImage"
> > natureId="com.edsplm.tc.ent.ide.webtier.ThinClientEnvNature "
> > icon="icons/thinclientenv_ovr.gif">
> > </image>
> > </extension>
|
|
|
Re: Custom Nature icon missing [message #78957 is a reply to message #78065] |
Fri, 20 June 2003 05:58 |
Eclipse User |
|
|
|
Originally posted by: daniel.hirscher.innovations.de
Bob,
my workaround to this problem is to close and reopen the project
after setting the project description.
project.setDescription(description, null);
project.close(null);
project.open(null);
I also tried refresh but it did not work.
> Kevbo,
>
> I tried this but it didn't work?? I put the line at the end of
> performFinish() as you said, but it is having no effect.
>
> Bob
>
> Kevbo wrote:
>
>
>>Try adding:
>>project.refreshLocal(IResource.DEPTH_INFINITE, null);
>
>
>>It will perform a programmatic refresh on your project (which should also
>>update the icons). Put that line at the end of your performFinish() method.
>
>
>>Bob Donovan wrote:
>
>
>>>Hi,
>
>
>>>I have created a custom Nature for a project folder. The nature is set on
>>>the project right during performFinish() [see code below] The problem is
>>>that the custom icon doesn't show up on the project in the Navigator
>>>window until after I exit the Eclipse runtime session and startup again.
>>>Then I see the icon on the corner of the project.
>
>
>>>Any ideas??
>>>Bob
[...]
Daniel
|
|
|
Re: Custom Nature icon missing [message #79543 is a reply to message #77731] |
Fri, 20 June 2003 21:03 |
Eclipse User |
|
|
|
Originally posted by: John_Arthorne.oti.com_
The navigator probably doesn't listen for changes to the project
description. Instead, you should add the nature and create the project
all within the same workspace operation. You can accomplish this using
IWorkspaceRunnable:
ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
public void run(IProgressMonitor monitor) {
//create the project
//add the project nature
}
}, null);
refreshLocal() is not the right approach, it has nothing to do with
refreshing views or icons. refreshLocal is for synchronizing incoming
changes from the file system.
--
Bob Donovan wrote:
> Hi,
>
> I have created a custom Nature for a project folder. The nature is set on
> the project right during performFinish() [see code below] The problem is
> that the custom icon doesn't show up on the project in the Navigator
> window until after I exit the Eclipse runtime session and startup again.
> Then I see the icon on the corner of the project.
>
> Any ideas??
> Bob
>
> private void setProjectNature(IProject project, String nature) {
> try {
> IProjectDescription description = project.getDescription();
> String[] natures = description.getNatureIds();
> String[] newNatures = new String[natures.length + 1];
> System.arraycopy(natures, 0, newNatures, 0, natures.length);
> newNatures[natures.length] = nature;
> description.setNatureIds(newNatures);
> project.setDescription(description, null);
> } catch (CoreException e) {
> }
> }
>
>
> <extension
> point="org.eclipse.core.resources.natures"
> id="ThinClientEnvNature"
> name="Thin Client Environment Nature">
> <runtime>
> <run class="com.edsplm.tc.ent.ide.webtier.ui.ThinClientEnvNature ">
> </run>
> </runtime>
> </extension>
>
> <extension point="org.eclipse.ui.projectNatureImages">
> <image
> id="com.edsplm.tc.ent.ide.webtier.TestEnvNatureImage"
> natureId="com.edsplm.tc.ent.ide.webtier.ThinClientEnvNature "
> icon="icons/thinclientenv_ovr.gif">
> </image>
> </extension>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03663 seconds