1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 18:56:02 +02:00

[174944] changes to allow setPreselection() to work

This commit is contained in:
David McKnight 2007-02-21 19:36:38 +00:00
parent bfe80f048c
commit f0f8088a06
9 changed files with 85 additions and 14 deletions

View file

@ -643,6 +643,11 @@ public interface ISystemRegistry extends ISchedulingRule {
*/
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
* @param subsystem

View file

@ -154,7 +154,11 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I
*/
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);
if (file != null && !file.isStale()) {
return file;

View file

@ -189,8 +189,10 @@ public abstract class RemoteFile implements IRemoteFile, IAdaptable, Comparable
parentFile = ss.getRemoteFileObject(pathOnly);
else if (pathOnly.length() == 1)
{
// parentFile is already null
//parentFile = null;
if (pathOnly.charAt(0) == sep)
{
parentFile = ss.getRemoteFileObject(pathOnly); // root file
}
}
else if (!(pathOnly.charAt(pathOnly.length()-1)==sep))
parentFile = ss.getRemoteFileObject(pathOnly+sep);

View file

@ -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
encoding//UI/org/eclipse/rse/ui/SystemWidgetHelpers.java=UTF-8
encoding//UI/org/eclipse/rse/ui/wizards/newconnection/RSEMainNewConnectionWizard.java=UTF-8

View file

@ -30,6 +30,7 @@ import org.eclipse.rse.core.SystemAdapterHelpers;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.model.IHost;
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.services.clientserver.messages.SystemMessage;
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.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@ -309,6 +311,7 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
ISystemViewElementAdapter adapter = getAdapter(selection);
if (adapter != null)
{
Object parent = adapter.getParent(selection);
ISystemRegistry registry = RSEUIPlugin.getTheSystemRegistry();
ISubSystem ss = adapter.getSubSystem(selection);
IHost connection = ss.getHost();
@ -319,22 +322,21 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener
_connectionCombo.select(connection);
}
}
List filterRefs = registry.findFilterReferencesFor(selection, ss);
List filterRefs = registry.findFilterReferencesFor(selection, ss, false);
SystemView systemView = _systemViewForm.getSystemView();
if (filterRefs.size() > 0)
{
ISystemFilterReference ref = (ISystemFilterReference)filterRefs.get(0);
systemView.setExpandedElements(new Object[] {ref});
systemView.refreshRemoteObject(selection, selection, true);
systemView.expandTo(ref, selection);
return true;
}
else
{
Object parent = adapter.getParent(selection);
if (setPreSelection(parent))
{
systemView.refreshRemoteObject(selection, selection, true);
{
systemView.expandTo(parent, selection);
return true;
}
}

View file

@ -5033,6 +5033,51 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
// ----------------------------------
// 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
*/

View file

@ -69,7 +69,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
private boolean filesOnly, foldersOnly;
private String filterString = null;
private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
private boolean _enableDeferredQueries = true;
private SystemDeferredTreeContentManager manager;
/**
* 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();
//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;
}

View file

@ -66,7 +66,7 @@ public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
public void initForm()
{
_form.setPreSelection(_preSelection);
if (_customViewerFilter != null)
{
_form.applyViewerFilter(_customViewerFilter);
@ -75,6 +75,7 @@ public abstract class SystemRemoteResourceDialog extends SystemPromptDialog
{
_form.applyViewerFilter(getViewerFilter());
}
_form.setPreSelection(_preSelection);
_form.setSelectionValidator(_selectionValidator);
_form.setShowPropertySheet(_showPropertySheet);
_form.setSelectionTreeToolTipText(getTreeTip());

View file

@ -3158,6 +3158,11 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
}
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);
List results = new ArrayList();
@ -3168,7 +3173,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
{
ISystemFilterReference filterRef = refs[i];
if (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance()))
if (!onlyCached || (!filterRef.isStale() && filterRef.hasContents(SystemChildrenContentsType.getInstance())))
{
// #1
if (subsystem.doesFilterMatch(filterRef.getReferencedFilter(), elementName))