Bug 510715 - .project editor broken if test and example are checked out

Replaced org.eclipse.core.runtime.text usage with a sub type to avoid
overlap between tests and editor usage

Change-Id: Id738b525082ed5993b94e78690cb7f3ec42e62b4
Signed-off-by: Lucas Bullen <lbullen@redhat.com>
diff --git a/org.eclipse.ui.genericeditor.tests/plugin.xml b/org.eclipse.ui.genericeditor.tests/plugin.xml
index ea8d49a..bc3a6bb 100644
--- a/org.eclipse.ui.genericeditor.tests/plugin.xml
+++ b/org.eclipse.ui.genericeditor.tests/plugin.xml
@@ -12,99 +12,127 @@
 <!--     Lucas Bullen (Red Hat Inc.) - Bug 508829 custom reconciler support -->
 <!-- ====================================================================== -->
 <plugin>
- <extension
-			 point="org.eclipse.ui.genericeditor.contentAssistProcessors">
+	<extension
+			point="org.eclipse.ui.genericeditor.contentAssistProcessors">
 		<contentAssistProcessor
-					class="org.eclipse.ui.genericeditor.tests.contributions.BarContentAssistProcessor"
-					contentType="org.eclipse.ui.genericeditor.tests.content-type">
+			class="org.eclipse.ui.genericeditor.tests.contributions.BarContentAssistProcessor"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type">
 		</contentAssistProcessor>
-  <contentAssistProcessor
-        class="org.eclipse.ui.genericeditor.tests.contributions.LongRunningBarContentAssistProcessor"
-        contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
-  </contentAssistProcessor>
- </extension>
- <extension
-			 point="org.eclipse.ui.genericeditor.hoverProviders">
+		<contentAssistProcessor
+			class="org.eclipse.ui.genericeditor.tests.contributions.LongRunningBarContentAssistProcessor"
+			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
+		</contentAssistProcessor>
+	</extension>
+	<extension
+			point="org.eclipse.ui.genericeditor.hoverProviders">
 		<hoverProvider
-					class="org.eclipse.ui.genericeditor.tests.contributions.AlrightyHoverProvider"
-					contentType="org.eclipse.ui.genericeditor.tests.content-type">
+			class="org.eclipse.ui.genericeditor.tests.contributions.AlrightyHoverProvider"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type">
 		</hoverProvider>
 		<hoverProvider
-					class="org.eclipse.ui.genericeditor.tests.contributions.HelloHoverProvider"
-					contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type-bartxt">
+			class="org.eclipse.ui.genericeditor.tests.contributions.WorldHoverProvider"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type-bar">
 		</hoverProvider>
- </extension>
-  <extension
-			 point="org.eclipse.ui.genericeditor.reconcilers">
+		<hoverProvider
+			class="org.eclipse.ui.genericeditor.tests.contributions.HelloHoverProvider"
+			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type-bar">
+		</hoverProvider>
+	</extension>
+	<extension
+			point="org.eclipse.ui.genericeditor.reconcilers">
 		<reconciler
-					class="org.eclipse.ui.genericeditor.tests.contributions.TheReconcilerFirst"
-					contentType="org.eclipse.core.runtime.text">
+			class="org.eclipse.ui.genericeditor.tests.contributions.TheReconcilerFirst"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type-bar">
 		</reconciler>
 		<reconciler
 			class="org.eclipse.ui.genericeditor.tests.contributions.TheReconcilerSecond"
-			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type-bartxt">
+			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type-bar">
+		</reconciler>
+		<reconciler
+			class="org.eclipse.ui.genericeditor.tests.contributions.TheReconcilerFirst"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type">
 		</reconciler>
 	</extension>
 	<extension
-			 point="org.eclipse.ui.genericeditor.presentationReconcilers">
+			point="org.eclipse.ui.genericeditor.presentationReconcilers">
 		<presentationReconciler
 			class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerBlue"
-			contentType="org.eclipse.core.runtime.text">
-		</presentationReconciler>
-		<presentationReconciler
-			class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerRed"
-			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
+			contentType="org.eclipse.ui.genericeditor.tests.content-type">
 		</presentationReconciler>
 		<presentationReconciler
 			class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerGreen"
