Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » where to put images whether in ImageRegistry or at ImageDescriptor
where to put images whether in ImageRegistry or at ImageDescriptor [message #467551] Mon, 07 May 2007 07:01 Go to next message
Eclipse UserFriend
Originally posted by: johansusai.yahoo.co.in

I want to use my own images through out my plugin, just like images under ISharedImages.
To do so, tell me whether i have to put my images in ImageRegistry or in ImageDescriptor. kindly explain in detail.

Thanks in Advance

JohanSusai
Re: where to put images whether in ImageRegistry or at ImageDescriptor [message #467687 is a reply to message #467551] Thu, 10 May 2007 03:36 Go to previous messageGo to next message
David Kyle is currently offline David KyleFriend
Messages: 125
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0085_01C79282.1ACACA90
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Use the plugin ImageRegistry to manage your images. Your plugin =
activator should extend AbstractUIPlugin. Then override =
initializeImageRegistory(ImageRegistry).

public class Activator extends AbstractUIPlugin {
public static final String ID =3D "org.yours.ui";
public static final String MY_IMAGE_ID =3D "image.myimage";

@Override
protected void initializeImageRegistry(ImageRegistry registry) {
super.initializeImageRegistry(registry);
Bundle bundle =3D Platform.getBundle(ID);
ImageDescriptor myImage =3D =
ImageDescriptor.createFromURL(FileLocator.find(bundle, new =
Path("icons/myImage..gif"), null));
registry.put(MY_IMAGE_ID, myImage);
}
}

To use:

ImageRegistry imageRegistry =3D =
Activator.getDefault().getImageRegistry();
Image myImage =3D imageRegistry.get(Activator.MY_IMAGE_ID );

I hope this helps.

David

"Johanantonysusai" <johansusai@yahoo.co.in> wrote in message =
news:17242390.1178521349154.JavaMail.root@cp1.javalobby.org...
>I want to use my own images through out my plugin, just like images =
under ISharedImages.
> To do so, tell me whether i have to put my images in ImageRegistry or =
in ImageDescriptor. kindly explain in detail.
>=20
> Thanks in Advance
>=20
> JohanSusai
------=_NextPart_000_0085_01C79282.1ACACA90
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3086" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Use the plugin ImageRegistry to manage =
your=20
images.&nbsp;Your plugin activator should extend AbstractUIPlugin. Then =
override=20
initializeImageRegistory(ImageRegistry).</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>public class Activator extends =
AbstractUIPlugin=20
{</FONT></DIV><FONT size=3D1>
<DIV align=3Dleft></FONT><FONT face=3DArial><FONT size=3D2><FONT=20
color=3D#7f0055>&nbsp;&nbsp;&nbsp; public</FONT> <FONT=20
color=3D#7f0055>static</FONT></FONT><FONT face=3DArial> <FONT=20
color=3D#7f0055>final</FONT> String <I><FONT =
color=3D#0000c0>ID</I></FONT> =3D <FONT=20
color=3D#2a00ff>"org.yours.ui"</FONT>;</FONT></FONT></DIV >
<DIV align=3Dleft><FONT face=3DArial><FONT size=3D2>&nbsp;&nbsp;&nbsp; =
<FONT=20
color=3D#7f0055>public</FONT> <FONT =
color=3D#7f0055>static</FONT></FONT><FONT=20
face=3DArial> <FONT color=3D#7f0055>final</FONT> String <EM><FONT=20
color=3D#0000c0>MY_IMAGE_ID</FONT></EM> =3D <FONT=20
color=3D#2a00ff>"image.myimage"</FONT>;</FONT></FONT></DIV >
<DIV align=3Dleft><FONT face=3DArial><FONT size=3D2><FONT =
face=3DArial><FONT=20
size=3D2></FONT><FONT size=3D1><FONT=20
size=3D2></FONT></FONT></FONT></FONT></FONT>&nbsp; </DIV>
<DIV align=3Dleft><FONT face=3DArial><FONT face=3DArial><FONT =
size=3D1><FONT=20
size=3D2>&nbsp;&nbsp;&nbsp; @Override</FONT></FONT></DIV></FONT></FONT>
<DIV align=3Dleft><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
protected void=20
initializeImageRegistry(ImageRegistry registry) {</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp;&nbsp;super.initializeImag eRegistry(registry); </FONT></=
DIV>
<DIV align=3Dleft><FONT face=3DArial=20
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; Bundle bundle =3D=20
Platform.getBundle(ID);</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
ImageDescriptor&nbsp;myImage =3D=20
ImageDescriptor.createFromURL(FileLocator.find(bundle, new=20
Path("icons/myImage..gif"), null));</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial=20
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; =
registry.put(MY_IMAGE_ID,=20
myImage);</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
}</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2>}</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>To use:</FONT></DIV>
<DIV><FONT face=3DArial><FONT size=3D2><FONT face=3DArial=20
size=3D2></FONT></FONT></FONT>&nbsp;</DIV><FONT size=3D1>
<DIV align=3Dleft><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; =
ImageRegistry=20
imageRegistry =3D =
Activator.<I>getDefault</I>().getImageRegistry();</FONT ></DIV>
<DIV align=3Dleft></FONT><FONT size=3D2><FONT =
face=3DArial>&nbsp;&nbsp;&nbsp; Image=20
myImage =3D imageRegistry.get(Activator.</FONT><FONT =
color=3D#0000c0><FONT=20
face=3DArial><EM>MY_IMAGE_ID</EM><FONT color=3D#000000>=20
</FONT></FONT></FONT></FONT><FONT size=3D1><FONT face=3DArial=20
size=3D2>);</FONT></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I hope this helps.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>David</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"Johanantonysusai" &lt;</FONT><A=20
href=3D"mailto:johansusai@yahoo.co.in"><FONT face=3DArial=20
size=3D2>johansusai@yahoo.co.in</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A=20
href=3D"news:17242390.1178521349154.JavaMail.root@cp1.javalobby.org"><FON=
T=20
face=3DArial=20
size=3D2>news:17242390.1178521349154.JavaMail.root@cp1.javalobby.org</FON=
T></A><FONT=20
face=3DArial size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt;I =
want to use my=20
own images through out my plugin, just like images under =
ISharedImages.<BR>&gt;=20
To do so, tell me whether i have to put my images in ImageRegistry or in =

ImageDescriptor. kindly explain in detail.<BR>&gt; <BR>&gt; Thanks in=20
Advance<BR>&gt; <BR>&gt; JohanSusai</FONT></BODY></HTML>

------=_NextPart_000_0085_01C79282.1ACACA90--
Re: where to put images whether in ImageRegistry or at ImageDescriptor [message #467706 is a reply to message #467687] Thu, 10 May 2007 11:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: johansusai.yahoo.co.in

Thank you David.
Re: where to put images whether in ImageRegistry or at ImageDescriptor [message #520013 is a reply to message #467687] Wed, 10 March 2010 18:57 Go to previous message
Joey Mink is currently offline Joey MinkFriend
Messages: 87
Registered: July 2009
Location: Centreville, VA, USA
Member

David Kyle,

Thanks much for your post! It was a huge help for me.
Previous Topic:RCP / Won't start on OSX / deltapack / JavaSE1.6 / compiled on PC
Next Topic:Help on creating vertical scrollable menu - like the image attached
Goto Forum:
  


Current Time: Tue Apr 23 09:50:12 GMT 2024

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

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

Back to the top