Blind fix for "Bug 1888 - Using built-in "WRT IDE" launch configuration, WRT Navigator View resets after initial launch when "Refresh Preview" is clicked"
authorEugene Ostroukhov <eugeneo@symbian.org>
Fri, 12 Feb 2010 13:45:18 -0800
changeset 142 337ef2222abe
parent 141 f711e4ac391d
child 143 5151e2949fa9
Blind fix for "Bug 1888 - Using built-in "WRT IDE" launch configuration, WRT Navigator View resets after initial launch when "Refresh Preview" is clicked"
org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java
--- a/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java	Fri Feb 12 13:04:26 2010 -0800
+++ b/org.symbian.tools.wrttools.previewer/src/org/symbian/tools/wrttools/previewer/preview/AbstractPreviewPage.java	Fri Feb 12 13:45:18 2010 -0800
@@ -24,7 +24,7 @@
 public abstract class AbstractPreviewPage extends Page implements IPreviewPage, ISelectionProvider {
 	private final IAction refreshAction = new Action("Refresh") {
 		public void run() {
-			refresh();
+			refresh(true);
 		};
 	};
 	private final IAction toggleRefresh = new Action("Toggle Refresh", IAction.AS_RADIO_BUTTON) {
@@ -50,7 +50,7 @@
 		previewView.setProjectAutorefresh(project, toggleState);
 		toggleRefresh.setToolTipText(getToggleActionTooltip());
 		if (toggleState && needsRefresh) {
-			refresh();
+			refresh(true);
 		}
 	}
 
@@ -112,13 +112,13 @@
 		return false;
 	}
 
-	protected synchronized void refresh() {
+	protected synchronized void refresh(boolean manual) {
 		try {
 			final Control focusControl = browser.getDisplay().getFocusControl();
 			browser.refresh();
 			refreshAction.setImageDescriptor(PreviewerPlugin
 					.getImageDescriptor(Images.GREEN_SYNC));
-			if (focusControl != null) {
+			if (!manual && focusControl != null) {
 				asyncExec(new Runnable() {
 					public void run() {
 						focusControl.setFocus();
@@ -181,7 +181,7 @@
 			promptIfNeeded();
 		}
 		if (toggleState) {
-			refresh();
+			refresh(false);
 		} else {
 			needsRefresh = true;
 			refreshAction.setImageDescriptor(PreviewerPlugin.getImageDescriptor(Images.RED_SYNC));