Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » System icons in SWT
System icons in SWT [message #452023] Sun, 13 March 2005 13:58 Go to next message
Eclipse UserFriend
Originally posted by: seimic.tiscali.de

Hi,

is there something equivalent to Swing's FileSystemView in SWT?
I want to get the System-Icons for Drives, Network-Directories
Special-Folders, Files etc.

To get the Icon of a file by extension I can do the following.
---------------
Program program = Program.findProgram(extension); ImageData imageData =
(program == null ? null : program.getImageData()); image = (imageData !=
null)? new Image(shell.getDisplay(), imageData): defaultFileIcon; ----------
-----

But how to get the Icons for a drive or directory?
In Swing I can read this with a single line of code
---------------
Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
---------------

Thanks,
Michael
Re: System icons in SWT [message #452086 is a reply to message #452023] Mon, 14 March 2005 12:49 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Not currently supported in SWT. SWT provides some system icons (see
Display.getSystemImage()) but currently these are only the icons that appear
message dialogs. You should enter an enhancement request against Platform
SWT.

<seimic@tiscali.de> wrote in message news:opsnkw4k06ikf92g@localhost...
> Hi,
>
> is there something equivalent to Swing's FileSystemView in SWT?
> I want to get the System-Icons for Drives, Network-Directories
> Special-Folders, Files etc.
>
> To get the Icon of a file by extension I can do the following.
> ---------------
> Program program = Program.findProgram(extension); ImageData imageData =
> (program == null ? null : program.getImageData()); image = (imageData !=
> null)? new Image(shell.getDisplay(), imageData):
> defaultFileIcon; ----------
> -----
>
> But how to get the Icons for a drive or directory?
> In Swing I can read this with a single line of code
> ---------------
> Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
> ---------------
>
> Thanks,
> Michael
>
>
>
Re: System icons in SWT [message #452159 is a reply to message #452023] Mon, 14 March 2005 17:24 Go to previous messageGo to next message
Tiberiu Caprita is currently offline Tiberiu CapritaFriend
Messages: 68
Registered: July 2009
Member
Hi Michael,
I hope you are asking for Windows. If so, you can do the followings:

1. Windows system Icons are normally kept in system32.dll, to specific IDs.
You can browse MSDN Documentation or just use snippet32 to see the Icon
extracted from system32.dll and make several Iterations.
2. How to get the Icon: take a look of Program.getImageData(), you have to
Copy&Paste somewhere accessible and to put a String as param, something as
getImageData(String sDllWithIndex)
and to call it like that, by example:
getImageData("C:\\WINNT\\system32\\shell32.dll,-2")
Iterating enough you'll see (snip32) all Resources kept there. Sure, is
better if you find Windows Docs.
3. You can take a look also to:
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg18188.html

Regards,
Tiberiu
PS. By the way, Steve Northover asked me to enter a bug regarding Icons (I
did it : Bug 86785 but it seems no much movement around so minor problems)





seimic@tiscali.de wrote:

> Hi,

> is there something equivalent to Swing's FileSystemView in SWT?
> I want to get the System-Icons for Drives, Network-Directories
> Special-Folders, Files etc.

> To get the Icon of a file by extension I can do the following.
> ---------------
> Program program = Program.findProgram(extension); ImageData imageData =
> (program == null ? null : program.getImageData()); image = (imageData !=
> null)? new Image(shell.getDisplay(), imageData): defaultFileIcon; ----------
> -----

> But how to get the Icons for a drive or directory?
> In Swing I can read this with a single line of code
> ---------------
> Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
> ---------------

> Thanks,
> Michael
Re: System icons in SWT [message #452166 is a reply to message #452086] Mon, 14 March 2005 21:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: bob.objfac.com

A request covering this (?) has been around since Nov 03:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=43689

Should a separate one be filed for just the File-related icons?

Bob Foster

Veronika Irvine wrote:
> Not currently supported in SWT. SWT provides some system icons (see
> Display.getSystemImage()) but currently these are only the icons that appear
> message dialogs. You should enter an enhancement request against Platform
> SWT.
>
> <seimic@tiscali.de> wrote in message news:opsnkw4k06ikf92g@localhost...
>
>>Hi,
>>
>>is there something equivalent to Swing's FileSystemView in SWT?
>>I want to get the System-Icons for Drives, Network-Directories
>>Special-Folders, Files etc.
>>
>>To get the Icon of a file by extension I can do the following.
>>---------------
>>Program program = Program.findProgram(extension); ImageData imageData =
>>(program == null ? null : program.getImageData()); image = (imageData !=
>>null)? new Image(shell.getDisplay(), imageData):
>>defaultFileIcon; ----------
>>-----
>>
>>But how to get the Icons for a drive or directory?
>>In Swing I can read this with a single line of code
>>---------------
>>Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
>>---------------
>>
>>Thanks,
>>Michael
>>
>>
>>
>
>
>
Re: System icons in SWT [message #452202 is a reply to message #452166] Tue, 15 March 2005 12:38 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
I didn't realise we already had this request. Thanks.

"Bob Foster" <bob@objfac.com> wrote in message
news:4235FFCD.3020309@objfac.com...
>A request covering this (?) has been around since Nov 03:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=43689
>
> Should a separate one be filed for just the File-related icons?
>
> Bob Foster
>
> Veronika Irvine wrote:
>> Not currently supported in SWT. SWT provides some system icons (see
>> Display.getSystemImage()) but currently these are only the icons that
>> appear message dialogs. You should enter an enhancement request against
>> Platform SWT.
>>
>> <seimic@tiscali.de> wrote in message news:opsnkw4k06ikf92g@localhost...
>>
>>>Hi,
>>>
>>>is there something equivalent to Swing's FileSystemView in SWT?
>>>I want to get the System-Icons for Drives, Network-Directories
>>>Special-Folders, Files etc.
>>>
>>>To get the Icon of a file by extension I can do the following.
>>>---------------
>>>Program program = Program.findProgram(extension); ImageData imageData =
>>>(program == null ? null : program.getImageData()); image = (imageData !=
>>>null)? new Image(shell.getDisplay(), imageData):
>>>defaultFileIcon; ----------
>>>-----
>>>
>>>But how to get the Icons for a drive or directory?
>>>In Swing I can read this with a single line of code
>>>---------------
>>>Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
>>>---------------
>>>
>>>Thanks,
>>>Michael
>>>
>>>
>>>
>>
>>
Re: System icons in SWT [message #452304 is a reply to message #452202] Thu, 17 March 2005 10:09 Go to previous messageGo to next message
Michael is currently offline MichaelFriend
Messages: 43
Registered: July 2009
Member
Thanks for your answers.
I'm new to SWT and wanted to create some kind of directory-tree
with all drives, network directories...
I always though the desktop integration of SWT were better than this from
swing ;(

In AWT/Swing you can get all the roots using the

sun.awt.shell.ShellFolder.get("fileChooserComboBoxFolders");
and their names with FileSystemView.getFileSystemView()
..getSystemDisplayName(File file)
or icons with FileSystemView.getFileSystemView().getSystemIcon(File file)

Is it imposible in SWT to create such an direcory tree, which works on all
supported platforms?

Thanks,
Michael

Am Tue, 15 Mar 2005 07:38:16 -0500 hat Veronika Irvine
<veronika_irvine@oti.com> geschrieben:

> I didn't realise we already had this request. Thanks.
>
> "Bob Foster" <bob@objfac.com> wrote in message
> news:4235FFCD.3020309@objfac.com...
>> A request covering this (?) has been around since Nov 03:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=43689
>>
>> Should a separate one be filed for just the File-related icons?
>>
>> Bob Foster
>>
>> Veronika Irvine wrote:
>>> Not currently supported in SWT. SWT provides some system icons (see
>>> Display.getSystemImage()) but currently these are only the icons that
>>> appear message dialogs. You should enter an enhancement request
>>> against Platform SWT.
>>>
>>> <seimic@tiscali.de> wrote in message news:opsnkw4k06ikf92g@localhost...
>>>
>>>> Hi,
>>>>
>>>> is there something equivalent to Swing's FileSystemView in SWT?
>>>> I want to get the System-Icons for Drives, Network-Directories
>>>> Special-Folders, Files etc.
>>>>
>>>> To get the Icon of a file by extension I can do the following.
>>>> ---------------
>>>> Program program = Program.findProgram(extension); ImageData imageData
>>>> = (program == null ? null : program.getImageData()); image =
>>>> (imageData != null)? new Image(shell.getDisplay(), imageData):
>>>> defaultFileIcon; ---------- -----
>>>>
>>>> But how to get the Icons for a drive or directory?
>>>> In Swing I can read this with a single line of code
>>>> ---------------
>>>> Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
>>>> ---------------
>>>>
>>>> Thanks,
>>>> Michael
>>>>
>>>>
>>>>
>>>
>>>
>
>
Re: System icons in SWT [message #452306 is a reply to message #452159] Thu, 17 March 2005 10:39 Go to previous message
Michael is currently offline MichaelFriend
Messages: 43
Registered: July 2009
Member
Hi Tiberiu,

thank you. Yes I need it for windows (at first), but it should work on all
supported platforms when possible.
The directory dialogs from SWT does ist too.

The Icons for files (when the extension is known) are not the problem, I
can read them using Program.getImageData()
What I need are the drive and special directory icons and
their names (like Desktop, Workstation...). In Swing I can read it using
the FileSystemView-class.
Of course, I could write a OCX and use it in my program, but
this works only in windows.

I was hopping there is a build-in-support in SWT for such tasks.

Thanks,
Michael

Am Mon, 14 Mar 2005 17:24:18 +0000 (UTC) hat Tiberiu Caprita
<capritat@hotmail.com> geschrieben:

> Hi Michael,
> I hope you are asking for Windows. If so, you can do the followings:
>
> 1. Windows system Icons are normally kept in system32.dll, to specific
> IDs.
> You can browse MSDN Documentation or just use snippet32 to see the Icon
> extracted from system32.dll and make several Iterations.
> 2. How to get the Icon: take a look of Program.getImageData(), you have
> to Copy&Paste somewhere accessible and to put a String as param,
> something as
> getImageData(String sDllWithIndex)
> and to call it like that, by example:
> getImageData("C:\\WINNT\\system32\\shell32.dll,-2")
> Iterating enough you'll see (snip32) all Resources kept there. Sure, is
> better if you find Windows Docs.
> 3. You can take a look also to:
> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg18188.html
>
> Regards,
> Tiberiu
> PS. By the way, Steve Northover asked me to enter a bug regarding Icons
> (I did it : Bug 86785 but it seems no much movement around so minor
> problems)
>
>
>
>
>
> seimic@tiscali.de wrote:
>
>> Hi,
>
>> is there something equivalent to Swing's FileSystemView in SWT?
>> I want to get the System-Icons for Drives, Network-Directories
>> Special-Folders, Files etc.
>
>> To get the Icon of a file by extension I can do the following.
>> ---------------
>> Program program = Program.findProgram(extension); ImageData imageData =
>> (program == null ? null : program.getImageData()); image = (imageData !=
>> null)? new Image(shell.getDisplay(), imageData): defaultFileIcon; -------
>>
>>
>> --- -----
>
>> But how to get the Icons for a drive or directory?
>> In Swing I can read this with a single line of code
>> ---------------
>> Icon icon = FileSystemView.getFileSystemView().getSystemIcon(file);
>> ---------------
>
>> Thanks,
>> Michael
>
>
>
Previous Topic:Dynamic Tree Label changing
Next Topic:Is Virtual Table Really Virtual?
Goto Forum:
  


Current Time: Tue Jul 23 05:15:07 GMT 2019

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

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

Back to the top