Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Maetzel2004-10-12 17:28:33 +0000
committerKai Maetzel2004-10-12 17:28:33 +0000
commit4a504f7ea9442a831c0c137b12d668fcb84b3576 (patch)
treebff49d4a1ce4f8113212f79c38008b8051f18921 /org.eclipse.core.filebuffers.tests
parent538567a1f4c5dcbfa0a1b1659113bd17a8e3abd3 (diff)
downloadeclipse.platform.text-4a504f7ea9442a831c0c137b12d668fcb84b3576.tar.gz
eclipse.platform.text-4a504f7ea9442a831c0c137b12d668fcb84b3576.tar.xz
eclipse.platform.text-4a504f7ea9442a831c0c137b12d668fcb84b3576.zip
tests for files in linked folders
Diffstat (limited to 'org.eclipse.core.filebuffers.tests')
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java41
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java24
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java7
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java115
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java21
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java7
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java7
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java56
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java1
-rw-r--r--org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java25
-rw-r--r--org.eclipse.core.filebuffers.tests/testResources/LinkedFileTarget (renamed from org.eclipse.core.filebuffers.tests/testResources/LinkTarget)0
11 files changed, 237 insertions, 67 deletions
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
index 298e1e0fb..f465df83f 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferCreation.java
@@ -37,6 +37,7 @@ public class FileBufferCreation extends TestCase {
private final static String CONTENT1= "This is the content of the workspace file.";
private final static String CONTENT2= "This is the content of the link target.";
private final static String CONTENT3= "This is the content of the external file.";
+ private final static String CONTENT4= "This is the content of a file in a linked folder.";
private IProject fProject;
@@ -54,9 +55,14 @@ public class FileBufferCreation extends TestCase {
ResourceHelper.deleteProject("project");
}
- private IPath createLinkedFile(String fileName, String linkTarget) throws CoreException {
- IFile file= ResourceHelper.createLinkedFile(fProject, new Path(fileName), FileBuffersTestPlugin.getDefault(), new Path(linkTarget));
- return file != null ? file.getFullPath() : null;
+ private IPath createLinkedFile(String linkedFileName, String linkedFileTarget) throws CoreException {
+ IFile linkedFile= ResourceHelper.createLinkedFile(fProject, new Path(linkedFileName), FileBuffersTestPlugin.getDefault(), new Path(linkedFileTarget));
+ return linkedFile != null ? linkedFile.getFullPath() : null;
+ }
+
+ private IPath createLinkedFolder(String linkedFolderName, String linkedFolderTarget) throws CoreException {
+ IFolder linkedFolder= ResourceHelper.createLinkedFolder(fProject, new Path(linkedFolderName), FileBuffersTestPlugin.getDefault(), new Path(linkedFolderTarget));
+ return linkedFolder != null ? linkedFolder.getFullPath() : null;
}
/*
@@ -135,8 +141,8 @@ public class FileBufferCreation extends TestCase {
/*
* Tests the creation of a file buffer for a linked file.
*/
- public void test3() throws Exception {
- IPath path= createLinkedFile("file", "testResources/LinkTarget");
+ public void test3_1() throws Exception {
+ IPath path= createLinkedFile("file", "testResources/LinkedFileTarget");
assertNotNull(path);
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
@@ -153,14 +159,35 @@ public class FileBufferCreation extends TestCase {
}
/*
+ * Tests the creation of a file buffer for a file in a linked folder.
+ */
+ public void test3_2() throws Exception {
+ IPath path= createLinkedFolder("linkedFolder", "testResources/linkedFolderTarget");
+ assertNotNull(path);
+ path= path.append("FileInLinkedFolder");
+
+ ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
+ manager.connect(path, null);
+ ITextFileBuffer buffer= manager.getTextFileBuffer(path);
+ Assert.assertNotNull(buffer);
+
+ IDocument document= buffer.getDocument();
+ Assert.assertNotNull(document);
+ Assert.assertTrue(CONTENT4.equals(document.get()));
+
+ manager.disconnect(path, null);
+ assertNull(manager.getTextFileBuffer(path));
+ }
+
+ /*
* Tests that two different files linked to the same target file result
* in two different, independent file buffers.
*/
public void test4() throws Exception {
- IPath path1= createLinkedFile("file1", "testResources/LinkTarget");
+ IPath path1= createLinkedFile("file1", "testResources/LinkedFileTarget");
assertNotNull(path1);
- IPath path2= createLinkedFile("file2", "testResources/LinkTarget");
+ IPath path2= createLinkedFile("file2", "testResources/LinkedFileTarget");
assertNotNull(path2);
ITextFileBufferManager manager= FileBuffers.getTextFileBufferManager();
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
index 1fffd5c99..23aa3798c 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBufferFunctions.java
@@ -24,6 +24,7 @@ import org.eclipse.core.filebuffers.ITextFileBuffer;
import org.eclipse.core.filebuffers.ITextFileBufferManager;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.IAnnotationModel;
/**
* FileBufferFunctions
@@ -47,6 +48,8 @@ public abstract class FileBufferFunctions extends TestCase {
protected abstract boolean isStateValidationSupported();
+ protected abstract Class getAnnotationModelClass() throws Exception;
+
protected void setUp() throws Exception {
fManager= FileBuffers.getTextFileBufferManager();
@@ -1033,4 +1036,25 @@ public abstract class FileBufferFunctions extends TestCase {
fManager.removeFileBufferListener(listener);
}
}
+
+ /*
+ * Test annotation model existence.
+ * ATTENTION: This test only works as is in a workspace that contains the "org.eclipse.ui.editors" plug-in.
+ */
+ public void test18() throws Exception {
+ fManager.connect(fPath, null);
+ try {
+ ITextFileBuffer buffer= fManager.getTextFileBuffer(fPath);
+ assertNotNull(buffer);
+
+ Class clazz= getAnnotationModelClass();
+ if (clazz != null) {
+ IAnnotationModel model= buffer.getAnnotationModel();
+ assertTrue(clazz.isInstance(model));
+ }
+
+ } finally {
+ fManager.disconnect(fPath, null);
+ }
+ }
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
index 65d0d6ecb..02d19a137 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForExternalFiles.java
@@ -77,4 +77,11 @@ public class FileBuffersForExternalFiles extends FileBufferFunctions {
protected boolean modifyUnderlyingFile() throws Exception {
return false;
}
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return null;
+ }
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java
new file mode 100644
index 000000000..6fa96a02a
--- /dev/null
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForFilesInLinkedFolders.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.filebuffers.tests;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+import org.eclipse.core.filebuffers.FileBuffers;
+
+import org.eclipse.jface.text.source.IAnnotationModel;
+
+/**
+ * FileBuffersForLinkedFiles
+ */
+public class FileBuffersForFilesInLinkedFolders extends FileBufferFunctions {
+
+ private File fExternalDir;
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ File file= FileBuffers.getSystemFileAtLocation(getPath());
+ FileTool.delete(file);
+ FileTool.delete(fExternalDir);
+ super.tearDown();
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
+ */
+ protected IPath createPath(IProject project) throws Exception {
+ File sourceDir= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/linkedFolderTarget"));
+ fExternalDir= FileTool.createTempFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("externalResources/linkedFolderTarget"));
+ fExternalDir.mkdirs();
+ FileTool.copy(sourceDir, fExternalDir);
+
+ IFolder folder= ResourceHelper.createLinkedFolder(project, new Path("LinkedFolder"), fExternalDir);
+ IFile file= folder.getFile(new Path("FileInLinkedFolder"));
+ return file.getFullPath();
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#markReadOnly()
+ */
+ protected void markReadOnly() throws Exception {
+ IFile file= FileBuffers.getWorkspaceFileAtLocation(getPath());
+ file.setReadOnly(true);
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#isStateValidationSupported()
+ */
+ protected boolean isStateValidationSupported() {
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#deleteUnderlyingFile()
+ */
+ protected boolean deleteUnderlyingFile() throws Exception {
+ IFile file= FileBuffers.getWorkspaceFileAtLocation(getPath());
+ file.delete(true, false, null);
+ return file.exists();
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#moveUnderlyingFile()
+ */
+ protected IPath moveUnderlyingFile() throws Exception {
+ IFile file= FileBuffers.getWorkspaceFileAtLocation(getPath());
+ ResourceHelper.createFolder("project/folderA");
+ IPath path= new Path("/project/folderA/MovedLinkedFile");
+ file.move(path, true, false, null);
+
+ file= FileBuffers.getWorkspaceFileAtLocation(path);
+ if (file != null && file.exists())
+ return path;
+
+ return null;
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#modifyUnderlyingFile()
+ */
+ protected boolean modifyUnderlyingFile() throws Exception {
+ File file= FileBuffers.getSystemFileAtLocation(getPath());
+ FileTool.write(file.getAbsolutePath(), new StringBuffer("Changed content of file in linked folder"));
+ file.setLastModified(1000);
+ IFile iFile= FileBuffers.getWorkspaceFileAtLocation(getPath());
+ iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return IAnnotationModel.class;
+ }
+}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
index 98387221b..e35517598 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForLinkedFiles.java
@@ -14,11 +14,14 @@ import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.jface.text.source.IAnnotationModel;
+
/**
* FileBuffersForLinkedFiles
*/
@@ -39,8 +42,8 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#createPath(org.eclipse.core.resources.IProject)
*/
protected IPath createPath(IProject project) throws Exception {
- File sourceFile= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/LinkTarget"));
- fExternalFile= FileTool.createTempFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("externalResources/LinkTarget"));
+ File sourceFile= FileTool.getFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("testResources/LinkedFileTarget"));
+ fExternalFile= FileTool.createTempFileInPlugin(FileBuffersTestPlugin.getDefault(), new Path("externalResources/LinkedFileTarget"));
FileTool.copy(sourceFile, fExternalFile);
IFile file= ResourceHelper.createLinkedFile(project, new Path("LinkedFile"), fExternalFile);
return file.getFullPath();
@@ -90,7 +93,17 @@ public class FileBuffersForLinkedFiles extends FileBufferFunctions {
* @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#modifyUnderlyingFile()
*/
protected boolean modifyUnderlyingFile() throws Exception {
- // TODO Auto-generated method stub
- return false;
+ FileTool.write(fExternalFile.getAbsolutePath(), new StringBuffer("Changed content of linked file"));
+ fExternalFile.setLastModified(1000);
+ IFile iFile= FileBuffers.getWorkspaceFileAtLocation(getPath());
+ iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
+ return true;
+ }
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return IAnnotationModel.class;
}
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
index a984446b5..2d6c6fd98 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingExternalFiles.java
@@ -73,4 +73,11 @@ public class FileBuffersForNonExistingExternalFiles extends FileBufferFunctions
protected boolean modifyUnderlyingFile() throws Exception {
return false;
}
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return null;
+ }
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
index 22f745d43..8f7ee6c2c 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForNonExistingWorkspaceFiles.java
@@ -76,4 +76,11 @@ public class FileBuffersForNonExistingWorkspaceFiles extends FileBufferFunctions
protected boolean modifyUnderlyingFile() throws Exception {
return false;
}
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return null;
+ }
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
index f19eea382..b8aac9a10 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersForWorkspaceFiles.java
@@ -16,41 +16,18 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.filebuffers.FileBuffers;
+import org.eclipse.jface.text.source.IAnnotationModel;
+
/**
* FileBuffersForWorkspaceFiles
*/
public class FileBuffersForWorkspaceFiles extends FileBufferFunctions {
-
- private static class ResourceListener implements IResourceChangeListener {
- public boolean fFired= false;
- public IPath fPath;
-
- public ResourceListener(IPath path) {
- fPath= path;
- }
-
- public void resourceChanged(IResourceChangeEvent event) {
- if (!fFired) {
- IResourceDelta delta= event.getDelta();
- if (delta != null) {
- delta= delta.findMember(fPath);
- if (delta != null)
- fFired= IResourceDelta.CHANGED == delta.getKind() && (IResourceDelta.CONTENT & delta.getFlags()) != 0;
- }
- }
- }
- }
-
protected IPath createPath(IProject project) throws Exception {
IFolder folder= ResourceHelper.createFolder("project/folderA/folderB/");
IFile file= ResourceHelper.createFile(folder, "WorkspaceFile", "content");
@@ -105,27 +82,14 @@ public class FileBuffersForWorkspaceFiles extends FileBufferFunctions {
FileTool.write(file.getAbsolutePath(), new StringBuffer("Changed content of workspace file"));
file.setLastModified(1000);
IFile iFile= FileBuffers.getWorkspaceFileAtLocation(getPath());
-
- ResourceListener listener= new ResourceListener(iFile.getFullPath());
- ResourcesPlugin.getWorkspace().addResourceChangeListener(listener);
- try {
- iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
- return receivedNotification(listener);
- } finally {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(listener);
- listener= null;
- }
+ iFile.refreshLocal(IResource.DEPTH_INFINITE, null);
+ return true;
}
-
- private boolean receivedNotification(ResourceListener listener) {
- for (int i= 0; i < 5; i++) {
- if (listener.fFired)
- return true;
- try {
- Thread.sleep(1000); // sleep a second
- } catch (InterruptedException e) {
- }
- }
- return false;
+
+ /*
+ * @see org.eclipse.core.filebuffers.tests.FileBufferFunctions#getAnnotationModelClass()
+ */
+ protected Class getAnnotationModelClass() throws Exception {
+ return IAnnotationModel.class;
}
}
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
index 37f8a3d6f..d6b9faca9 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/FileBuffersTestSuite.java
@@ -29,6 +29,7 @@ public class FileBuffersTestSuite {
suite.addTestSuite(FileBuffersForWorkspaceFiles.class);
suite.addTestSuite(FileBuffersForExternalFiles.class);
suite.addTestSuite(FileBuffersForLinkedFiles.class);
+ suite.addTestSuite(FileBuffersForFilesInLinkedFolders.class);
suite.addTestSuite(FileBuffersForNonExistingExternalFiles.class);
suite.addTestSuite(FileBuffersForNonExistingWorkspaceFiles.class);
//$JUnit-END$
diff --git a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
index 725029d63..59d3984ab 100644
--- a/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
+++ b/org.eclipse.core.filebuffers.tests/src/org/eclipse/core/filebuffers/tests/ResourceHelper.java
@@ -101,23 +101,28 @@ public class ResourceHelper {
return file;
}
- public static IFile createLinkedFile(IContainer container, IPath linkedFilePath, File linkTarget) throws CoreException {
- IFile iFile= container.getFile(linkedFilePath);
- iFile.createLink(new Path(linkTarget.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
+ public static IFile createLinkedFile(IContainer container, IPath linkPath, File linkedFileTarget) throws CoreException {
+ IFile iFile= container.getFile(linkPath);
+ iFile.createLink(new Path(linkedFileTarget.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFile;
-
}
- public static IFile createLinkedFile(IContainer container, IPath filePath, Plugin plugin, IPath linkPath) throws CoreException {
- IFile iFile= container.getFile(filePath);
- File file= FileTool.getFileInPlugin(plugin, linkPath);
+ public static IFile createLinkedFile(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFileTargetPath) throws CoreException {
+ File file= FileTool.getFileInPlugin(plugin, linkedFileTargetPath);
+ IFile iFile= container.getFile(linkPath);
iFile.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFile;
}
- public static IFolder createLinkedFolder(IContainer container, IPath folderPath, Plugin plugin, IPath linkPath) throws CoreException {
- IFolder iFolder= container.getFolder(folderPath);
- File file= FileTool.getFileInPlugin(plugin, linkPath);
+ public static IFolder createLinkedFolder(IContainer container, IPath linkPath, File linkedFolderTarget) throws CoreException {
+ IFolder folder= container.getFolder(linkPath);
+ folder.createLink(new Path(linkedFolderTarget.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
+ return folder;
+ }
+
+ public static IFolder createLinkedFolder(IContainer container, IPath linkPath, Plugin plugin, IPath linkedFolderTargetPath) throws CoreException {
+ File file= FileTool.getFileInPlugin(plugin, linkedFolderTargetPath);
+ IFolder iFolder= container.getFolder(linkPath);
iFolder.createLink(new Path(file.getAbsolutePath()), IResource.ALLOW_MISSING_LOCAL, NULL_MONITOR);
return iFolder;
}
diff --git a/org.eclipse.core.filebuffers.tests/testResources/LinkTarget b/org.eclipse.core.filebuffers.tests/testResources/LinkedFileTarget
index d80dbfd20..d80dbfd20 100644
--- a/org.eclipse.core.filebuffers.tests/testResources/LinkTarget
+++ b/org.eclipse.core.filebuffers.tests/testResources/LinkedFileTarget

Back to the top