-			contentType="org.eclipse.ui.genericeditor.tests.content-type">
+			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
+		</presentationReconciler>
+		<presentationReconciler
+			class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerRed"
+			contentType="org.eclipse.ui.genericeditor.tests.sub-specialized-content-type">
 		</presentationReconciler>
 	</extension>
- <extension
-       point="org.eclipse.ui.ide.markerResolution">
-    <markerResolutionGenerator
-          class="org.eclipse.ui.genericeditor.tests.contributions.MarkerResolutionGenerator"
-          markerType="org.eclipse.core.resources.problemmarker">
-    </markerResolutionGenerator>
- </extension>
- <extension
-       point="org.eclipse.core.contenttype.contentTypes">
-    <content-type
-          base-type="org.eclipse.core.runtime.text"
-          file-names="foo.txt"
-          id="org.eclipse.ui.genericeditor.tests.content-type"
-          name="Generic Editor Test content-type"
-          priority="normal">
-    </content-type>
-    <content-type
-          base-type="org.eclipse.ui.genericeditor.tests.content-type"
-          file-names="foo.txt"
-          id="org.eclipse.ui.genericeditor.tests.specialized-content-type"
-          name="Specialized Generic Editor content-type"
-          priority="normal">
-    </content-type>
-    <content-type
-          base-type="org.eclipse.ui.genericeditor.tests.content-type"
-          file-names="bar.txt"
-          id="org.eclipse.ui.genericeditor.tests.specialized-content-type-bartxt"
-          name="Specialized Generic Editor content-type for &apos;bar.txt&apos;"
-          priority="normal">
-    </content-type>
- </extension>
- <extension
-       point="org.eclipse.ui.genericeditor.autoEditStrategies">
-    <autoEditStrategy
-          class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategyFirst"
-          contentType="org.eclipse.core.runtime.text">
-    </autoEditStrategy>
-    <autoEditStrategy
-          class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategySecond"
-          contentType="org.eclipse.ui.genericeditor.tests.content-type">
-    </autoEditStrategy>
-    <autoEditStrategy
-          class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategyThird"
-          contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
-    </autoEditStrategy>
- </extension>
-
+	<extension
+			point="org.eclipse.ui.ide.markerResolution">
+		<markerResolutionGenerator
+			class="org.eclipse.ui.genericeditor.tests.contributions.MarkerResolutionGenerator"
+			markerType="org.eclipse.core.resources.problemmarker">
+		</markerResolutionGenerator>
+	</extension>
+	<extension
+			point="org.eclipse.core.contenttype.contentTypes">
+		<content-type
+			base-type="org.eclipse.core.runtime.text"
+			file-names="foo.txt"
+			id="org.eclipse.ui.genericeditor.tests.content-type"
+			name="Generic Editor Test content-type"
+			priority="normal">
+		</content-type>
+		<content-type
+			base-type="org.eclipse.ui.genericeditor.tests.content-type"
+			file-names="foo.txt"
+			id="org.eclipse.ui.genericeditor.tests.specialized-content-type"
+			name="Specialized Generic Editor content-type"
+			priority="normal">
+		</content-type>
+		<content-type
+			base-type="org.eclipse.ui.genericeditor.tests.specialized-content-type"
+			file-names="foo.txt"
+			id="org.eclipse.ui.genericeditor.tests.sub-specialized-content-type"
+			name="Sub-Specialized Generic Editor content-type"
+			priority="normal">
+		</content-type>
+		<content-type
+			base-type="org.eclipse.ui.genericeditor.tests.content-type"
+			file-names="foobar.txt"
+			id="org.eclipse.ui.genericeditor.tests.specialized-content-type-foobartxt"
+			name="Specialized Generic Editor content-type for &apos;foobar.txt&apos;"
+			priority="normal">
+		</content-type>
+		<content-type
+			base-type="org.eclipse.core.runtime.text"
+			file-names="bar.txt"
+			id="org.eclipse.ui.genericeditor.tests.content-type-bar"
+			name="Generic Editor Test content-type for &apos;bar.txt&apos;"
+			priority="normal">
+		</content-type>
+		<content-type
+			base-type="org.eclipse.ui.genericeditor.tests.content-type-bar"
+			file-names="bar.txt"
+			id="org.eclipse.ui.genericeditor.tests.specialized-content-type-bar"
+			name="Specialized Generic Editor content-type for &apos;bar.txt&apos;"
+			priority="normal">
+		</content-type>
+	</extension>
+	<extension
+			point="org.eclipse.ui.genericeditor.autoEditStrategies">
+		<autoEditStrategy
+			class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategyFirst"
+			contentType="org.eclipse.ui.genericeditor.tests.content-type">
+		</autoEditStrategy>
+		<autoEditStrategy
+			class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategySecond"
+			contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
+		</autoEditStrategy>
+		<autoEditStrategy
+			class="org.eclipse.ui.genericeditor.tests.contributions.TheAutoEditStrategyThird"
+			contentType="org.eclipse.ui.genericeditor.tests.sub-specialized-content-type">
+		</autoEditStrategy>
+	</extension>
 </plugin>
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java
index e92016c..978f727 100644
--- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java
@@ -45,7 +45,7 @@
 	@Test
 	public void testContextInfo() throws Exception {
 		cleanFileAndEditor();
-		createAndOpenFile("bar.txt", BarContentAssistProcessor.PROPOSAL);
+		createAndOpenFile("foobar.txt", BarContentAssistProcessor.PROPOSAL);
 
 		final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet());
 		TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION);
