[openrtm-commit:00895] r356 - trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog

openrtm @ openrtm.org openrtm @ openrtm.org
2012年 9月 30日 (日) 13:21:01 JST


Author: 
Date: 2012-09-30 13:21:01 +0900 (Sun, 30 Sep 2012)
New Revision: 356

Modified:
   trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/IconPreferenceDialog.java
Log:
Update Icon Type

Modified: trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/IconPreferenceDialog.java
===================================================================
--- trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/IconPreferenceDialog.java	2012-09-29 17:32:22 UTC (rev 355)
+++ trunk/rtmtools/jp.go.aist.rtm.systemeditor/src/jp/go/aist/rtm/systemeditor/ui/dialog/IconPreferenceDialog.java	2012-09-30 04:21:01 UTC (rev 356)
@@ -40,7 +40,7 @@
 
 	static final String BUTTON_LABEL_BROWSE = getString("Common.button.browse");
 
-	static final String ICON_EXTENSION = "*.ico; *.bmp; *.png; *.gif";
+	static final String ICON_EXTENSION = "*.ico;*.bmp;*.png;*.gif;*.jpg";
 	static final String FILTER_EXTENSIONS[] = new String[] { ICON_EXTENSION };
 	static final String FILTER_NAMES[] = new String[] { getString("IconPreferenceDialog.filter.name")
 			+ " (" + ICON_EXTENSION + ")" };
@@ -137,27 +137,7 @@
 
 			@Override
 			public void focusLost(FocusEvent e) {
-				imageLabel.setBackgroundImage(null);
-				if (pathText.getText() == null) {
-					path = "";
-					desc = null;
-					notifyModified();
-					return;
-				}
-				try {
-					path = pathText.getText();
-					File file = new File(path);
-					path = file.getAbsolutePath();
-					URL url = file.toURI().toURL();
-					desc = ImageDescriptor.createFromURL(url);
-					if (desc != null) {
-						imageLabel.setImage(desc.createImage());
-					}
-				} catch (Exception exp) {
-					path = "";
-					desc = null;
-				}
-				notifyModified();
+				updateImage();
 			}
 		});
 
@@ -179,6 +159,7 @@
 				if (s != null) {
 					pathText.setFocus();
 					pathText.setText(s);
+					updateImage();
 					browseButton.setFocus();
 				}
 			}
@@ -198,6 +179,30 @@
 		return mainComposite;
 	}
 
+	private void updateImage() {
+		imageLabel.setBackgroundImage(null);
+		if (pathText.getText() == null) {
+			path = "";
+			desc = null;
+			notifyModified();
+			return;
+		}
+		try {
+			path = pathText.getText();
+			File file = new File(path);
+			path = file.getAbsolutePath();
+			URL url = file.toURI().toURL();
+			desc = ImageDescriptor.createFromURL(url);
+			if (desc != null) {
+				imageLabel.setImage(desc.createImage());
+			}
+		} catch (Exception exp) {
+			path = "";
+			desc = null;
+		}
+		notifyModified();
+	}
+	
 	@Override
 	protected Control createButtonBar(Composite parent) {
 		Control composite = super.createButtonBar(parent);



More information about the openrtm-commit mailing list