Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Custom Nature icon missing
- Custom Nature icon missing [message #77731] Wed, 18 June 2003 11:04 Go to next message
Eclipse UserFriend
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 12:15 Go to previous messageGo to next message
Eclipse UserFriend
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 15:37 Go to previous messageGo to next message
Eclipse UserFriend
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 01:58 Go to previous messageGo to next message
Eclipse UserFriend
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 17:03 Go to previous message
Eclipse UserFriend
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>
>
Previous Topic:Workspace Restorer plug-in now available
Next Topic:ClassLoader question
Goto Forum:
  


Current Time: Fri Apr 18 15:42:39 EDT 2025

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

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

Back to the top