1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Patch for Devin Steffler.

Fixed Bug 103697 - Open Definition/Declaration on files in linked folders open a new editor
This commit is contained in:
John Camelon 2005-07-18 23:47:30 +00:00
parent 1897a34ffb
commit 08278a1193
11 changed files with 316 additions and 87 deletions

View file

@ -128,6 +128,13 @@ public class ParserUtil
resultingResource = root.getFileForLocation( path );
if( resultingResource != null && resultingResource.exists() )
return resultingResource;
// check for linked resources
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
if( files != null && files.length > 0 && files[0] != null) {
return files[0];
}
return null;
}
catch( IllegalArgumentException iae ) //thrown on invalid paths

View file

@ -11,8 +11,11 @@
package org.eclipse.cdt.ui.tests.text.selectiontests;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import junit.framework.TestCase;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.ICDescriptor;
import org.eclipse.cdt.core.ICDescriptorOperation;
@ -27,28 +30,24 @@ import org.eclipse.cdt.internal.ui.editor.ICEditorActionDefinitionIds;
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.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.search2.internal.ui.SearchView;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import junit.framework.TestCase;
/**
* Base test class for testing Ctrl_F3/F3 with the indexers.
*
@ -113,6 +112,31 @@ public class BaseSelectionTestsIndexer extends TestCase {
return file;
}
protected IFile importFileWithLink(String fileName, String contents) throws Exception{
//Obtain file handle
IFile file = project.getProject().getFile(fileName);
IPath location = new Path(project.getLocation().removeLastSegments(1).toOSString() + File.separator + fileName); //$NON-NLS-1$
File linkFile = new File(location.toOSString());
if (!linkFile.exists()) {
linkFile.createNewFile();
}
file.createLink(location, IResource.ALLOW_MISSING_LOCAL, null);
InputStream stream = new ByteArrayInputStream( contents.getBytes() );
//Create file input stream
if( file.exists() )
file.setContents( stream, false, false, monitor );
else
file.create( stream, false, monitor );
fileManager.addFile(file);
return file;
}
protected IFolder importFolder(String folderName) throws Exception {
IFolder folder = project.getProject().getFolder(folderName);

View file

@ -127,6 +127,7 @@ public class CPPSelectionTestsCTagsIndexer extends BaseSelectionTestsIndexer
suite.addTest(new CPPSelectionTestsCTagsIndexer("testNoDefinitions")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsCTagsIndexer("testOpenFileDiffDir")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsCTagsIndexer("testBug101287")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsCTagsIndexer("testBug103697")); //$NON-NLS-1$
return suite;
}
@ -662,6 +663,29 @@ public class CPPSelectionTestsCTagsIndexer extends BaseSelectionTestsIndexer
}
}
public void testBug103697() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("int x;\n"); //$NON-NLS-1$
buffer.append("int foo() {\n"); //$NON-NLS-1$
buffer.append(" return x;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFileWithLink("testBug103697.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("return x;\n") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 4);
assertEquals(((ASTNode)def).getLength(), 1);
assertTrue(decl instanceof IASTName);
assertEquals(((IASTName)decl).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)decl).getOffset(), 4);
assertEquals(((ASTNode)decl).getLength(), 1);
}
// REMINDER: see CSelectionTestsCTagsIndexer#suite() when appending new tests to this suite
}

View file

@ -127,7 +127,8 @@ public class CPPSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer imple
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug101287")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug102258")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103323")); //$NON-NLS-1$
suite.addTest(new CPPSelectionTestsDOMIndexer("testBug103697")); //$NON-NLS-1$
return suite;
}
@ -1069,5 +1070,28 @@ public class CPPSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer imple
}
public void testBug103697() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("int x;\n"); //$NON-NLS-1$
buffer.append("int foo() {\n"); //$NON-NLS-1$
buffer.append(" return x;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFileWithLink("testBug103697.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("return x;\n") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 4);
assertEquals(((ASTNode)def).getLength(), 1);
assertTrue(decl instanceof IASTName);
assertEquals(((IASTName)decl).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)decl).getOffset(), 4);
assertEquals(((ASTNode)decl).getLength(), 1);
}
// REMINDER: see CPPSelectionTestsDomIndexer#suite() when appending new tests to this suite
}

View file

@ -37,6 +37,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.text.TextSelection;
import org.eclipse.jface.viewers.ISelection;
@ -146,6 +147,31 @@ public class CPPSelectionTestsNoIndexer extends TestCase {
return file;
}
protected IFile importFileWithLink(String fileName, String contents) throws Exception{
//Obtain file handle
IFile file = project.getProject().getFile(fileName);
IPath location = new Path(project.getLocation().removeLastSegments(1).toOSString() + File.separator + fileName); //$NON-NLS-1$
File linkFile = new File(location.toOSString());
if (!linkFile.exists()) {
linkFile.createNewFile();
}
file.createLink(location, IResource.ALLOW_MISSING_LOCAL, null);
InputStream stream = new ByteArrayInputStream( contents.getBytes() );
//Create file input stream
if( file.exists() )
file.setContents( stream, false, false, monitor );
else
file.create( stream, false, monitor );
fileManager.addFile(file);
return file;
}
protected IASTNode testF3(IFile file, int offset) throws ParserException {
return testF3(file, offset, 0);
}
@ -1078,4 +1104,27 @@ public class CPPSelectionTestsNoIndexer extends TestCase {
assertEquals(((ASTNode)decl).getOffset(), 11);
assertEquals(((ASTNode)decl).getLength(), 14);
}
public void testBug103697() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("int x;\n"); //$NON-NLS-1$
buffer.append("int foo() {\n"); //$NON-NLS-1$
buffer.append(" return x;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFileWithLink("testBug103697.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("return x;\n") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 4);
assertEquals(((ASTNode)def).getLength(), 1);
assertTrue(decl instanceof IASTName);
assertEquals(((IASTName)decl).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)decl).getOffset(), 4);
assertEquals(((ASTNode)decl).getLength(), 1);
}
}

View file

@ -120,7 +120,8 @@ public class CSelectionTestsCTagsIndexer extends BaseSelectionTestsIndexer
suite.addTest(new CSelectionTestsCTagsIndexer("testNoDefinitions")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsCTagsIndexer("testOpenFileDiffDir")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsCTagsIndexer("testBug101287")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsCTagsIndexer("testBug103697")); //$NON-NLS-1$
return suite;
}
@ -648,6 +649,29 @@ public class CSelectionTestsCTagsIndexer extends BaseSelectionTestsIndexer
}
}
public void testBug103697() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("int x;\n"); //$NON-NLS-1$
buffer.append("int foo() {\n"); //$NON-NLS-1$
buffer.append(" return x;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFileWithLink("testBug103697.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("return x;\n") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 4);
assertEquals(((ASTNode)def).getLength(), 1);
assertTrue(decl instanceof IASTName);
assertEquals(((IASTName)decl).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)decl).getOffset(), 4);
assertEquals(((ASTNode)decl).getLength(), 1);
}
// REMINDER: see CSelectionTestsCTagsIndexer#suite() when appending new tests to this suite
}

View file

@ -115,6 +115,7 @@ public class CSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer impleme
suite.addTest(new CSelectionTestsDOMIndexer("testNoDefinitions")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsDOMIndexer("testOpenFileDiffDir")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsDOMIndexer("testBug101287")); //$NON-NLS-1$
suite.addTest(new CSelectionTestsDOMIndexer("testBug103697")); //$NON-NLS-1$
return suite;
}
@ -644,5 +645,28 @@ public class CSelectionTestsDOMIndexer extends BaseSelectionTestsIndexer impleme
assertEquals(((ASTNode)decl).getLength(), 3);
}
public void testBug103697() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("int x;\n"); //$NON-NLS-1$
buffer.append("int foo() {\n"); //$NON-NLS-1$
buffer.append(" return x;\n"); //$NON-NLS-1$
buffer.append("}\n"); //$NON-NLS-1$
String code = buffer.toString();
IFile file = importFileWithLink("testBug103697.cpp", code); //$NON-NLS-1$
int offset = code.indexOf("return x;\n") + "return ".length(); //$NON-NLS-1$ //$NON-NLS-2$
IASTNode def = testCtrl_F3(file, offset);
IASTNode decl = testF3(file, offset);
assertTrue(def instanceof IASTName);
assertEquals(((IASTName)def).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)def).getOffset(), 4);
assertEquals(((ASTNode)def).getLength(), 1);
assertTrue(decl instanceof IASTName);
assertEquals(((IASTName)decl).toString(), "x"); //$NON-NLS-1$
assertEquals(((ASTNode)decl).getOffset(), 4);
assertEquals(((ASTNode)decl).getLength(), 1);
}
// REMINDER: see CSelectionTestsDomIndexer#suite() when appending new tests to this suite
}

View file

@ -30,6 +30,7 @@ import org.eclipse.cdt.ui.CSearchResultLabelProvider;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@ -119,82 +120,99 @@ public class CSearchResultPage extends AbstractTextSearchViewPage {
editor = IDE.openEditor(CUIPlugin.getActivePage(), getCanonicalFile((IFile) searchMatch.getResource()), false);
IMatchLocatable searchLocatable = searchMatch.getLocatable();
showWithMarker(editor, getCanonicalFile((IFile) searchMatch.getResource()), searchLocatable, currentOffset, currentLength);
return;
}
else {
//Match is outside of the workspace
try {
IEditorInput input =EditorUtility.getEditorInput(new ExternalSearchFile(searchMatch.getPath(), searchMatch));
IWorkbenchPage p= CUIPlugin.getActivePage();
IEditorPart editorPart= p.openEditor(input, "org.eclipse.cdt.ui.editor.ExternalSearchEditor"); //$NON-NLS-1$
if (editorPart instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editorPart;
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(searchMatch.getPath());
if (files != null && files.length > 0){
for (int i=0; i<files.length; i++) {
if (EditorUtility.isLinked(files[i])) {
try {
editor = EditorUtility.openInEditor(files[i]);
} catch (PartInitException e) {
} catch (CModelException e) {
}
IMatchLocatable searchLocatable = searchMatch.getLocatable();
int startOffset=0;
int length=0;
if (searchLocatable instanceof IOffsetLocatable){
startOffset = ((IOffsetLocatable)searchLocatable).getNameStartOffset();
length = ((IOffsetLocatable)searchLocatable).getNameEndOffset() - startOffset;
} else if (searchLocatable instanceof ILineLocatable){
int tempstartLine = ((ILineLocatable)searchLocatable).getStartLine();
int tempendLine = ((ILineLocatable)searchLocatable).getEndLine();
//Convert the given line number into an offset in order to be able to use
//the text editor to open
IDocument doc =textEditor.getDocumentProvider().getDocument(input);
if (doc == null)
return;
showWithMarker(editor, getCanonicalFile(files[i]), searchLocatable, currentOffset, currentLength);
return;
}
}
}
//Match is outside of the workspace
try {
IEditorInput input =EditorUtility.getEditorInput(new ExternalSearchFile(searchMatch.getPath(), searchMatch));
IWorkbenchPage p= CUIPlugin.getActivePage();
IEditorPart editorPart= p.openEditor(input, "org.eclipse.cdt.ui.editor.ExternalSearchEditor"); //$NON-NLS-1$
if (editorPart instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editorPart;
IMatchLocatable searchLocatable = searchMatch.getLocatable();
int startOffset=0;
int length=0;
if (searchLocatable instanceof IOffsetLocatable){
startOffset = ((IOffsetLocatable)searchLocatable).getNameStartOffset();
length = ((IOffsetLocatable)searchLocatable).getNameEndOffset() - startOffset;
} else if (searchLocatable instanceof ILineLocatable){
int tempstartLine = ((ILineLocatable)searchLocatable).getStartLine();
int tempendLine = ((ILineLocatable)searchLocatable).getEndLine();
//Convert the given line number into an offset in order to be able to use
//the text editor to open
IDocument doc =textEditor.getDocumentProvider().getDocument(input);
if (doc == null)
return;
try {
// NOTE: Subtract 1 from the passed in line number because, even though the editor is 1 based, the line
//resolver doesn't take this into account and is still 0 based
startOffset = doc.getLineOffset(tempstartLine-1);
length=doc.getLineLength(tempstartLine-1);
} catch (BadLocationException e) {}
//See if an end line number has been provided - if so
//use it to calculate the length of the reveal...
//Make sure that an end offset exists that is greater than 0
//and that is greater than the start line number
if (tempendLine>0 && tempendLine > tempstartLine){
int endOffset;
try {
// NOTE: Subtract 1 from the passed in line number because, even though the editor is 1 based, the line
//resolver doesn't take this into account and is still 0 based
startOffset = doc.getLineOffset(tempstartLine-1);
length=doc.getLineLength(tempstartLine-1);
//See NOTE above
endOffset = doc.getLineOffset(tempendLine-1);
length = endOffset - startOffset;
} catch (BadLocationException e) {}
//See if an end line number has been provided - if so
//use it to calculate the length of the reveal...
//Make sure that an end offset exists that is greater than 0
//and that is greater than the start line number
if (tempendLine>0 && tempendLine > tempstartLine){
int endOffset;
try {
//See NOTE above
endOffset = doc.getLineOffset(tempendLine-1);
length = endOffset - startOffset;
} catch (BadLocationException e) {}
}
}
textEditor.selectAndReveal(startOffset,length);
}
textEditor.selectAndReveal(startOffset,length);
}
//TODO: Put in once we have marker support for External Translation Units
/* //Get all the CProjects off the model
ICProject[] cprojects = CoreModel.getDefault().getCModel().getCProjects();
ICProject containingProject=null;
ICElement celem = null;
//Find the CProject that the element belongs to
for (int i=0; i<cprojects.length; i++){
celem = cprojects[i].findElement(searchMatch.referringElement);
containingProject=celem.getCProject();
if (containingProject != null)
break;
}
//Create a translation unit, open in editor
ITranslationUnit unit = CoreModel.getDefault().createTranslationUnitFrom(containingProject, searchMatch.path);
IEditorPart editorPart = null;
if (unit != null) {
editorPart = EditorUtility.openInEditor(unit);
}
//Show with marker
if (editorPart instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editorPart;
showWithMarker(textEditor,(IFile) celem.getUnderlyingResource(),searchMatch.startOffset, searchMatch.endOffset - searchMatch.startOffset);
}*/
} catch (CModelException e) {}
catch (CoreException e) {}
}
ICProject[] cprojects = CoreModel.getDefault().getCModel().getCProjects();
ICProject containingProject=null;
ICElement celem = null;
//Find the CProject that the element belongs to
for (int i=0; i<cprojects.length; i++){
celem = cprojects[i].findElement(searchMatch.referringElement);
containingProject=celem.getCProject();
if (containingProject != null)
break;
}
//Create a translation unit, open in editor
ITranslationUnit unit = CoreModel.getDefault().createTranslationUnitFrom(containingProject, searchMatch.path);
IEditorPart editorPart = null;
if (unit != null) {
editorPart = EditorUtility.openInEditor(unit);
}
//Show with marker
if (editorPart instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editorPart;
showWithMarker(textEditor,(IFile) celem.getUnderlyingResource(),searchMatch.startOffset, searchMatch.endOffset - searchMatch.startOffset);
}*/
} catch (CModelException e) {}
catch (CoreException e) {}
}
}
/* (non-Javadoc)

View file

@ -133,7 +133,7 @@ public class OpenDefinitionAction extends SelectionParseAction implements
return;
}
lang = DOMSearchUtil.getLanguageFromFile(resourceFile);
project = new CProject(null, resourceFile.getProject());
projectName = resourceFile.getProject().getName();
}
// step 1 starts here

View file

@ -59,6 +59,7 @@ import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.ui.texteditor.IDocumentProvider;
@ -600,6 +601,15 @@ public class SelectionParseAction extends Action {
return true;
}
// check the IWorkspaceRoot to see if it knows of any IFiles that are open for the corresponding filename (i.e. linked resources)
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(path);
for(int i=0; i<files.length; i++) {
if (files[i] != null) {
open( files[i], locatable );
return true;
}
}
FileStorage storage = new FileStorage(null, path);
IEditorPart part = EditorUtility.openInEditor(storage);
setSelectionAtOffset(part, locatable);

View file

@ -28,10 +28,13 @@ import org.eclipse.cdt.internal.ui.editor.CEditor;
import org.eclipse.cdt.internal.ui.editor.CEditorMessages;
import org.eclipse.cdt.internal.ui.editor.ITranslationUnitEditorInput;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.core.resources.IContainer;
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.IStorage;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.action.Action;
@ -131,17 +134,19 @@ public class EditorUtility {
if (file != null) {
try {
File tempFile = file.getRawLocation().toFile();
if (!isLinked(file)) {
File tempFile = file.getRawLocation().toFile();
if (tempFile != null){
String canonicalPath = null;
try {
canonicalPath = tempFile.getCanonicalPath();
} catch (IOException e1) {}
if (canonicalPath != null){
IPath path = new Path(canonicalPath);
file = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path);
if (tempFile != null){
String canonicalPath = null;
try {
canonicalPath = tempFile.getCanonicalPath();
} catch (IOException e1) {}
if (canonicalPath != null){
IPath path = new Path(canonicalPath);
file = CUIPlugin.getWorkspace().getRoot().getFileForLocation(path);
}
}
}
@ -153,6 +158,26 @@ public class EditorUtility {
}
return null;
}
public static boolean isLinked(IFile file) {
if (file.isLinked())
return true;
IPath path = file.getLocation();
while (path.segmentCount() > 0) {
path = path.removeLastSegments(1);
IContainer[] containers = ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(path);
for(int i=0; i<containers.length; i++) {
if (containers[i] instanceof IFolder && ((IFolder)containers[i]).isLinked()) {
return true;
}
}
}
return false;
}
/**
* @param project