Bug 544930 - browser id does not get set in WebBrowserEditorInput when a
internal browser is created and does openUrl

Porting the change to R4_8_maintenance branch
Also increased bundle version for org.eclipse.ui.forms and
org.eclipse.ui.tesdts.forms as these plugins were changed as part of
back port of bug 536693 to 4_8_maintenance, but these plugin versions
were not incremented resulting in gerrit build failure.

Change-Id: I1e288abc4ce8653d680f6ab0cc443a7cb98d0757
Signed-off-by: Kalyan Prasad Tatavarthi <kalyan_prasad@in.ibm.com>
diff --git a/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
index bf06854..9e2ad67 100644
--- a/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.browser/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Plugin.name
 Bundle-SymbolicName: org.eclipse.ui.browser; singleton:=true
-Bundle-Version: 3.6.200.qualifier
+Bundle-Version: 3.6.201.qualifier
 Bundle-Activator: org.eclipse.ui.internal.browser.WebBrowserUIPlugin
 Bundle-Vendor: %Plugin.providerName
 Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.ui.browser/pom.xml b/bundles/org.eclipse.ui.browser/pom.xml
index c869a9d..a2d7e9c 100644
--- a/bundles/org.eclipse.ui.browser/pom.xml
+++ b/bundles/org.eclipse.ui.browser/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012, 2017 Eclipse Foundation and others.
+  Copyright (c) 2012, 2019 Eclipse Foundation and others.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.ui</groupId>
   <artifactId>org.eclipse.ui.browser</artifactId>
-  <version>3.6.200-SNAPSHOT</version>
+  <version>3.6.201-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/InternalBrowserEditorInstance.java b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/InternalBrowserEditorInstance.java
index b6da86a..51b4cf3 100644
--- a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/InternalBrowserEditorInstance.java
+++ b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/InternalBrowserEditorInstance.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * Copyright (c) 2005, 2019 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -27,7 +27,7 @@
 
 	@Override
 	public void openURL(URL url) throws PartInitException {
-		WebBrowserEditorInput input = new WebBrowserEditorInput(url, style);
+		WebBrowserEditorInput input = new WebBrowserEditorInput(url, style, getId());
 		input.setName(this.name);
 		input.setToolTipText(this.tooltip);
 		WebBrowserEditor editor = (WebBrowserEditor)part;
diff --git a/bundles/org.eclipse.ui.forms/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.forms/META-INF/MANIFEST.MF
index ee4039c..8fb4360 100644
--- a/bundles/org.eclipse.ui.forms/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.forms/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %name
 Bundle-SymbolicName: org.eclipse.ui.forms;singleton:=true
-Bundle-Version: 3.7.200.qualifier
+Bundle-Version: 3.7.201.qualifier
 Bundle-Vendor: %provider-name
 Bundle-Localization: plugin
 Export-Package: org.eclipse.ui.forms,
diff --git a/bundles/org.eclipse.ui.forms/pom.xml b/bundles/org.eclipse.ui.forms/pom.xml
index 6f2012f..dba35af 100644
--- a/bundles/org.eclipse.ui.forms/pom.xml
+++ b/bundles/org.eclipse.ui.forms/pom.xml
@@ -19,6 +19,6 @@
   </parent>
   <groupId>org.eclipse.ui</groupId>
   <artifactId>org.eclipse.ui.forms</artifactId>
-  <version>3.7.200-SNAPSHOT</version>
+  <version>3.7.201-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/tests/org.eclipse.ui.tests.browser/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.tests.browser/META-INF/MANIFEST.MF
index 1e7125a..e11bb2e 100644
--- a/tests/org.eclipse.ui.tests.browser/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.tests.browser/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %Plugin.name
 Bundle-SymbolicName: org.eclipse.ui.tests.browser;singleton:=true
-Bundle-Version: 3.2.0
+Bundle-Version: 3.2.1
 Bundle-Activator: org.eclipse.ui.tests.browser.internal.WebBrowserTestsPlugin
 Bundle-Vendor: %Plugin.providerName
 Bundle-Localization: plugin
diff --git a/tests/org.eclipse.ui.tests.browser/pom.xml b/tests/org.eclipse.ui.tests.browser/pom.xml
index 31df556..28c289e 100644
--- a/tests/org.eclipse.ui.tests.browser/pom.xml
+++ b/tests/org.eclipse.ui.tests.browser/pom.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-  Copyright (c) 2012, 2015 Eclipse Foundation.
+  Copyright (c) 2012, 2019 Eclipse Foundation.
   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Distribution License v1.0
   which accompanies this distribution, and is available at
@@ -19,7 +19,7 @@
   </parent>
   <groupId>org.eclipse.ui</groupId>
   <artifactId>org.eclipse.ui.tests.browser</artifactId>
-  <version>3.2.0</version>
+  <version>3.2.1</version>
   <packaging>eclipse-test-plugin</packaging>
 
 </project>
diff --git a/tests/org.eclipse.ui.tests.browser/src/org/eclipse/ui/tests/browser/internal/InternalBrowserEditorTestCase.java b/tests/org.eclipse.ui.tests.browser/src/org/eclipse/ui/tests/browser/internal/InternalBrowserEditorTestCase.java
index f354306..fb40fbe 100644
--- a/tests/org.eclipse.ui.tests.browser/src/org/eclipse/ui/tests/browser/internal/InternalBrowserEditorTestCase.java
+++ b/tests/org.eclipse.ui.tests.browser/src/org/eclipse/ui/tests/browser/internal/InternalBrowserEditorTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2004, 2017 IBM Corporation and others.
+ * Copyright (c) 2004, 2019 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -10,12 +10,19 @@
  *******************************************************************************/
 package org.eclipse.ui.tests.browser.internal;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
 import java.net.URL;
 
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.browser.IWebBrowser;
 import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.internal.browser.WebBrowserEditorInput;
 import org.eclipse.ui.internal.browser.WebBrowserPreference;
 import org.junit.Test;
 
@@ -39,6 +46,29 @@
 		runLoopTimer(2);
 	}
 
