[jbosstools-commits] JBoss Tools SVN: r41903 - trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Jun 12 18:58:12 EDT 2012


Author: dgolovin
Date: 2012-06-12 18:58:12 -0400 (Tue, 12 Jun 2012)
New Revision: 41903

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java
Log:
reduced complexity of the code

Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java	2012-06-12 22:38:50 UTC (rev 41902)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/callbacks/ViewSourceCallback.java	2012-06-12 22:58:12 UTC (rev 41903)
@@ -105,35 +105,28 @@
 						if (editor instanceof JSPMultiPageEditor) {
 							JSPMultiPageEditor multiPageEditor = (JSPMultiPageEditor) editor;
 							doc = multiPageEditor.getSourceEditor().getTextViewer().getDocument();
+							doc.set(content);
+							editor.doSave(null); // reset resource-changed marker
 						}
 					} catch (NoClassDefFoundError e1) {
 						// this is OK - there are some optional dependencies
+						ITextEditor textEditor = null;
+						if (editor instanceof ITextEditor) {
+							textEditor = (ITextEditor) editor;
+						} else {
+							textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
+						}
+						
+						if (textEditor != null) {
+							doc = textEditor.getDocumentProvider().getDocument(input);
+						}
 					}
 				}
-
-				if (doc == null) {
-					ITextEditor textEditor = null;
-					if (editor instanceof ITextEditor) {
-						textEditor = (ITextEditor) editor;
-					} else {
-						textEditor = (ITextEditor) editor.getAdapter(ITextEditor.class);
-					}
-					
-					if (textEditor != null) {
-						doc = textEditor.getDocumentProvider().getDocument(input);
-					}
-				}
-				
-				if (doc != null) {
-					doc.set(content);
-					editor.doSave(null); // reset resource-changed marker
-				}
 			} catch (PartInitException e) {
 				Activator.logError(e.getMessage(), e);
 			}
 		} else {
-			Exception e = new Exception("Cannot obtain workbench page");
-			Activator.logError(e.getMessage(), e);
+			Activator.logError("Cannot obtain workbench page", null);
 		}
 	}
 }



More information about the jbosstools-commits mailing list