[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef3d-commits] r570 - trunk/org.eclipse.gef3d.ext/src/java/org/eclipse/gef3d/ext/multieditor

Author: jvonpilgrim
Date: 2011-04-20 05:18:55 -0400 (Wed, 20 Apr 2011)
New Revision: 570

Modified:
   trunk/org.eclipse.gef3d.ext/src/java/org/eclipse/gef3d/ext/multieditor/AbstractMultiEditor3D.java
Log:
minor: iterate over entrySet instead of keySet/get(key)

Modified: trunk/org.eclipse.gef3d.ext/src/java/org/eclipse/gef3d/ext/multieditor/AbstractMultiEditor3D.java
===================================================================
--- trunk/org.eclipse.gef3d.ext/src/java/org/eclipse/gef3d/ext/multieditor/AbstractMultiEditor3D.java	2011-04-19 16:52:37 UTC (rev 569)
+++ trunk/org.eclipse.gef3d.ext/src/java/org/eclipse/gef3d/ext/multieditor/AbstractMultiEditor3D.java	2011-04-20 09:18:55 UTC (rev 570)
@@ -14,6 +14,7 @@
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
@@ -80,13 +81,13 @@
 	/**
 	 * Logger for this class
 	 */
-	private static final Logger log =
-		Logger.getLogger(AbstractMultiEditor3D.class.getName());
+	private static final Logger log = Logger
+		.getLogger(AbstractMultiEditor3D.class.getName());
 
 	protected MultiEditorModelContainer m_container;
 
 	protected MultiEditorPartFactory m_multiFactory;
-	
+
 	protected NestedEditorInfoList nestedEditors;
 
 	protected Set<IMultiEditorListener> multiEditorListeners;
@@ -129,12 +130,12 @@
 	public boolean addEditor(IEditorInput i_editorInput) {
 		if (i_editorInput == null)
 			return false;
-		
+
 		NestedEditorInfo info = new NestedEditorInfo(i_editorInput, this);
 		if (!nestedEditors.add(info)) { // input already added
 			return false;
 		}
-		
+
 		try {
 
 			// find appropriate editor
@@ -167,7 +168,7 @@
 					nestedEditor.initializeAsNested(getGraphicalViewer(),
 						m_multiFactory, m_container);
 				info.setContents(editorContent);
-				
+
 				addNestedPalette(nestedEditor.createPaletteDrawer());
 				fireMultiEditorChangeEvent(new MultiEditorChangeEvent(this,
 					nestedEditor, editorContent, Type.added));
@@ -180,7 +181,7 @@
 			return true;
 
 		} finally {
-			if (info.getState()!=State.active)
+			if (info.getState() != State.active)
 				nestedEditors.remove(info);
 		}
 	}
@@ -247,12 +248,18 @@
 		Map<String, Class> editorClasses =
 			findNestableEditorClasses(i_editorInput);
 		Class clazz = null;
-		for (String id : editorClasses.keySet()) {
+		String id = null;
+
+		for (Entry<String, Class> editorClass : editorClasses.entrySet()) {
+			id = editorClass.getKey();
+			clazz = editorClass.getValue();
+
 			try {
-				clazz = editorClasses.get(id);
 				INestableEditor editor = (INestableEditor) clazz.newInstance();
-				NestedEditorInfo info = nestedEditors.getByEditorInput(i_editorInput);
-				if (info!=null) info.setEditorID(id);
+				NestedEditorInfo info =
+					nestedEditors.getByEditorInput(i_editorInput);
+				if (info != null)
+					info.setEditorID(id);
 				return editor;
 			} catch (InstantiationException ex) {
 				log.warning("Cannot create nested editor " //$NON-NLS-1$
@@ -462,7 +469,7 @@
 	 */
 	@Override
 	public boolean isDirty() {
-		for (INestedEditorInfo info: nestedEditors) {
+		for (INestedEditorInfo info : nestedEditors) {
 			if (info.getNestableEditor().isDirty())
 				return true;
 		}
@@ -479,7 +486,7 @@
 			return null;
 
 		INestedEditorInfo info = nestedEditors.getByContents(part.getModel());
-		if (info!=null)
+		if (info != null)
 			return info.getNestableEditor();
 
 		INestableEditor editor = findEditorByEditPart(part.getParent());