mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-27 10:55:33 +02:00
[174944] changes to allow setPreselection() to work
This commit is contained in:
parent
bfe80f048c
commit
f0f8088a06
9 changed files with 85 additions and 14 deletions
|
@ -643,6 +643,11 @@ public interface ISystemRegistry extends ISchedulingRule {
|
||||||
*/
|
*/
|
||||||
public List findFilterReferencesFor(Object resource, ISubSystem subsystem);
|
public List findFilterReferencesFor(Object resource, ISubSystem subsystem);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns filter references associated with this resource under the subsystem
|
||||||
|
*/
|
||||||
|
public List findFilterReferencesFor(Object resource, ISubSystem subsystem, boolean onlyCached);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks all filters for this subsystem as stale to prevent caching
|
* Marks all filters for this subsystem as stale to prevent caching
|
||||||
* @param subsystem
|
* @param subsystem
|
||||||
|
|
|
@ -154,7 +154,11 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
|
||||||
*/
|
*/
|
||||||
public IRemoteFile getRemoteFileObject(String folderOrFileName) throws SystemMessageException
|
public IRemoteFile getRemoteFileObject(String folderOrFileName) throws SystemMessageException
|
||||||
{
|
{
|
||||||
String fofName = ArchiveHandlerManager.cleanUpVirtualPath(folderOrFileName);
|
String fofName = folderOrFileName;
|
||||||
|
if (folderOrFileName.length() > 1)
|
||||||
|
{
|
||||||
|
fofName = ArchiveHandlerManager.cleanUpVirtualPath(folderOrFileName);
|
||||||
|
}
|
||||||
IRemoteFile file = getCachedRemoteFile(fofName);
|
IRemoteFile file = getCachedRemoteFile(fofName);
|
||||||
if (file != null && !file.isStale()) {
|
if (file != null && !file.isStale()) {
|
||||||
return file;
|
return file;
|
||||||
|
|
|
@ -189,8 +189,10 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
|
||||||
parentFile = ss.getRemoteFileObject(pathOnly);
|
parentFile = ss.getRemoteFileObject(pathOnly);
|
||||||
else if (pathOnly.length() == 1)
|
else if (pathOnly.length() == 1)
|
||||||
{
|
{
|
||||||
// parentFile is already null
|
if (pathOnly.charAt(0) == sep)
|
||||||
//parentFile = null;
|
{
|
||||||
|
parentFile = ss.getRemoteFileObject(pathOnly); // root file
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (!(pathOnly.charAt(pathOnly.length()-1)==sep))
|
else if (!(pathOnly.charAt(pathOnly.length()-1)==sep))
|
||||||
parentFile = ss.getRemoteFileObject(pathOnly+sep);
|
parentFile = ss.getRemoteFileObject(pathOnly+sep);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#Mon Feb 19 12:59:50 GMT+01:00 2007
|
#Mon Feb 19 16:11:24 EST 2007
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
encoding//UI/org/eclipse/rse/ui/SystemWidgetHelpers.java=UTF-8
|
encoding//UI/org/eclipse/rse/ui/SystemWidgetHelpers.java=UTF-8
|
||||||
encoding//UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java=UTF-8
|
encoding//UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java=UTF-8
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.eclipse.rse.core.SystemAdapterHelpers;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
import org.eclipse.rse.core.model.ISystemRegistry;
|
import org.eclipse.rse.core.model.ISystemRegistry;
|
||||||
|
import org.eclipse.rse.core.model.SystemChildrenContentsType;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||||
|
@ -48,6 +49,7 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Item;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
@ -309,6 +311,7 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
|
||||||
ISystemViewElementAdapter adapter = getAdapter(selection);
|
ISystemViewElementAdapter adapter = getAdapter(selection);
|
||||||
if (adapter != null)
|
if (adapter != null)
|
||||||
{
|
{
|
||||||
|
Object parent = adapter.getParent(selection);
|
||||||
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
|
||||||
ISubSystem ss = adapter.getSubSystem(selection);
|
ISubSystem ss = adapter.getSubSystem(selection);
|
||||||
IHost connection = ss.getHost();
|
IHost connection = ss.getHost();
|
||||||
|
@ -319,22 +322,21 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
|
||||||
_connectionCombo.select(connection);
|
_connectionCombo.select(connection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List filterRefs = registry.findFilterReferencesFor(selection, ss);
|
List filterRefs = registry.findFilterReferencesFor(selection, ss, false);
|
||||||
|
|
||||||
SystemView systemView = _systemViewForm.getSystemView();
|
SystemView systemView = _systemViewForm.getSystemView();
|
||||||
if (filterRefs.size() > 0)
|
if (filterRefs.size() > 0)
|
||||||
{
|
{
|
||||||
ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
|
ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
|
||||||
systemView.setExpandedElements(new Object[] {ref});
|
systemView.expandTo(ref, selection);
|
||||||
systemView.refreshRemoteObject(selection, selection, true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Object parent = adapter.getParent(selection);
|
|
||||||
if (setPreSelection(parent))
|
if (setPreSelection(parent))
|
||||||
{
|
{
|
||||||
systemView.refreshRemoteObject(selection, selection, true);
|
systemView.expandTo(parent, selection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5033,6 +5033,51 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// Support for EXPAND TO-> ACTIONS...
|
// Support for EXPAND TO-> ACTIONS...
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
|
public void expandTo(Object parentObject, Object remoteObject)
|
||||||
|
{
|
||||||
|
SystemViewLabelAndContentProvider provider = (SystemViewLabelAndContentProvider)getContentProvider();
|
||||||
|
provider.setEnableDeferredQueries(false);
|
||||||
|
|
||||||
|
ISystemViewElementAdapter adapter = getViewAdapter(parentObject);
|
||||||
|
ISystemViewElementAdapter targetAdapter = getViewAdapter(remoteObject);
|
||||||
|
|
||||||
|
|
||||||
|
ISubSystem ss = adapter.getSubSystem(parentObject);
|
||||||
|
String parentName = adapter.getAbsoluteName(parentObject);
|
||||||
|
String remoteObjectName = targetAdapter.getAbsoluteName(remoteObject);
|
||||||
|
Item parentItem = findFirstRemoteItemReference(parentName, ss, null);
|
||||||
|
if (parentItem != null)
|
||||||
|
{
|
||||||
|
createChildren(parentItem);
|
||||||
|
Item[] children = getItems(parentItem);
|
||||||
|
setExpanded(parentItem, true);
|
||||||
|
for (int i = 0; i < children.length; i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
Item child = children[i];
|
||||||
|
Object data = child.getData();
|
||||||
|
if (data.equals(remoteObject))
|
||||||
|
{
|
||||||
|
select(remoteObject, false);
|
||||||
|
provider.setEnableDeferredQueries(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ISystemViewElementAdapter dataAdapter = (ISystemViewElementAdapter)((IAdaptable)data).getAdapter(ISystemViewElementAdapter.class);
|
||||||
|
String path = dataAdapter.getAbsoluteName(data);
|
||||||
|
if (remoteObjectName.startsWith(path))
|
||||||
|
{
|
||||||
|
expandTo(data, remoteObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
provider.setEnableDeferredQueries(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when user selects an Expand To action to expand the selected remote object with a quick filter
|
* Called when user selects an Expand To action to expand the selected remote object with a quick filter
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
||||||
private boolean filesOnly, foldersOnly;
|
private boolean filesOnly, foldersOnly;
|
||||||
private String filterString = null;
|
private String filterString = null;
|
||||||
private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
|
private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
|
||||||
|
private boolean _enableDeferredQueries = true;
|
||||||
private SystemDeferredTreeContentManager manager;
|
private SystemDeferredTreeContentManager manager;
|
||||||
/**
|
/**
|
||||||
* The cache of images that have been dispensed by this provider.
|
* The cache of images that have been dispensed by this provider.
|
||||||
|
@ -245,7 +245,13 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
||||||
{
|
{
|
||||||
//IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
//IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||||
//return store.getBoolean(ISystemPreferencesConstants.USE_DEFERRED_QUERIES);
|
//return store.getBoolean(ISystemPreferencesConstants.USE_DEFERRED_QUERIES);
|
||||||
return true; // DKM now enforcing deferred queries
|
//return true; // DKM now enforcing deferred queries
|
||||||
|
return _enableDeferredQueries;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableDeferredQueries(boolean enable)
|
||||||
|
{
|
||||||
|
_enableDeferredQueries = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
|
||||||
|
|
||||||
public void initForm()
|
public void initForm()
|
||||||
{
|
{
|
||||||
_form.setPreSelection(_preSelection);
|
|
||||||
if (_customViewerFilter != null)
|
if (_customViewerFilter != null)
|
||||||
{
|
{
|
||||||
_form.applyViewerFilter(_customViewerFilter);
|
_form.applyViewerFilter(_customViewerFilter);
|
||||||
|
@ -75,6 +75,7 @@ public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
|
||||||
{
|
{
|
||||||
_form.applyViewerFilter(getViewerFilter());
|
_form.applyViewerFilter(getViewerFilter());
|
||||||
}
|
}
|
||||||
|
_form.setPreSelection(_preSelection);
|
||||||
_form.setSelectionValidator(_selectionValidator);
|
_form.setSelectionValidator(_selectionValidator);
|
||||||
_form.setShowPropertySheet(_showPropertySheet);
|
_form.setShowPropertySheet(_showPropertySheet);
|
||||||
_form.setSelectionTreeToolTipText(getTreeTip());
|
_form.setSelectionTreeToolTipText(getTreeTip());
|
||||||
|
|
|
@ -3158,6 +3158,11 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
||||||
}
|
}
|
||||||
|
|
||||||
public List findFilterReferencesFor(Object resource, ISubSystem subsystem)
|
public List findFilterReferencesFor(Object resource, ISubSystem subsystem)
|
||||||
|
{
|
||||||
|
return findFilterReferencesFor(resource, subsystem, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List findFilterReferencesFor(Object resource, ISubSystem subsystem, boolean onlyCached)
|
||||||
{
|
{
|
||||||
String elementName = getRemoteResourceAbsoluteName(resource);
|
String elementName = getRemoteResourceAbsoluteName(resource);
|
||||||
List results = new ArrayList();
|
List results = new ArrayList();
|
||||||
|
@ -3168,7 +3173,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
||||||
{
|
{
|
||||||
ISystemFilterReference filterRef = refs[i];
|
ISystemFilterReference filterRef = refs[i];
|
||||||
|
|
||||||
if (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance()))
|
if (!onlyCached || (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance())))
|
||||||
|
|
||||||
{
|
{
|
||||||
// #1
|
// #1
|
||||||
if (subsystem.doesFilterMatch(filterRef.getReferencedFilter(), elementName))
|
if (subsystem.doesFilterMatch(filterRef.getReferencedFilter(), elementName))
|
||||||
|
|
Loading…
Add table
Reference in a new issue