Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 201558 Details for
Bug 352433
[backport] CompareUIPlugin.findContentViewerDescriptor returns null even if a viewer is registered via extension point="org.eclipse.compare.contentMergeViewers"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix v02
clipboard.txt (text/plain), 7.50 KB, created by
Tomasz Zarna
on 2011-08-16 06:57:58 EDT
(
hide
)
Description:
Fix v02
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2011-08-16 06:57:58 EDT
Size:
7.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/META-INF/MANIFEST.MF,v >retrieving revision 1.27 >diff -u -r1.27 MANIFEST.MF >--- META-INF/MANIFEST.MF 11 Aug 2010 07:27:05 -0000 1.27 >+++ META-INF/MANIFEST.MF 16 Aug 2011 10:57:11 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: org.eclipse.compare; singleton:=true >-Bundle-Version: 3.5.200.qualifier >+Bundle-Version: 3.5.201.qualifier > Bundle-Activator: org.eclipse.compare.internal.CompareUIPlugin > Bundle-Vendor: %providerName > Bundle-Localization: plugin >Index: compare/org/eclipse/compare/internal/CompareUIPlugin.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareUIPlugin.java,v >retrieving revision 1.82 >diff -u -r1.82 CompareUIPlugin.java >--- compare/org/eclipse/compare/internal/CompareUIPlugin.java 5 May 2011 10:05:39 -0000 1.82 >+++ compare/org/eclipse/compare/internal/CompareUIPlugin.java 16 Aug 2011 10:57:11 -0000 >@@ -942,7 +942,7 @@ > > return (ViewerDescriptor[]) result.toArray(new ViewerDescriptor[0]); > } >- return null; >+ return result.size() > 0 ? (ViewerDescriptor[])result.toArray(new ViewerDescriptor[0]) : null; > } > > /** >#P org.eclipse.compare.tests >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare.tests/META-INF/MANIFEST.MF,v >retrieving revision 1.5 >diff -u -r1.5 MANIFEST.MF >--- META-INF/MANIFEST.MF 10 Jul 2009 13:25:29 -0000 1.5 >+++ META-INF/MANIFEST.MF 16 Aug 2011 10:57:12 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: org.eclipse.compare.tests;singleton:=true >-Bundle-Version: 3.5.100.qualifier >+Bundle-Version: 3.5.201.qualifier > Bundle-ClassPath: comparetests.jar > Require-Bundle: org.junit, > org.eclipse.compare, >Index: src/org/eclipse/compare/tests/AllTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare.tests/src/org/eclipse/compare/tests/AllTests.java,v >retrieving revision 1.19 >diff -u -r1.19 AllTests.java >--- src/org/eclipse/compare/tests/AllTests.java 20 Apr 2010 16:52:41 -0000 1.19 >+++ src/org/eclipse/compare/tests/AllTests.java 16 Aug 2011 10:57:12 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 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 >@@ -35,6 +35,7 @@ > suite.addTestSuite(PatchLinesTest.class); > suite.addTestSuite(PatchUITest.class); > suite.addTestSuite(RangeDifferencerThreeWayDiffTest.class); >+ suite.addTestSuite(CompareUIPluginTest.class); > // $JUnit-END$ > return suite; > } >Index: src/org/eclipse/compare/tests/CompareUIPluginTest.java >=================================================================== >RCS file: src/org/eclipse/compare/tests/CompareUIPluginTest.java >diff -N src/org/eclipse/compare/tests/CompareUIPluginTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/compare/tests/CompareUIPluginTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,113 @@ >+/******************************************************************************* >+ * Copyright (c) 2011 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.compare.tests; >+ >+import java.io.ByteArrayInputStream; >+import java.io.InputStream; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.compare.CompareConfiguration; >+import org.eclipse.compare.IStreamContentAccessor; >+import org.eclipse.compare.ITypedElement; >+import org.eclipse.compare.internal.CompareUIPlugin; >+import org.eclipse.compare.internal.ViewerDescriptor; >+import org.eclipse.compare.structuremergeviewer.DiffNode; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.swt.graphics.Image; >+ >+public class CompareUIPluginTest extends TestCase { >+ >+ private static class UnknownTypedElement implements ITypedElement { >+ public Image getImage() { >+ return null; >+ } >+ >+ public String getName() { >+ return "test"; >+ } >+ >+ public String getType() { >+ return UNKNOWN_TYPE; >+ } >+ } >+ >+ private static class TextTypedElement implements ITypedElement { >+ public Image getImage() { >+ return null; >+ } >+ >+ public String getName() { >+ return "test"; >+ } >+ >+ public String getType() { >+ return TEXT_TYPE; >+ } >+ } >+ >+ private static class TextTypedElementStreamAccessor implements ITypedElement, IStreamContentAccessor { >+ public Image getImage() { >+ return null; >+ } >+ >+ public String getName() { >+ return "test"; >+ } >+ >+ public String getType() { >+ return TEXT_TYPE; >+ } >+ >+ public InputStream getContents() throws CoreException { >+ /* >+ * Whatever we return has no importance as long as it is not "null", this is only to make >+ * CompareUIPlugin#guessType happy. However, it is only happy if what we return resembles a text. >+ */ >+ return new ByteArrayInputStream(new byte[] {' '}); >+ } >+ } >+ >+ public void testFindContentViewerDescriptor_UnknownType() { >+ CompareConfiguration cc = new CompareConfiguration(); >+ DiffNode in = new DiffNode(new UnknownTypedElement(), new UnknownTypedElement()); >+ ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc); >+ >+ // API Compatibility : "no descriptor found" should return a null array instead of a 0-lengthed one. >+ assertNull(result); >+ } >+ >+ public void testFindContentViewerDescriptor_TextType_NotStreamAccessor() { >+ CompareConfiguration cc = new CompareConfiguration(); >+ DiffNode in = new DiffNode(new TextTypedElement(), new TextTypedElement()); >+ ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc); >+ >+ /* >+ * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached. However, this content >+ * viewer is currently NOT returned because of bug 293926 >+ */ >+ assertNotNull(result); >+ assertEquals(1, result.length); >+ } >+ >+ public void testFindContentViewerDescriptorForTextType_StreamAccessor() { >+ CompareConfiguration cc = new CompareConfiguration(); >+ DiffNode in = new DiffNode(new TextTypedElementStreamAccessor(), new TextTypedElementStreamAccessor()); >+ ViewerDescriptor[] result = CompareUIPlugin.getDefault().findContentViewerDescriptor(null, in, cc); >+ >+ /* >+ * "TextTypedElement" is "text" typed : it thus has a Content Viewer attached. However, the content >+ * viewer will only be returned because we made our "ITypedElement" be an IStreamContentAccessor. >+ */ >+ assertNotNull(result); >+ assertEquals(1, result.length); >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 352433
:
201556
|
201557
| 201558