Skip to content

Commit 4ac05a5

Browse files
#40 [ Modeler ] List JPG images first when double clicking a component
1 parent a4f3687 commit 4ac05a5

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

plugins/net.roboconf.eclipse.modeler/src/net/roboconf/eclipse/modeler/actions/SelectImageAction.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@
5151
*/
5252
public 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

Comments
 (0)