Re: Get DataObject icon

Enrico Scantamburlo <[email protected]> Mon, 11 Dec 2017 08:20:06 +0100
Newsgroups gmane.comp.java.netbeans.modules.openide.devel
Message-ID <CAJdy_m-U-AfBM_d-2oovaZ2S8nU2ATA3uyMeKBDF6i=XdeJ+2A@mail.gmail.com>
--94eb2c12358619575905600b5d35
Content-Type: text/plain; charset="UTF-8"

About the icon:
try dataObject.getNodeDelegate().getIcon(0)
See the JavaDoc
<http://bits.netbeans.org/8.2/javadoc/org-openide-loaders/org/openide/loaders/DataObject.html>

About the fileChooser
Try to implement a FileFilter and set it inside the file chooser
See the JavaDoc
<https://docs.oracle.com/javase/7/docs/api/javax/swing/filechooser/FileFilter.html>


On Mon, Dec 4, 2017 at 6:47 PM, abdielcs <[email protected]> wrote:

> We can register a new File Type for a new file extension or xml namespace,
> so in that way we can define a new mimeType and iconBase for our file. Now
> I need to select that file, and get it's registered icon(for example as a
> property of other file type):
>
>
> Code:
> File file = fileChooser.getSelectedFile();
> DataObject dataObject = DataObject.find(FileUtil.toFileObject(file));
>
>
>
> How I can get the registered icon for this DataObject, asuming that it
> exist?
> There is any way of only select files inside my projects and not in the
> entire file system?
>
> Thanks
>
>
>
>
>

--94eb2c12358619575905600b5d35
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div><div><div>About the icon: <br></div>try dataObje=
ct.getNodeDelegate().getIcon(0)</div><div>See the <a href=3D"http://bits.ne=
tbeans.org/8.2/javadoc/org-openide-loaders/org/openide/loaders/DataObject.h=
tml">JavaDoc</a><br></div><div><br></div>About the fileChooser<br></div>Try=
 to implement a FileFilter and set it inside the file chooser<br></div>See =
the <a href=3D"https://docs.oracle.com/javase/7/docs/api/javax/swing/filech=
ooser/FileFilter.html">JavaDoc</a><br><div><div><br></div></div></div><div =
class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Dec 4, 2017 at=
 6:47 PM, abdielcs <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]=
om" target=3D"_blank">[email protected]</a>&gt;</span> wrote:<br><blockquo=
te class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc so=
lid;padding-left:1ex">We can register a new File Type for a new file extens=
ion or xml namespace, so in that way we can define a new mimeType and iconB=
ase for our file. Now I need to select that file, and get it&#39;s register=
ed icon(for example as a property of other file type):<br>
<br>
<br>
Code:<br>
File file =3D fileChooser.getSelectedFile();<br>
DataObject dataObject =3D DataObject.find(FileUtil.<wbr>toFileObject(file))=
;<br>
<br>
<br>
<br>
How I can get the registered icon for this DataObject, asuming that it exis=
t?<br>
There is any way of only select files inside my projects and not in the ent=
ire file system?<br>
<br>
Thanks<br>
<br>
<br>
<br>
<br>
</blockquote></div><br></div>

--94eb2c12358619575905600b5d35--