Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Bullen2017-08-28 09:17:35 -0400
committerLucas Bullen2017-10-11 15:01:59 -0400
commit43cdbb7d723b29c84d152bdb5d2d350d5fe39e40 (patch)
tree615cbbad64970cbdf387b03612827d5105051c8b /org.eclipse.ui.genericeditor.tests
parentf6cbef0fbeb58de396c726cd343fa177ca109099 (diff)
downloadeclipse.platform.text-43cdbb7d723b29c84d152bdb5d2d350d5fe39e40.tar.gz
eclipse.platform.text-43cdbb7d723b29c84d152bdb5d2d350d5fe39e40.tar.xz
eclipse.platform.text-43cdbb7d723b29c84d152bdb5d2d350d5fe39e40.zip
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>
Diffstat (limited to 'org.eclipse.ui.genericeditor.tests')
-rw-r--r--org.eclipse.ui.genericeditor.tests/plugin.xml174
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/ContextInfoTest.java4
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java5
-rw-r--r--org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/contributions/WorldHoverProvider.java39
4 files changed, 146 insertions, 76 deletions
diff --git a/org.eclipse.ui.genericeditor.tests/plugin.xml b/org.eclipse.ui.genericeditor.tests/plugin.xml
index ea8d49a05..bc3a6bb17 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">
+ </contentAssistProcessor>
<contentAssistProcessor
- class="org.eclipse.ui.genericeditor.tests.contributions.BarContentAssistProcessor"
- contentType="org.eclipse.ui.genericeditor.tests.content-type">
+ class="org.eclipse.ui.genericeditor.tests.contributions.LongRunningBarContentAssistProcessor"
+ contentType="org.eclipse.ui.genericeditor.tests.specialized-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">
+ </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">
+ contentType="org.eclipse.ui.genericeditor.tests.content-type">
</presentationReconciler>
<presentationReconciler
- class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerRed"
+ class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerGreen"
contentType="org.eclipse.ui.genericeditor.tests.specialized-content-type">
</presentationReconciler>
<presentationReconciler
- class="org.eclipse.ui.genericeditor.tests.contributions.ThePresentationReconcilerGreen"
- contentType="org.eclipse.ui.genericeditor.tests.content-type">
+ 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 e92016c05..978f72741 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 @@ public class ContextInfoTest extends AbstratGenericEditorTest {
@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 @@ public class ContextInfoTest extends AbstratGenericEditorTest {
@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 e234e340a..a7db28a77 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.jface.text.tests.util.DisplayHelper;
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 @@ public class HoverTest extends AbstratGenericEditorTest {
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 @@ public class HoverTest extends AbstratGenericEditorTest {
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 000000000..453ee5ec7
--- /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;
+ }
+
+}

Back to the top