@@ -68,7 +68,7 @@
 	@Test
 	public void testContextInfo_hide_Bug512251() throws Exception {
 		cleanFileAndEditor();
-		createAndOpenFile("bar.txt", BarContentAssistProcessor.PROPOSAL);
+		createAndOpenFile("foobar.txt", BarContentAssistProcessor.PROPOSAL);
 
 		final Set<Shell> beforeShells = Arrays.stream(editor.getSite().getShell().getDisplay().getShells()).filter(Shell::isVisible).collect(Collectors.toSet());
 		TextOperationAction action = (TextOperationAction) editor.getAction(ITextEditorActionConstants.CONTENT_ASSIST_CONTEXT_INFORMATION);
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
index e234e34..a7db28a 100644
--- a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java
@@ -50,6 +50,7 @@
 import org.eclipse.ui.genericeditor.tests.contributions.AlrightyHoverProvider;
 import org.eclipse.ui.genericeditor.tests.contributions.HelloHoverProvider;
 import org.eclipse.ui.genericeditor.tests.contributions.MarkerResolutionGenerator;
+import org.eclipse.ui.genericeditor.tests.contributions.WorldHoverProvider;
 
 import org.eclipse.ui.workbench.texteditor.tests.ScreenshotTest;
 
@@ -73,6 +74,7 @@
 		Shell shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
 		assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
 		assertNull(findControl(shell, StyledText.class, HelloHoverProvider.LABEL));
+		assertNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
 	}
 
 	/**
@@ -84,7 +86,8 @@
 		cleanFileAndEditor();
 		createAndOpenFile("bar.txt", "Hi");
 		Shell shell = getHoverShell(triggerCompletionAndRetrieveInformationControlManager());
-		assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
+		assertNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
+		assertNotNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
 		assertNotNull(findControl(shell, StyledText.class, HelloHoverProvider.LABEL));
 	}
 
diff --git a/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/contributions/WorldHoverProvider.java b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/contributions/WorldHoverProvider.java
new file mode 100644
index 0000000..453ee5e
--- /dev/null
+++ b/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/contributions/WorldHoverProvider.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2017 Red Hat Inc. 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Lucas Bullen (Red Hat Inc.)
+ *******************************************************************************/
+package org.eclipse.ui.genericeditor.tests.contributions;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension2;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Region;
+
+public class WorldHoverProvider implements ITextHover,ITextHoverExtension2 {
+
+	public static final String LABEL= "World!";
+
+	@Deprecated
+	@Override
+	public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+		return null;
+	}
+
+	@Override
+	public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+		return new Region(0, textViewer.getTextWidget().getText().length());
+	}
+
+	@Override
+	public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
+		return LABEL;
+	}
+
+}