+	@Test
+	public void testBrowserID() throws Exception {
+		shell = WebBrowserTestsPlugin.getInstance().getWorkbench().getActiveWorkbenchWindow().getShell();
+		WebBrowserPreference.setBrowserChoice(WebBrowserPreference.INTERNAL);
+		IWorkbenchBrowserSupport wbs = WebBrowserTestsPlugin.getInstance().getWorkbench().getBrowserSupport();
+		IWebBrowser wb = wbs.createBrowser(IWorkbenchBrowserSupport.AS_EDITOR, "test", "MyBrowser", "A tooltip");
+
+		wb.openURL(new URL("http://www.ibm.com"));
+		runLoopTimer(2);
+
+		IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+				.getEditorReferences();
+		IEditorReference editor = editorRefs[0];
+		IEditorPart editorPart = editor.getEditor(true);
+
+		WebBrowserEditorInput editorInput = (WebBrowserEditorInput) editor.getEditorInput();
+		assertNotNull(editorInput.getBrowserId());
+		assertEquals(wb.getId(), editorInput.getBrowserId());
+
+		wb.close();
+		runLoopTimer(2);
+	}
+
 	void runLoopTimer(final int seconds) {
 		final boolean[] exit = {false};
 		new Thread() {
diff --git a/tests/org.eclipse.ui.tests.forms/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.tests.forms/META-INF/MANIFEST.MF
index f46a52b..e981ced 100755
--- a/tests/org.eclipse.ui.tests.forms/META-INF/MANIFEST.MF
+++ b/tests/org.eclipse.ui.tests.forms/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: Forms Test
 Bundle-SymbolicName: org.eclipse.ui.tests.forms;singleton:=true
-Bundle-Version: 3.7.200.qualifier
+Bundle-Version: 3.7.201.qualifier
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.test.performance,
diff --git a/tests/org.eclipse.ui.tests.forms/pom.xml b/tests/org.eclipse.ui.tests.forms/pom.xml
index dee6da5..6cc221d 100644
--- a/tests/org.eclipse.ui.tests.forms/pom.xml
+++ b/tests/org.eclipse.ui.tests.forms/pom.xml
@@ -20,6 +20,6 @@
   </parent>
   <groupId>org.eclipse.ui</groupId>
   <artifactId>org.eclipse.ui.tests.forms</artifactId>
-  <version>3.7.200-SNAPSHOT</version>
+  <version>3.7.201-SNAPSHOT</version>
   <packaging>eclipse-test-plugin</packaging>
 </project>