5151 */
5252public class SelectImageAction implements IExternalJavaAction {
5353
54+ private static final String [] EXTENSIONS = {
55+ "*.jpg;*.jpeg;*.gif;*.svg;*.png" ,
56+ "*.jpg" , "*.jpeg" , "*.gif" , "*.png" , "*.svg"
57+ };
58+
59+ private static final String [] NAMES = {
60+ "All images (" + EXTENSIONS [ 0 ] + ")" ,
61+ "JPG images (" + EXTENSIONS [ 1 ] + ")" ,
62+ "JPEG images (" + EXTENSIONS [ 2 ] + ")" ,
63+ "GIF images (" + EXTENSIONS [ 3 ] + ")" ,
64+ "PNG images (" + EXTENSIONS [ 4 ] + ")" ,
65+ "SVG images (" + EXTENSIONS [ 5 ] + ")" ,
66+ };
67+
68+
5469 @ Override
5570 public boolean canExecute ( Collection <? extends EObject > selections ) {
5671
@@ -69,7 +84,8 @@ public void execute( Collection<? extends EObject> selections, Map<String,Object
6984
7085 // Open a selection dialog
7186 FileDialog dialog = new FileDialog ( new Shell (), SWT .OPEN );
72- dialog .setFilterExtensions ( new String [] { "*.png" , "*jpg" , "*jpeg" , "*svg" , "*png" });
87+ dialog .setFilterExtensions ( EXTENSIONS );
88+ dialog .setFilterNames ( NAMES );
7389 String result = dialog .open ();
7490
7591 // If a file was selected, import it in the project
0 commit comments