mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-04 15:45:25 +02:00
[163381] fix so that duplicates of different hosts are not added in systems view
This commit is contained in:
parent
40f384cc0f
commit
dee5c721fc
4 changed files with 85 additions and 8 deletions
|
@ -228,7 +228,7 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
if (parentPath.length() == 0) parentPath = "/"; //$NON-NLS-1$
|
||||
String name = fofName.substring(lastSep + 1, fofName.length());
|
||||
|
||||
IHostFile node = getFile(null, parentPath, name);
|
||||
IHostFile node = getFile(new NullProgressMonitor(), parentPath, name);
|
||||
if (node != null)
|
||||
{
|
||||
IRemoteFile parent = null;
|
||||
|
@ -339,11 +339,11 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
|||
throw new SystemMessageException(msg);
|
||||
}
|
||||
|
||||
IHostFile[] results = getFilesAndFolders(monitor, parentPath, fileNameFilter);
|
||||
IHostFile[] results = getFilesAndFolders(monitor, parentPath, fileNameFilter);
|
||||
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
|
||||
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
|
||||
return farr;
|
||||
IRemoteFile[] farr = getHostFileToRemoteFileAdapter().convertToRemoteFiles(this, context, parent, results);
|
||||
parent.setContents(RemoteChildrenContentsType.getInstance(), fileNameFilter, farr);
|
||||
return farr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1125,7 +1125,12 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
|||
String otherPath = other.getAbsolutePath();
|
||||
String path = this.getAbsolutePath();
|
||||
String otherHost = other.getHostName();
|
||||
return getHostName().equals(otherHost) && path.equals(otherPath);
|
||||
|
||||
String alias1 = this.getParentRemoteFileSubSystem().getHostAliasName();
|
||||
String alias2 = other.getParentRemoteFileSubSystem().getHostAliasName();
|
||||
|
||||
//return getHostName().equals(otherHost) && path.equals(otherPath);
|
||||
return alias1.equals(alias2) && path.equals(otherPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -5059,7 +5060,42 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
Vector matches = new Vector();
|
||||
matches = findAllRemoteItemReferences(parentElementOrTreePath, parentElementOrTreePath, matches);
|
||||
|
||||
|
||||
// get rid of references to items for different connection
|
||||
if (parentElementOrTreePath instanceof IAdaptable)
|
||||
{
|
||||
List invalidMatches = new ArrayList();
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (adapter != null)
|
||||
{
|
||||
IHost parentHost = adapter.getSubSystem(parentElementOrTreePath).getHost();
|
||||
for (int i = 0; i < matches.size(); i++)
|
||||
{
|
||||
Widget match = (Widget) matches.get(i);
|
||||
Object data = match.getData();
|
||||
if (data instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter madapter = (ISystemViewElementAdapter)((IAdaptable)data).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (madapter != null)
|
||||
{
|
||||
IHost mHost = madapter.getSubSystem(data).getHost();
|
||||
if (mHost != parentHost)
|
||||
{
|
||||
invalidMatches.add(match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidMatches.size() > 0)
|
||||
{
|
||||
for (int m = invalidMatches.size() - 1; m >= 0 ; m--)
|
||||
{
|
||||
Object match = invalidMatches.get(m);
|
||||
matches.remove(match);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Widget[] widgets = internalFindItems(parentElementOrTreePath);
|
||||
// If parent hasn't been realized yet, just ignore the add.
|
||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
|
@ -5059,7 +5060,42 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
|||
Vector matches = new Vector();
|
||||
matches = findAllRemoteItemReferences(parentElementOrTreePath, parentElementOrTreePath, matches);
|
||||
|
||||
|
||||
// get rid of references to items for different connection
|
||||
if (parentElementOrTreePath instanceof IAdaptable)
|
||||
{
|
||||
List invalidMatches = new ArrayList();
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (adapter != null)
|
||||
{
|
||||
IHost parentHost = adapter.getSubSystem(parentElementOrTreePath).getHost();
|
||||
for (int i = 0; i < matches.size(); i++)
|
||||
{
|
||||
Widget match = (Widget) matches.get(i);
|
||||
Object data = match.getData();
|
||||
if (data instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter madapter = (ISystemViewElementAdapter)((IAdaptable)data).getAdapter(ISystemViewElementAdapter.class);
|
||||
if (madapter != null)
|
||||
{
|
||||
IHost mHost = madapter.getSubSystem(data).getHost();
|
||||
if (mHost != parentHost)
|
||||
{
|
||||
invalidMatches.add(match);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (invalidMatches.size() > 0)
|
||||
{
|
||||
for (int m = invalidMatches.size() - 1; m >= 0 ; m--)
|
||||
{
|
||||
Object match = invalidMatches.get(m);
|
||||
matches.remove(match);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Widget[] widgets = internalFindItems(parentElementOrTreePath);
|
||||
// If parent hasn't been realized yet, just ignore the add.
|
||||
|
|
Loading…
Add table
Reference in a new issue