[Schmitzm-commits] r712 - trunk/src/skrueger/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Feb 19 02:11:57 CET 2010


Author: alfonx
Date: 2010-02-19 02:11:55 +0100 (Fri, 19 Feb 2010)
New Revision: 712

Modified:
   trunk/src/skrueger/swing/TranslationJTextField.java
Log:
catching a possible Exception earlier

Modified: trunk/src/skrueger/swing/TranslationJTextField.java
===================================================================
--- trunk/src/skrueger/swing/TranslationJTextField.java	2010-02-19 01:09:35 UTC (rev 711)
+++ trunk/src/skrueger/swing/TranslationJTextField.java	2010-02-19 01:11:55 UTC (rev 712)
@@ -122,20 +122,51 @@
 			public void actionPerformed(ActionEvent e) {
 				// LOGGER.debug("ActionListener called ");
 
-//				if (e.getSource() == trans)
-//				// && langCode.equals(e.getActionCommand()))
-//				{
-//					// LOGGER.debug(" and omittet!\n");
-//					return;
-//				}
-//				LOGGER.debug(" and performed!\n");
+				// if (e.getSource() == trans)
+				// // && langCode.equals(e.getActionCommand()))
+				// {
+				// // LOGGER.debug(" and omittet!\n");
+				// return;
+				// }
+				// LOGGER.debug(" and performed!\n");
 				String newString = trans.get(langCode);
 				if (newString == null)
 					newString = "";
 				if ((newString != null && !newString.equals(getText()))) {
-//					LOGGER.debug("Setting text to " + newString
-//							+ " becuse oldString was " + getText());
-					setText(newString);
+					// LOGGER.debug("Setting text to " + newString
+					// + " becuse oldString was " + getText());
+
+					try {
+						setText(newString);
+					} catch (java.lang.IllegalStateException ee) {
+						/*
+						 * 
+						 * ERROR AtlasCreator uncaughtException An uncaught
+						 * exception happened on Thread
+						 * Thread[AWT-EventQueue-0,6,main]
+						 * java.lang.IllegalStateException: Attempt to mutate in
+						 * notification at
+						 * javax.swing.text.AbstractDocument.writeLock
+						 * (AbstractDocument.java:1323) at
+						 * javax.swing.text.AbstractDocument
+						 * .replace(AbstractDocument.java:644) at
+						 * javax.swing.text
+						 * .JTextComponent.setText(JTextComponent.java:1693) at
+						 * skrueger
+						 * .swing.TranslationJTextField$2.actionPerformed
+						 * (TranslationJTextField.java:138) at
+						 * skrueger.i8n.Translation
+						 * .fireTranslationChangedEvents(Translation.java:358)
+						 * at skrueger.i8n.Translation.put(Translation.java:365)
+						 * atskrueger.swing.TranslationJTextField.checkValid(
+						 * TranslationJTextField.java:184) at
+						 * skrueger.swing.TranslationJTextField$1
+						 * .removeUpdate(TranslationJTextField.java:104) at
+						 * javax.swing.text.AbstractDocument.fireRemoveUpdate(
+						 * AbstractDocument.java:243) _
+						 */
+						LOGGER.warn(ee);
+					}
 				}
 			}
 
@@ -183,21 +214,23 @@
 		if (!trimmedText.equals(trans.get(langCode)))
 			trans.put(langCode, trimmedText);
 	}
-//
-//	ActionListener listenToChangesOfTheTranslationAndUpdateTheGUI = new ActionListener() {
-//
-//		@Override
-//		public void actionPerformed(ActionEvent e) {
-//			if (!hasFocus())
-//				translationChangedExternally();
-//		}
-//	};
-//
-//	/**
-//	 * Call it when the translation object has changed to update the JTextFields
-//	 */
-//	public void translationChangedExternally() {
-//		setText(trans.get(langCode));
-//	}
+	//
+	// ActionListener listenToChangesOfTheTranslationAndUpdateTheGUI = new
+	// ActionListener() {
+	//
+	// @Override
+	// public void actionPerformed(ActionEvent e) {
+	// if (!hasFocus())
+	// translationChangedExternally();
+	// }
+	// };
+	//
+	// /**
+	// * Call it when the translation object has changed to update the
+	// JTextFields
+	// */
+	// public void translationChangedExternally() {
+	// setText(trans.get(langCode));
+	// }
 
 }



More information about the Schmitzm-commits mailing list