|
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 |
David Kyle 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. 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> </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> 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> =
<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> </DIV>
<DIV align=3Dleft><FONT face=3DArial><FONT face=3DArial><FONT =
size=3D1><FONT=20
size=3D2> @Override</FONT></FONT></DIV></FONT></FONT>
<DIV align=3Dleft><FONT face=3DArial size=3D2> =
protected void=20
initializeImageRegistry(ImageRegistry registry) {</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2> =20
super.initializeImag eRegistry(registry); </FONT></=
DIV>
<DIV align=3Dleft><FONT face=3DArial=20
size=3D2> Bundle bundle =3D=20
Platform.getBundle(ID);</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2> =
=20
ImageDescriptor 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> =
registry.put(MY_IMAGE_ID,=20
myImage);</FONT></DIV>
<DIV align=3Dleft><FONT face=3DArial size=3D2> =
}</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> </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> </DIV><FONT size=3D1>
<DIV align=3Dleft><FONT face=3DArial size=3D2> =
ImageRegistry=20
imageRegistry =3D =
Activator.<I>getDefault</I>().getImageRegistry();</FONT ></DIV>
<DIV align=3Dleft></FONT><FONT size=3D2><FONT =
face=3DArial> 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> </DIV>
<DIV><FONT face=3DArial size=3D2>I hope this helps.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>David</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"Johanantonysusai" <</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>> 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>>I =
want to use my=20
own images through out my plugin, just like images under =
ISharedImages.<BR>>=20
To do so, tell me whether i have to put my images in ImageRegistry or in =
ImageDescriptor. kindly explain in detail.<BR>> <BR>> Thanks in=20
Advance<BR>> <BR>> JohanSusai</FONT></BODY></HTML>
------=_NextPart_000_0085_01C79282.1ACACA90--
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03196 seconds