Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2009-06-04 05:37:03 -0400
committerAnton Leherbauer2009-06-04 05:37:03 -0400
commit6feac180b1315df0fbd039b68224c3475112fe8f (patch)
tree431e2312f8968e03e7462af5c8ed4b1a3cf1c7bd
parent59bdb4bf122d93ecd0f4d4ddf8c16894a13743f5 (diff)
downloadorg.eclipse.cdt-6feac180b1315df0fbd039b68224c3475112fe8f.tar.gz
org.eclipse.cdt-6feac180b1315df0fbd039b68224c3475112fe8f.tar.xz
org.eclipse.cdt-6feac180b1315df0fbd039b68224c3475112fe8f.zip
Test case for bug 278632 by Andrew Eidsness
-rw-r--r--core/org.eclipse.cdt.ui.tests/plugin.xml8
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BasicCEditorTest.java58
2 files changed, 66 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/plugin.xml b/core/org.eclipse.cdt.ui.tests/plugin.xml
index 1072a81b42..b281c1f38c 100644
--- a/core/org.eclipse.cdt.ui.tests/plugin.xml
+++ b/core/org.eclipse.cdt.ui.tests/plugin.xml
@@ -220,4 +220,12 @@
</enablement>
</renameParticipant>
</extension>
+
+ <extension point="org.eclipse.core.filesystem.filesystems">
+ <filesystem
+ scheme="bug278632">
+ <run class="org.eclipse.cdt.ui.tests.text.BasicCEditorTest$Bug278632FileSystem"/>
+ </filesystem>
+ </extension>
+
</plugin>
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BasicCEditorTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BasicCEditorTest.java
index fb27d72a16..5adb70d52c 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BasicCEditorTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/BasicCEditorTest.java
@@ -12,12 +12,16 @@
package org.eclipse.cdt.ui.tests.text;
import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
import org.eclipse.core.filesystem.URIUtil;
+import org.eclipse.core.filesystem.provider.FileSystem;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
@@ -34,6 +38,7 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -73,6 +78,32 @@ public class BasicCEditorTest extends BaseUITestCase {
}
}
+ public static class Bug278632FileSystem extends FileSystem {
+ public Bug278632FileSystem() {
+ getClass();
+ }
+
+ @Override
+ public IFileStore getStore(URI uri) {
+ try {
+ // For the test case, this just return the FS implementation
+ // used for the null filesystem.
+ // In a real application this would be a real implementation,
+ // however for the purposes
+ // of exposing the bug, any non-file:// scheme will do.
+ return EFS.getStore(new URI(
+ EFS.getNullFileSystem().getScheme(), uri
+ .getSchemeSpecificPart(), null));
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ return null;
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+ }
+
private static CEditor fEditor;
private static SourceViewer fSourceViewer;
private ICProject fCProject;
@@ -379,6 +410,33 @@ public class BasicCEditorTest extends BaseUITestCase {
assertSame(style.foreground, ppDirectiveColor);
}
+ public void testNonFileEFSResource_Bug278632() {
+ IWorkbenchPage page = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage();
+ assertNotNull(page);
+
+ IEditorRegistry reg = page.getWorkbenchWindow().getWorkbench()
+ .getEditorRegistry();
+ String editorID = reg.getDefaultEditor(".c").getId();
+
+ URI uri = null;
+ try {
+ uri = new URI("bug278632", "/folder/file", null);
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(uri);
+
+ IEditorPart part = null;
+ try {
+ part = IDE.openEditor(page, uri, editorID, true);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ assertNotNull(part);
+ assertTrue(part instanceof CEditor);
+ }
+
/**
* Type characters into the styled text.
*

Back to the top