Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Ratz2018-09-21 09:11:47 -0400
committerSebastian Ratz2018-09-21 09:59:52 -0400
commitbb4abd131785dc66b2a4da321ded042fd4e37db1 (patch)
tree1681b70abcbf2c3babfa4f42bc39611e2df80817
parenteef6a58d93958ef187fbaa9bc56cce3ced1a5b80 (diff)
downloadeclipse.platform.text-bb4abd131785dc66b2a4da321ded042fd4e37db1.tar.gz
eclipse.platform.text-bb4abd131785dc66b2a4da321ded042fd4e37db1.tar.xz
eclipse.platform.text-bb4abd131785dc66b2a4da321ded042fd4e37db1.zip
Bug 535964 - Move some non UI classes from jface.text to o.e.text.I20180922-1800I20180922-0245I20180922-0005I20180921-1800
Fix TemplatePersistenceData#equals implementation. Change-Id: Ie742ce68e685642d81f83bc9eb53a6b72e2a5516 Signed-off-by: Sebastian Ratz <sebastian.ratz@sap.com>
-rw-r--r--org.eclipse.jface.text.tests/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.jface.text.tests/pom.xml2
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java5
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/templates/persistence/TemplatePersistenceDataTest.java46
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java5
5 files changed, 57 insertions, 4 deletions
diff --git a/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF b/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
index d1e235976..c3f62e245 100644
--- a/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jface.text.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.jface.text.tests
-Bundle-Version: 3.11.300.qualifier
+Bundle-Version: 3.11.400.qualifier
Bundle-Vendor: %Plugin.providerName
Bundle-Localization: plugin
Export-Package:
@@ -10,6 +10,7 @@ Export-Package:
org.eclipse.jface.text.tests.reconciler,
org.eclipse.jface.text.tests.rules,
org.eclipse.jface.text.tests.source,
+ org.eclipse.jface.text.tests.templates.persistence,
org.eclipse.jface.text.tests.util
Require-Bundle:
org.eclipse.jface.text;bundle-version="[3.5.0,4.0.0)",
diff --git a/org.eclipse.jface.text.tests/pom.xml b/org.eclipse.jface.text.tests/pom.xml
index e55afb856..2b922cce9 100644
--- a/org.eclipse.jface.text.tests/pom.xml
+++ b/org.eclipse.jface.text.tests/pom.xml
@@ -19,7 +19,7 @@
</parent>
<groupId>org.eclipse.jface</groupId>
<artifactId>org.eclipse.jface.text.tests</artifactId>
- <version>3.11.300-SNAPSHOT</version>
+ <version>3.11.400-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<testSuite>${project.artifactId}</testSuite>
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
index 346da8ce1..d1b8f5c1c 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/JFaceTextTestSuite.java
@@ -24,6 +24,7 @@ import org.eclipse.jface.text.tests.rules.FastPartitionerTest;
import org.eclipse.jface.text.tests.rules.ScannerColumnTest;
import org.eclipse.jface.text.tests.rules.WordRuleTest;
import org.eclipse.jface.text.tests.source.LineNumberRulerColumnTest;
+import org.eclipse.jface.text.tests.templates.persistence.TemplatePersistenceDataTest;
/**
@@ -49,7 +50,9 @@ import org.eclipse.jface.text.tests.source.LineNumberRulerColumnTest;
DefaultPartitionerZeroLengthTest.class,
FastPartitionerTest.class,
ScannerColumnTest.class,
- WordRuleTest.class
+ WordRuleTest.class,
+
+ TemplatePersistenceDataTest.class,
})
public class JFaceTextTestSuite {
// see @SuiteClasses
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/templates/persistence/TemplatePersistenceDataTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/templates/persistence/TemplatePersistenceDataTest.java
new file mode 100644
index 000000000..07719d8c1
--- /dev/null
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/templates/persistence/TemplatePersistenceDataTest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2018 SAP SE and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * SAP SE - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jface.text.tests.templates.persistence;
+
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import org.eclipse.jface.text.templates.Template;
+import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData;
+
+@SuppressWarnings("deprecation")
+public class TemplatePersistenceDataTest {
+
+ @Test
+ public void testEquals() throws Exception {
+ Template template= new Template();
+ org.eclipse.text.templates.TemplatePersistenceData persistenceData1= new org.eclipse.text.templates.TemplatePersistenceData(template, false);
+ org.eclipse.text.templates.TemplatePersistenceData persistenceData2= new org.eclipse.text.templates.TemplatePersistenceData(template, false);
+
+ TemplatePersistenceData deprPersistenceDataWithRef1A= new TemplatePersistenceData(persistenceData1);
+ TemplatePersistenceData deprPersistenceDataWithRef1B= new TemplatePersistenceData(persistenceData1);
+
+ TemplatePersistenceData deprPersistenceDataWithRef2= new TemplatePersistenceData(persistenceData2);
+
+ TemplatePersistenceData deprPersistenceData3= new TemplatePersistenceData(template, false);
+
+ assertTrue(deprPersistenceDataWithRef1A.equals(deprPersistenceDataWithRef1B));
+ assertFalse(deprPersistenceDataWithRef1A.equals(deprPersistenceDataWithRef2));
+ assertFalse(deprPersistenceDataWithRef1A.equals(deprPersistenceData3));
+ assertTrue(deprPersistenceData3.equals(deprPersistenceData3));
+ }
+}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java
index 2eacc29b7..a87ad110f 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/templates/persistence/TemplatePersistenceData.java
@@ -129,7 +129,10 @@ public class TemplatePersistenceData extends org.eclipse.text.templates.Template
@Override
public boolean equals(Object other) {
- return (ref != null) ? ref.equals(other) : super.equals(other);
+ if (ref != null && other instanceof TemplatePersistenceData && ((TemplatePersistenceData) other).ref != null) {
+ return ref.equals(((TemplatePersistenceData) other).ref);
+ }
+ return super.equals(other);
}
@Override

Back to the top