mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
[170627] changed views to use IContextObject during queries
This commit is contained in:
parent
ef5ae9d77e
commit
37897c0bdd
45 changed files with 1175 additions and 112 deletions
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.eclipse.rse.examples.daytime.model;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -27,6 +29,7 @@ import org.eclipse.rse.examples.daytime.service.IDaytimeService;
|
|||
import org.eclipse.rse.examples.daytime.subsystems.DaytimeSubSystem;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
|
||||
/**
|
||||
|
@ -70,10 +73,11 @@ public class DaytimeResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
return false;
|
||||
}
|
||||
|
||||
public Object[] getChildren(Object element) {
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
protected Object internalGetPropertyValue(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -16,10 +16,13 @@
|
|||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
|
@ -98,14 +101,12 @@ public class DeveloperResourceAdapter extends AbstractSystemViewAdapter
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(Object)
|
||||
*/
|
||||
public Object[] getChildren(Object o)
|
||||
{
|
||||
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#internalGetPropertyDescriptors()
|
||||
*/
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package samples.model;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.ui.SystemMenuManager;
|
||||
|
@ -100,7 +102,7 @@ public class TeamResourceAdapter extends AbstractSystemViewAdapter implements
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return ((TeamResource)element).getDevelopers();
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.eclipse.jface.viewers.AbstractTreeViewer;
|
|||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.filters.ISystemFilter;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
import org.eclipse.rse.core.model.ISystemContainer;
|
||||
|
@ -78,6 +79,7 @@ import org.eclipse.rse.model.ISystemResourceChangeEvents;
|
|||
import org.eclipse.rse.model.SystemRegistry;
|
||||
import org.eclipse.rse.model.SystemRemoteResourceSet;
|
||||
import org.eclipse.rse.model.SystemResourceChangeEvent;
|
||||
import org.eclipse.rse.services.clientserver.PathUtility;
|
||||
import org.eclipse.rse.services.clientserver.StringCompare;
|
||||
import org.eclipse.rse.services.clientserver.SystemSearchString;
|
||||
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
|
||||
|
@ -117,6 +119,8 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
|||
import org.eclipse.rse.ui.operations.SystemFetchOperation;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.ContextObject;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemDragDropAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemEditableRemoteObject;
|
||||
import org.eclipse.rse.ui.view.ISystemMementoConstants;
|
||||
|
@ -607,23 +611,21 @@ public class SystemViewRemoteFileAdapter
|
|||
* Return the children of this object.
|
||||
* If this is a folder or root, we list all child folders and files.
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return internalGetChildren(monitor, element);
|
||||
return internalGetChildren(monitor, element, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the children of this object.
|
||||
* If this is a folder or root, we list all child folders and files.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IContextObject context)
|
||||
{
|
||||
_lastResults = internalGetChildren(null, element);
|
||||
return _lastResults;
|
||||
// }
|
||||
return internalGetChildren(monitor, context.getModelObject(), context.getFilterReference());
|
||||
}
|
||||
|
||||
private synchronized Object[] internalGetChildren(IProgressMonitor monitor, Object element)
|
||||
private synchronized Object[] internalGetChildren(IProgressMonitor monitor, IAdaptable element, ISystemFilterReference filterReference)
|
||||
{
|
||||
//System.out.println("Inside getChildren for: "+element);
|
||||
IRemoteFile file = (IRemoteFile) element;
|
||||
|
@ -638,9 +640,12 @@ public class SystemViewRemoteFileAdapter
|
|||
return ((RemoteFileRoot) file).getRootFiles();
|
||||
}
|
||||
IRemoteFileSubSystem ss = file.getParentRemoteFileSubSystem();
|
||||
|
||||
|
||||
/*
|
||||
RemoteFileFilterString orgRffs = file.getFilterString();
|
||||
|
||||
String filter = null;
|
||||
|
||||
if (orgRffs != null)
|
||||
{
|
||||
if (foldersOnly)
|
||||
|
@ -660,7 +665,28 @@ public class SystemViewRemoteFileAdapter
|
|||
filter = rffs.toString();
|
||||
}
|
||||
}
|
||||
else if (foldersOnly)
|
||||
else
|
||||
*/
|
||||
String filter = null;
|
||||
if (filterReference != null)
|
||||
{
|
||||
ISystemFilter filterObject = filterReference.getReferencedFilter();
|
||||
if (filterObject.getFilterStringCount() > 0)
|
||||
{
|
||||
String filterString = filterObject.getFilterStrings()[0];
|
||||
String separator = PathUtility.getSeparator(filterString);
|
||||
|
||||
int sepIndex = filterString.lastIndexOf(separator);
|
||||
if (sepIndex > 0)
|
||||
{
|
||||
filter = filterString.substring(sepIndex + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (foldersOnly)
|
||||
{
|
||||
if (filterString == null)
|
||||
filter = "* /nf"; //$NON-NLS-1$
|
||||
|
@ -681,6 +707,7 @@ public class SystemViewRemoteFileAdapter
|
|||
else
|
||||
filter = filterString;
|
||||
}
|
||||
}
|
||||
|
||||
Object[] children = null;
|
||||
|
||||
|
@ -791,9 +818,12 @@ public class SystemViewRemoteFileAdapter
|
|||
else
|
||||
{
|
||||
// check that the children are actually there
|
||||
Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance());
|
||||
if (!file.isStale() && contents != null && contents.length == 0 )
|
||||
hasChildren = false;
|
||||
//Object[] contents = file.getContents(RemoteChildrenContentsType.getInstance());
|
||||
hasChildren = file.hasContents(RemoteChildrenContentsType.getInstance());
|
||||
if (!hasChildren && !file.isStale())
|
||||
hasChildren = true;
|
||||
// if (!file.isStale() && contents != null && contents.length == 0 )
|
||||
// hasChildren = false;
|
||||
}
|
||||
|
||||
return hasChildren;
|
||||
|
@ -2593,7 +2623,7 @@ public class SystemViewRemoteFileAdapter
|
|||
IRemoteFile file = (IRemoteFile) element;
|
||||
return file.getParentRemoteFileSubSystem();
|
||||
}
|
||||
return null;
|
||||
return super.getSubSystem(element);
|
||||
}
|
||||
/**
|
||||
* Return the subsystem factory id that owns this remote object
|
||||
|
@ -3145,7 +3175,7 @@ public class SystemViewRemoteFileAdapter
|
|||
|
||||
protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
|
||||
{
|
||||
return new SystemFetchOperation(null, (IAdaptable)o, this, collector, true);
|
||||
return new SystemFetchOperation(null, o, this, collector, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -234,7 +234,7 @@ public class SystemViewRemoteSearchResultAdapter extends AbstractSystemViewAdapt
|
|||
/**
|
||||
* Returns nothing
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ package org.eclipse.rse.files.ui.view;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
|
@ -134,7 +136,7 @@ public class SystemViewRemoteSearchResultSetAdapter extends AbstractSystemViewAd
|
|||
/**
|
||||
* Returns the search results for the given search handle
|
||||
*/
|
||||
public Object[] getChildren(Object element) {
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element) {
|
||||
|
||||
if (element instanceof IHostSearchResultSet) {
|
||||
IHostSearchResultSet output = (IHostSearchResultSet)element;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.processes.ui.view;
|
||||
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -156,7 +157,7 @@ public class SystemViewRemoteProcessAdapter extends AbstractSystemViewAdapter
|
|||
return false;
|
||||
}
|
||||
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
IRemoteProcess process = (IRemoteProcess) element;
|
||||
IRemoteProcessSubSystem ss = process.getParentRemoteProcessSubSystem();
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#Thu Feb 15 10:26:03 CET 2007
|
||||
#Thu Feb 15 10:47:06 EST 2007
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/org/eclipse/rse/internal/services/ssh/SshServiceResources.properties=8859_1
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.eclipse.rse.shells.ui.view;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.subsystems.IRemoteLineReference;
|
||||
import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell;
|
||||
|
@ -97,7 +98,7 @@ public class SystemBuildErrorViewProvider extends SystemTableViewProvider
|
|||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||
if (adapter != null)
|
||||
{
|
||||
results = adapter.getChildren(object);
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
|
||||
ArrayList filterredResults = new ArrayList();
|
||||
for (int i = _offset+ 1; i <results.length;i++)
|
||||
|
|
|
@ -327,7 +327,7 @@ implements ISystemViewElementAdapter, ISystemRemoteElementAdapter, ISystemOutpu
|
|||
/**
|
||||
* Returns the children of a remote command if the element is a remote command
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
|
||||
if (element instanceof IRemoteCommandShell)
|
||||
|
|
|
@ -25,9 +25,11 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
|
@ -109,6 +111,7 @@ import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
|||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.FileTransfer;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
|
@ -5159,9 +5162,18 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
ISystemFilterReference originalFilter = null;
|
||||
if (parentElementOrTreePath instanceof IContextObject)
|
||||
{
|
||||
IContextObject context = (IContextObject)parentElementOrTreePath;
|
||||
originalFilter = context.getFilterReference();
|
||||
parentElementOrTreePath = context.getModelObject();
|
||||
}
|
||||
|
||||
Vector matches = new Vector();
|
||||
matches = findAllRemoteItemReferences(parentElementOrTreePath, parentElementOrTreePath, matches);
|
||||
|
||||
|
@ -5211,9 +5223,22 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
{
|
||||
for (int i = 0; i < matches.size(); i++) {
|
||||
Widget match = (Widget) matches.get(i);
|
||||
ISystemFilterReference ref = getContainingFilterReference((TreeItem)match);
|
||||
if (matches.size() > 1 && ref != null && ref != originalFilter)
|
||||
{
|
||||
// could have the same object under multiple filters
|
||||
// need to apply filter
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
|
||||
IContextObject contextObject = getContextObject((TreeItem)match);
|
||||
Object[] newChildren = adapter.getChildren(new NullProgressMonitor(), contextObject);
|
||||
internalAdd(match, parentElementOrTreePath, newChildren);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalAdd(match, parentElementOrTreePath, childElements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TreeItem item = getFirstSelectedTreeItem();
|
||||
if (item != null)
|
||||
|
@ -5226,4 +5251,156 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the containing filter reference for an item
|
||||
* @param item the item to get the filter reference for
|
||||
* @return the filter reference
|
||||
*/
|
||||
public ISystemFilterReference getContainingFilterReference(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingFilterReference(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the containing subsystem from an item
|
||||
* @param item the item to get the subsystem for
|
||||
* @return the subsystem
|
||||
*/
|
||||
public ISubSystem getContainingSubSystem(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingSubSystem(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the context object from a tree item
|
||||
* @param item the item to get the context for
|
||||
* @return the context object
|
||||
*/
|
||||
public IContextObject getContextObject(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
ISystemFilterReference filterReference = getContainingFilterReference(item);
|
||||
if (filterReference != null)
|
||||
{
|
||||
return new ContextObject(data, filterReference.getSubSystem(), filterReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISubSystem subSystem = getContainingSubSystem(item);
|
||||
if (subSystem != null)
|
||||
{
|
||||
return new ContextObject(data, subSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ContextObject(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
|
||||
* of the model object, itself
|
||||
*/
|
||||
protected void createChildren(final Widget widget)
|
||||
{
|
||||
if (widget instanceof TreeItem)
|
||||
{
|
||||
final Item[] tis = getChildren(widget);
|
||||
if (tis != null && tis.length > 0) {
|
||||
Object data = tis[0].getData();
|
||||
if (data != null) {
|
||||
return; // children already there!
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
|
||||
public void run() {
|
||||
// fix for PR 1FW89L7:
|
||||
// don't complain and remove all "dummies" ...
|
||||
if (tis != null) {
|
||||
for (int i = 0; i < tis.length; i++) {
|
||||
if (tis[i].getData() != null) {
|
||||
disassociate(tis[i]);
|
||||
Assert.isTrue(tis[i].getData() == null,
|
||||
"Second or later child is non -null");//$NON-NLS-1$
|
||||
|
||||
}
|
||||
tis[i].dispose();
|
||||
}
|
||||
}
|
||||
Object d = widget.getData();
|
||||
if (d != null)
|
||||
{
|
||||
Object parentElement = getContextObject((TreeItem)widget);
|
||||
Object[] children = getSortedChildren(parentElement);
|
||||
if (children != null)
|
||||
{
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
createTreeItem(widget, children[i], -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
super.createChildren(widget);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.ui.operations;
|
||||
|
||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
|
||||
import org.eclipse.ui.progress.DeferredTreeContentManager;
|
||||
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
|
||||
|
||||
public class SystemDeferredTreeContentManager extends
|
||||
DeferredTreeContentManager {
|
||||
|
||||
public SystemDeferredTreeContentManager(ITreeContentProvider provider,
|
||||
AbstractTreeViewer viewer)
|
||||
{
|
||||
super(provider, viewer);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IDeferredWorkbenchAdapter for element or the element if it is
|
||||
* an instance of IDeferredWorkbenchAdapter. If it does not exist return
|
||||
* null.
|
||||
*
|
||||
* @param element
|
||||
* @return IDeferredWorkbenchAdapter or <code>null</code>
|
||||
*/
|
||||
protected IDeferredWorkbenchAdapter getAdapter(Object element)
|
||||
{
|
||||
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)element).getModelObject();
|
||||
}
|
||||
return super.getAdapter(element);
|
||||
}
|
||||
|
||||
}
|
|
@ -36,6 +36,7 @@ import org.eclipse.rse.ui.GenericMessages;
|
|||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -50,14 +51,14 @@ import org.eclipse.ui.progress.IElementCollector;
|
|||
public class SystemFetchOperation extends JobChangeAdapter implements IRunnableWithProgress
|
||||
{
|
||||
protected IWorkbenchPart _part;
|
||||
protected IAdaptable _remoteObject;
|
||||
protected Object _remoteObject;
|
||||
protected IElementCollector _collector;
|
||||
private IRunnableContext context;
|
||||
protected ISystemViewElementAdapter _adapter;
|
||||
protected boolean _canRunAsJob;
|
||||
protected InvocationTargetException _exc;
|
||||
|
||||
public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
|
||||
public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector)
|
||||
{
|
||||
_part = part;
|
||||
_remoteObject = remoteObject;
|
||||
|
@ -66,7 +67,7 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
_canRunAsJob = false;
|
||||
}
|
||||
|
||||
public SystemFetchOperation(IWorkbenchPart part, IAdaptable remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
|
||||
public SystemFetchOperation(IWorkbenchPart part, Object remoteObject, ISystemViewElementAdapter adapter, IElementCollector collector, boolean canRunAsJob)
|
||||
{
|
||||
_part = part;
|
||||
_remoteObject = remoteObject;
|
||||
|
@ -165,7 +166,15 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
*/
|
||||
protected void execute(IProgressMonitor monitor) throws Exception, InterruptedException
|
||||
{
|
||||
SubSystem ss = (SubSystem)_adapter.getSubSystem(_remoteObject);
|
||||
SubSystem ss = null;
|
||||
if (_remoteObject instanceof IContextObject)
|
||||
{
|
||||
ss = (SubSystem)((IContextObject)_remoteObject).getSubSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = (SubSystem)_adapter.getSubSystem(_remoteObject);
|
||||
}
|
||||
synchronized (ss.getConnectorService())
|
||||
{
|
||||
if (!ss.isConnected())
|
||||
|
@ -194,7 +203,15 @@ public class SystemFetchOperation extends JobChangeAdapter implements IRunnableW
|
|||
|
||||
}
|
||||
}
|
||||
Object[] children = _adapter.getChildren(monitor, _remoteObject);
|
||||
Object[] children = null;
|
||||
if (_remoteObject instanceof IContextObject)
|
||||
{
|
||||
children = _adapter.getChildren(monitor, (IContextObject)_remoteObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
children = _adapter.getChildren(monitor, (IAdaptable)_remoteObject);
|
||||
}
|
||||
_collector.add(children, monitor);
|
||||
monitor.done();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.Vector;
|
|||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.ISchedulingRule;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -278,10 +279,13 @@ public abstract class AbstractSystemViewAdapter
|
|||
{
|
||||
if (element instanceof AbstractResource)
|
||||
return ((AbstractResource)element).getSubSystem();
|
||||
else if (element instanceof IContextObject)
|
||||
return ((IContextObject)element).getSubSystem();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <i>Called by SystemView viewer. No need to override or call.</i><br>
|
||||
* Returns any framework-supplied remote object actions that should be contributed to the popup menu
|
||||
|
@ -406,6 +410,10 @@ public abstract class AbstractSystemViewAdapter
|
|||
*/
|
||||
public String getLabel(Object element)
|
||||
{
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)element).getModelObject();
|
||||
}
|
||||
return getText(element);
|
||||
}
|
||||
|
||||
|
@ -443,19 +451,42 @@ public abstract class AbstractSystemViewAdapter
|
|||
public abstract boolean hasChildren(Object element);
|
||||
|
||||
/**
|
||||
* <i><b>Abstract</b>. Must be overridden by subclasses.</i><br>
|
||||
* Return the children of this object. Return null if children not supported.
|
||||
* Implementation of IWorkbenchAdapter.getChildren(). Rather than overriding this, adapter implementors
|
||||
* should override the getChildren() methods that take a monitor.
|
||||
*/
|
||||
public abstract Object[] getChildren(Object element);
|
||||
public Object[] getChildren(Object object)
|
||||
{
|
||||
return getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This should be overridden by subclasses in order to provide
|
||||
* deferred query support via the Eclipse Jobs mechanism
|
||||
* Return the children of this object. Return null if children not supported.
|
||||
*
|
||||
* @param monitor the progress monitor
|
||||
* @param element the model object to get children from
|
||||
* @return the children of element
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, Object element)
|
||||
public abstract Object[] getChildren(IProgressMonitor monitor, IAdaptable element);
|
||||
|
||||
/**
|
||||
* This should be overridden by subclasses in order to provide
|
||||
* deferred query support via the Eclipse Jobs mechanism. The context object is passed in
|
||||
* in place of the model object. By default, we just fall back to the original mechanism
|
||||
* Return the children of this object. Return null if children not supported.
|
||||
*
|
||||
* This method should be overridden if your adapter supports context objects. If not, this will
|
||||
* fall back to the model object version of the method.
|
||||
*
|
||||
* @param monitor the progress monitor
|
||||
* @param element the context object that wrappers a model object, it's subsystem and filter reference
|
||||
* @return the children of the model object within the context object that matches the containing filter reference criteria
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, IContextObject element)
|
||||
{
|
||||
return getChildren(element);
|
||||
return getChildren(monitor, element.getModelObject());
|
||||
}
|
||||
|
||||
|
||||
|
@ -1778,7 +1809,7 @@ public abstract class AbstractSystemViewAdapter
|
|||
*/
|
||||
protected SystemFetchOperation getSystemFetchOperation(Object o, IElementCollector collector)
|
||||
{
|
||||
return new SystemFetchOperation(null, (IAdaptable)o, this, collector);
|
||||
return new SystemFetchOperation(null, o, this, collector);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1790,8 +1821,15 @@ public abstract class AbstractSystemViewAdapter
|
|||
return true;
|
||||
}
|
||||
|
||||
public ISchedulingRule getRule(Object element) {
|
||||
public ISchedulingRule getRule(Object element)
|
||||
{
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)element).getModelObject();
|
||||
}
|
||||
IAdaptable location = (IAdaptable)element;
|
||||
return new SystemSchedulingRule(location);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.ui.view;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
|
||||
|
||||
/**
|
||||
* This class is used by tree views to pass context information from the views to
|
||||
* the view providers and model adapters for queries. The context information consists of
|
||||
* a model object and it may optionally contain the associated filter reference a subsystem.
|
||||
*
|
||||
* Context objects are created transiently and are only used to aid in providing filter information
|
||||
* during a query.
|
||||
*
|
||||
*/
|
||||
public class ContextObject implements IContextObject
|
||||
{
|
||||
private ISubSystem _subSystem = null;
|
||||
private ISystemFilterReference _filterReference = null;
|
||||
private Object _modelObject = null;
|
||||
|
||||
public ContextObject(Object modelObject, ISubSystem subSystem, ISystemFilterReference filterReference)
|
||||
{
|
||||
_subSystem = subSystem;
|
||||
_filterReference = filterReference;
|
||||
_modelObject = modelObject;
|
||||
}
|
||||
|
||||
public ContextObject(Object modelObject, ISubSystem subSystem)
|
||||
{
|
||||
_modelObject = modelObject;
|
||||
_subSystem = subSystem;
|
||||
}
|
||||
|
||||
public ContextObject(Object modelObject)
|
||||
{
|
||||
_modelObject = modelObject;
|
||||
}
|
||||
|
||||
public ISystemFilterReference getFilterReference()
|
||||
{
|
||||
return _filterReference;
|
||||
}
|
||||
|
||||
public ISubSystem getSubSystem()
|
||||
{
|
||||
return _subSystem;
|
||||
}
|
||||
|
||||
public IAdaptable getModelObject()
|
||||
{
|
||||
return (IAdaptable)_modelObject;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation. All rights reserved.
|
||||
* This program and the accompanying materials are made available under the terms
|
||||
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Initial Contributors:
|
||||
* The following IBM employees contributed to the Remote System Explorer
|
||||
* component that contains this file: David McKnight.
|
||||
*
|
||||
* Contributors:
|
||||
* {Name} (company) - description of contribution.
|
||||
********************************************************************************/
|
||||
package org.eclipse.rse.ui.view;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
|
||||
/**
|
||||
* This class is used by tree views to pass context information from the views to
|
||||
* the view providers and model adapters for queries. The context information consists of
|
||||
* a model object and it may optionally contain the associated filter reference a subsystem.
|
||||
*
|
||||
* Context objects are created transiently and are only used to aid in providing filter information
|
||||
* during a query.
|
||||
*
|
||||
*/
|
||||
public interface IContextObject
|
||||
{
|
||||
/**
|
||||
* Gets the associated filter reference for the corresponding model object
|
||||
* @return the associated filter reference
|
||||
*/
|
||||
public ISystemFilterReference getFilterReference();
|
||||
|
||||
/**
|
||||
* Gets the model object for which this context applies
|
||||
* @return the model object
|
||||
*/
|
||||
public IAdaptable getModelObject();
|
||||
|
||||
/**
|
||||
* Gets the associated subsystem for the corresponding model object
|
||||
* @return the associated subsystem
|
||||
*/
|
||||
public ISubSystem getSubSystem();
|
||||
}
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui.view;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
@ -168,17 +169,34 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD
|
|||
* Return the parent of this object
|
||||
*/
|
||||
public Object getParent(Object element);
|
||||
/**
|
||||
* Return the children of this object
|
||||
*/
|
||||
public Object[] getChildren(Object element);
|
||||
|
||||
/**
|
||||
* Return the children of this object. This version (with monitor) is used when the
|
||||
* request happens on a modal thread. The implementation needs to take this into
|
||||
* Return the children of this model object.
|
||||
*
|
||||
* @param monitor the progress monitor
|
||||
* @param element the model object to query
|
||||
*
|
||||
* @return the children of element
|
||||
*
|
||||
* The implementation needs to take this into
|
||||
* account so that SWT thread exceptions are avoided.
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, Object element);
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element);
|
||||
|
||||
/**
|
||||
* Return the children of this object. When a contextObject is passed in
|
||||
* instead of an adaptable model object, the adapter needs handle both the model object
|
||||
* as well as the associated filter.
|
||||
*
|
||||
* @param monitor the progress monitor
|
||||
* @param contextObject a wrapper object that contains the model object plus context information
|
||||
*
|
||||
* @return the children of the model object in contextObject that matches the filter in contextObject
|
||||
*
|
||||
* The implementation needs to take this into
|
||||
* account so that SWT thread exceptions are avoided.
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, IContextObject contextObject);
|
||||
|
||||
/**
|
||||
* Return the children of this object, using the given Expand-To filter
|
||||
|
|
|
@ -15,12 +15,13 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.rse.ui.operations.SystemDeferredTreeContentManager;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.progress.DeferredTreeContentManager;
|
||||
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
|
||||
import org.eclipse.ui.views.properties.IPropertyDescriptor;
|
||||
|
||||
public class SystemDeferredTableTreeContentManager extends
|
||||
DeferredTreeContentManager {
|
||||
SystemDeferredTreeContentManager {
|
||||
|
||||
private SystemTableTreeViewProvider _provider;
|
||||
private SystemTableTreeView _view;
|
||||
|
@ -42,6 +43,24 @@ public class SystemDeferredTableTreeContentManager extends
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IDeferredWorkbenchAdapter for element or the element if it is
|
||||
* an instance of IDeferredWorkbenchAdapter. If it does not exist return
|
||||
* null.
|
||||
*
|
||||
* @param element
|
||||
* @return IDeferredWorkbenchAdapter or <code>null</code>
|
||||
*/
|
||||
protected IDeferredWorkbenchAdapter getAdapter(Object element)
|
||||
{
|
||||
|
||||
if (element instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)element).getModelObject();
|
||||
}
|
||||
return super.getAdapter(element);
|
||||
}
|
||||
|
||||
|
||||
public class RelayoutView implements Runnable
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.SystemAdapterHelpers;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
|
@ -344,7 +345,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl
|
|||
Object[] children = null;
|
||||
|
||||
if (filterString == null)
|
||||
children = subsystemAdapter.getChildren(subsystem);
|
||||
children = subsystemAdapter.getChildren(new NullProgressMonitor(), (IAdaptable)subsystem);
|
||||
else
|
||||
{
|
||||
children = resolveFilterString(subsystem, filterString);
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Hashtable;
|
|||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -45,6 +46,7 @@ import org.eclipse.jface.viewers.TreeViewer;
|
|||
import org.eclipse.jface.window.SameShellProvider;
|
||||
import org.eclipse.rse.core.SystemAdapterHelpers;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
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.subsystems.ISubSystem;
|
||||
|
@ -76,6 +78,7 @@ import org.eclipse.rse.ui.actions.SystemSubMenuManager;
|
|||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.FileTransfer;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
|
@ -89,6 +92,7 @@ import org.eclipse.swt.events.SelectionEvent;
|
|||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Item;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -1855,4 +1859,168 @@ implements IMenuListener, ISystemDeleteTarget, ISystemRenameTarget, ISystemSelec
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
|
||||
* of the model object, itself
|
||||
*/
|
||||
protected void createChildren(final Widget widget)
|
||||
{
|
||||
if (widget instanceof TreeItem)
|
||||
{
|
||||
final Item[] tis = getChildren(widget);
|
||||
if (tis != null && tis.length > 0) {
|
||||
Object data = tis[0].getData();
|
||||
if (data != null) {
|
||||
return; // children already there!
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
|
||||
public void run() {
|
||||
// fix for PR 1FW89L7:
|
||||
// don't complain and remove all "dummies" ...
|
||||
if (tis != null) {
|
||||
for (int i = 0; i < tis.length; i++) {
|
||||
if (tis[i].getData() != null) {
|
||||
disassociate(tis[i]);
|
||||
Assert.isTrue(tis[i].getData() == null,
|
||||
"Second or later child is non -null");//$NON-NLS-1$
|
||||
|
||||
}
|
||||
tis[i].dispose();
|
||||
}
|
||||
}
|
||||
Object d = widget.getData();
|
||||
if (d != null)
|
||||
{
|
||||
Object parentElement = getContextObject((TreeItem)widget);
|
||||
Object[] children = getSortedChildren(parentElement);
|
||||
if (children != null)
|
||||
{
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
createTreeItem(widget, children[i], -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
super.createChildren(widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the containing filter reference for an item
|
||||
* @param item the item to get the filter reference for
|
||||
* @return the filter reference
|
||||
*/
|
||||
public ISystemFilterReference getContainingFilterReference(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingFilterReference(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the containing subsystem from an item
|
||||
* @param item the item to get the subsystem for
|
||||
* @return the subsystem
|
||||
*/
|
||||
public ISubSystem getContainingSubSystem(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingSubSystem(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the context object from a tree item
|
||||
* @param item the item to get the context for
|
||||
* @return the context object
|
||||
*/
|
||||
public IContextObject getContextObject(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
ISystemFilterReference filterReference = getContainingFilterReference(item);
|
||||
if (filterReference != null)
|
||||
{
|
||||
return new ContextObject(data, filterReference.getSubSystem(), filterReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISubSystem subSystem = getContainingSubSystem(item);
|
||||
if (subSystem != null)
|
||||
{
|
||||
return new ContextObject(data, subSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ContextObject(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the standard viewer method to get the model object from the context object
|
||||
*/
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
Assert.isNotNull(parentElementOrTreePath);
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
if (parentElementOrTreePath instanceof IContextObject)
|
||||
{
|
||||
parentElementOrTreePath = ((IContextObject)parentElementOrTreePath).getModelObject();
|
||||
}
|
||||
super.add(parentElementOrTreePath, childElements);
|
||||
}
|
||||
}
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
|
@ -180,20 +181,29 @@ public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelP
|
|||
|
||||
public Object[] getElements(Object object)
|
||||
{
|
||||
|
||||
|
||||
Object[] results = null;
|
||||
if (object == _lastObject && _lastResults != null)
|
||||
{
|
||||
return _lastResults;
|
||||
}
|
||||
else
|
||||
if (object instanceof IAdaptable)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||
Object element = object;
|
||||
// object could either be a model object or a wrapper IContextObject
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)object).getModelObject();
|
||||
}
|
||||
{
|
||||
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(element);
|
||||
adapter.setViewer(_viewer);
|
||||
|
||||
|
||||
|
||||
if (adapter.hasChildren(object))
|
||||
if (adapter.hasChildren(element))
|
||||
{
|
||||
if (supportsDeferredQueries())
|
||||
{
|
||||
|
@ -212,7 +222,14 @@ public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelP
|
|||
}
|
||||
else
|
||||
{
|
||||
results = adapter.getChildren(object);
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IContextObject)object);
|
||||
}
|
||||
else
|
||||
{
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
}
|
||||
}
|
||||
if (adapter instanceof SystemViewRootInputAdapter && results != null)
|
||||
{
|
||||
|
@ -233,6 +250,7 @@ public class SystemTableTreeViewProvider implements ILabelProvider, ITableLabelP
|
|||
_lastObject = object;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (results == null)
|
||||
{
|
||||
return new Object[0];
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
|
@ -152,7 +153,7 @@ public class SystemTableViewProvider implements ILabelProvider, ITableLabelProvi
|
|||
if (adapter != null)
|
||||
{
|
||||
adapter.setViewer(_viewer);
|
||||
results = adapter.getChildren(object);
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
if (adapter instanceof SystemViewRootInputAdapter)
|
||||
{
|
||||
ArrayList filterredResults = new ArrayList();
|
||||
|
|
|
@ -25,9 +25,11 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.jface.action.ActionContributionItem;
|
||||
|
@ -109,6 +111,7 @@ import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
|||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.FileTransfer;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
|
@ -5159,9 +5162,18 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
ISystemFilterReference originalFilter = null;
|
||||
if (parentElementOrTreePath instanceof IContextObject)
|
||||
{
|
||||
IContextObject context = (IContextObject)parentElementOrTreePath;
|
||||
originalFilter = context.getFilterReference();
|
||||
parentElementOrTreePath = context.getModelObject();
|
||||
}
|
||||
|
||||
Vector matches = new Vector();
|
||||
matches = findAllRemoteItemReferences(parentElementOrTreePath, parentElementOrTreePath, matches);
|
||||
|
||||
|
@ -5211,9 +5223,22 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
{
|
||||
for (int i = 0; i < matches.size(); i++) {
|
||||
Widget match = (Widget) matches.get(i);
|
||||
ISystemFilterReference ref = getContainingFilterReference((TreeItem)match);
|
||||
if (matches.size() > 1 && ref != null && ref != originalFilter)
|
||||
{
|
||||
// could have the same object under multiple filters
|
||||
// need to apply filter
|
||||
ISystemViewElementAdapter adapter = (ISystemViewElementAdapter)((IAdaptable)parentElementOrTreePath).getAdapter(ISystemViewElementAdapter.class);
|
||||
IContextObject contextObject = getContextObject((TreeItem)match);
|
||||
Object[] newChildren = adapter.getChildren(new NullProgressMonitor(), contextObject);
|
||||
internalAdd(match, parentElementOrTreePath, newChildren);
|
||||
}
|
||||
else
|
||||
{
|
||||
internalAdd(match, parentElementOrTreePath, childElements);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TreeItem item = getFirstSelectedTreeItem();
|
||||
if (item != null)
|
||||
|
@ -5226,4 +5251,156 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the containing filter reference for an item
|
||||
* @param item the item to get the filter reference for
|
||||
* @return the filter reference
|
||||
*/
|
||||
public ISystemFilterReference getContainingFilterReference(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingFilterReference(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the containing subsystem from an item
|
||||
* @param item the item to get the subsystem for
|
||||
* @return the subsystem
|
||||
*/
|
||||
public ISubSystem getContainingSubSystem(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingSubSystem(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the context object from a tree item
|
||||
* @param item the item to get the context for
|
||||
* @return the context object
|
||||
*/
|
||||
public IContextObject getContextObject(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
ISystemFilterReference filterReference = getContainingFilterReference(item);
|
||||
if (filterReference != null)
|
||||
{
|
||||
return new ContextObject(data, filterReference.getSubSystem(), filterReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISubSystem subSystem = getContainingSubSystem(item);
|
||||
if (subSystem != null)
|
||||
{
|
||||
return new ContextObject(data, subSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ContextObject(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
|
||||
* of the model object, itself
|
||||
*/
|
||||
protected void createChildren(final Widget widget)
|
||||
{
|
||||
if (widget instanceof TreeItem)
|
||||
{
|
||||
final Item[] tis = getChildren(widget);
|
||||
if (tis != null && tis.length > 0) {
|
||||
Object data = tis[0].getData();
|
||||
if (data != null) {
|
||||
return; // children already there!
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
|
||||
public void run() {
|
||||
// fix for PR 1FW89L7:
|
||||
// don't complain and remove all "dummies" ...
|
||||
if (tis != null) {
|
||||
for (int i = 0; i < tis.length; i++) {
|
||||
if (tis[i].getData() != null) {
|
||||
disassociate(tis[i]);
|
||||
Assert.isTrue(tis[i].getData() == null,
|
||||
"Second or later child is non -null");//$NON-NLS-1$
|
||||
|
||||
}
|
||||
tis[i].dispose();
|
||||
}
|
||||
}
|
||||
Object d = widget.getData();
|
||||
if (d != null)
|
||||
{
|
||||
Object parentElement = getContextObject((TreeItem)widget);
|
||||
Object[] children = getSortedChildren(parentElement);
|
||||
if (children != null)
|
||||
{
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
createTreeItem(widget, children[i], -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
super.createChildren(widget);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +65,7 @@ public class SystemViewAPIProviderForConnections
|
|||
public Object[] getSystemViewRoots()
|
||||
{
|
||||
//return sr.getSubSystems(connection);
|
||||
return getAdapter(connection).getChildren(connection); // pc42690
|
||||
return getAdapter(connection).getChildren(new NullProgressMonitor(), connection); // pc42690
|
||||
}
|
||||
/**
|
||||
* Return true if {@link #getSystemViewRoots()} will return a non-empty list
|
||||
|
@ -83,7 +84,7 @@ public class SystemViewAPIProviderForConnections
|
|||
public Object[] getConnectionChildren(IHost selectedConnection)
|
||||
{
|
||||
//return sr.getSubSystems(selectedConnection);
|
||||
return getAdapter(selectedConnection).getChildren(selectedConnection); // pc42690
|
||||
return getAdapter(selectedConnection).getChildren(new NullProgressMonitor(), selectedConnection); // pc42690
|
||||
}
|
||||
/**
|
||||
* This method is called by the connection adapter when deciding to show a plus-sign
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ICellEditorValidator;
|
||||
|
@ -250,7 +251,7 @@ public class SystemViewConnectionAdapter
|
|||
/**
|
||||
* Return the children of this object
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
IHost conn = (IHost)element;
|
||||
ISystemViewInputProvider input = getInput();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
@ -172,7 +173,7 @@ public class SystemViewFilterAdapter extends AbstractSystemViewAdapter implement
|
|||
* Return the children of this filter.
|
||||
* This is a combination of nested filters and resolved filter objects.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemFilter filter = getFilter(element);
|
||||
// transient filters...
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
@ -151,7 +152,7 @@ public class SystemViewFilterPoolAdapter extends AbstractSystemViewAdapter imple
|
|||
* Return the children of this object.
|
||||
* For filter pools, this is a list of filters.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemFilterPool fp = (ISystemFilterPool)element;
|
||||
return fp.getSystemFilters();
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
@ -197,7 +198,7 @@ public class SystemViewFilterPoolReferenceAdapter
|
|||
* Return the children of this object.
|
||||
* For filter pools, this is a list of filters.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemFilterPoolReference fpRef = getFilterPoolReference(element);
|
||||
ISubSystem ss = getSubSystem(element);
|
||||
|
|
|
@ -223,24 +223,11 @@ public class SystemViewFilterReferenceAdapter
|
|||
* <li>resolved objects for each filter string if user has elected NOT to show filter strings in his preferences
|
||||
* </ul>
|
||||
*/
|
||||
public Object[] getChildren(IProgressMonitor monitor, Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return internalGetChildren(monitor, element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the children of this object.
|
||||
* For filters, this is one or more of:
|
||||
* <ul>
|
||||
* <li>filters if nested filters supported
|
||||
* <li>filter strings if user has elected to show filter strings in his preferences
|
||||
* <li>resolved objects for each filter string if user has elected NOT to show filter strings in his preferences
|
||||
* </ul>
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
{
|
||||
return internalGetChildren(null, element);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns the children of the specified element. If a monitor is passed in then
|
||||
|
@ -621,7 +608,7 @@ public class SystemViewFilterReferenceAdapter
|
|||
|
||||
/**
|
||||
* Return a validator for verifying the new name is correct.
|
||||
* @param either a filter for a rename action, or a filter pool for a "new" action.
|
||||
* @param element either a filter for a rename action, or a filter pool for a "new" action.
|
||||
*/
|
||||
public ISystemValidator getNameValidator(Object element)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -148,7 +149,7 @@ public class SystemViewFilterStringAdapter extends AbstractSystemViewAdapter imp
|
|||
* Return the children of this filter.
|
||||
* This returns an empty list.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Map;
|
|||
import org.eclipse.core.resources.IContainer;
|
||||
import org.eclipse.core.resources.IWorkspace;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.AbstractTreeViewer;
|
||||
|
@ -37,10 +38,10 @@ import org.eclipse.rse.core.SystemBasePlugin;
|
|||
import org.eclipse.rse.core.model.SystemMessageObject;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.ISystemResourceChangeListener;
|
||||
import org.eclipse.rse.ui.operations.SystemDeferredTreeContentManager;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
import org.eclipse.ui.progress.DeferredTreeContentManager;
|
||||
import org.eclipse.ui.progress.PendingUpdateAdapter;
|
||||
|
||||
|
||||
|
@ -65,7 +66,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
private String filterString = null;
|
||||
private Hashtable resolvedChildrenPerFolder = null; // local cache to improve performance
|
||||
|
||||
private DeferredTreeContentManager manager;
|
||||
private SystemDeferredTreeContentManager manager;
|
||||
/**
|
||||
* The cache of images that have been dispensed by this provider.
|
||||
* Maps ImageDescriptor->Image.
|
||||
|
@ -167,6 +168,8 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the implementation of ISystemViewElement for the given
|
||||
* object. Returns null if the adapter is not defined or the
|
||||
|
@ -174,6 +177,10 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
*/
|
||||
protected ISystemViewElementAdapter getAdapter(Object o)
|
||||
{
|
||||
if (o instanceof IContextObject)
|
||||
{
|
||||
o = ((IContextObject)o).getModelObject();
|
||||
}
|
||||
ISystemViewElementAdapter adapter = null;
|
||||
if (o == null)
|
||||
{
|
||||
|
@ -241,20 +248,33 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
/**
|
||||
* @see ITreeContentProvider
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(Object object)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||
ISystemViewElementAdapter adapter = getAdapter(object);
|
||||
Object element = object;
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
element = ((IContextObject)object).getModelObject();
|
||||
}
|
||||
if (supportsDeferredQueries())
|
||||
{
|
||||
if (manager != null && adapter.supportsDeferredQueries())
|
||||
{
|
||||
ISubSystem ss = adapter.getSubSystem(element);
|
||||
ISubSystem ss = null;
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
ss = ((IContextObject)object).getSubSystem();
|
||||
}
|
||||
else
|
||||
{
|
||||
ss = adapter.getSubSystem(object);
|
||||
}
|
||||
if (ss != null)
|
||||
{
|
||||
// if (ss.isConnected())
|
||||
{
|
||||
|
||||
Object[] children = manager.getChildren(element);
|
||||
Object[] children = manager.getChildren(object);
|
||||
if (children != null)
|
||||
{
|
||||
// This will be a placeholder to indicate
|
||||
|
@ -302,7 +322,15 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
return children; // return it to caller
|
||||
}
|
||||
|
||||
children = adapter.getChildren(element);
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
children = adapter.getChildren(new NullProgressMonitor(), (IContextObject)object);
|
||||
}
|
||||
else
|
||||
{
|
||||
children = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
}
|
||||
|
||||
|
||||
if ((filesOnly || foldersOnly) &&
|
||||
// an array of one SystemMessageObject item implies some kind of error, so don't cache...
|
||||
|
@ -378,7 +406,7 @@ public class SystemViewLabelAndContentProvider extends LabelProvider
|
|||
}
|
||||
if (viewer instanceof AbstractTreeViewer)
|
||||
{
|
||||
manager = new DeferredTreeContentManager(this, (AbstractTreeViewer) viewer);
|
||||
manager = new SystemDeferredTreeContentManager(this, (AbstractTreeViewer) viewer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.model.ISystemMessageObject;
|
||||
|
@ -100,7 +102,7 @@ public class SystemViewMessageAdapter
|
|||
/**
|
||||
* Return the children of this object. Not applicable for us.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.model.ISystemPromptableObject;
|
||||
|
@ -99,7 +101,7 @@ public class SystemViewPromptableAdapter
|
|||
/**
|
||||
* Return the children of this object. Not applicable for us.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemPromptableObject promptable = (ISystemPromptableObject)element;
|
||||
if (!promptable.hasChildren())
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.eclipse.rse.ui.view;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
|
@ -102,7 +104,7 @@ public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implem
|
|||
/**
|
||||
* Return the children of this object
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemViewInputProvider provider = (ISystemViewInputProvider)element;
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.eclipse.rse.ui.view;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -103,7 +104,7 @@ public class SystemViewScratchpadAdapter extends AbstractSystemViewAdapter imple
|
|||
/**
|
||||
* Return the children of this object
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
SystemScratchpad pad = (SystemScratchpad)element;
|
||||
return pad.getChildren();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
********************************************************************************/
|
||||
|
||||
package org.eclipse.rse.ui.view;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
|
@ -165,7 +166,7 @@ public class SystemViewSubSystemAdapter extends AbstractSystemViewAdapter
|
|||
/**
|
||||
* Return the children of this object
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
//System.out.println("INSIDE GETCHILDREN FOR SUBSYSTEM VIEW ADAPTER: "+element);
|
||||
ISubSystem ss = (ISubSystem)element;
|
||||
|
|
|
@ -143,7 +143,7 @@ FocusListener
|
|||
{
|
||||
public IStatus run(IProgressMonitor monitor)
|
||||
{
|
||||
Object[] children = _adapter.getChildren(monitor, _inputObject);
|
||||
Object[] children = _adapter.getChildren(monitor, (IAdaptable)_inputObject);
|
||||
if (children != null)
|
||||
{
|
||||
SystemTableTreeViewProvider provider = (SystemTableTreeViewProvider)_viewer.getContentProvider();
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.Hashtable;
|
|||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.Assert;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
|
@ -48,6 +49,7 @@ 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.references.IRSEBaseReferencingObject;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||
import org.eclipse.rse.model.ISystemRemoteChangeEvent;
|
||||
import org.eclipse.rse.model.ISystemRemoteChangeEvents;
|
||||
import org.eclipse.rse.model.ISystemRemoteChangeListener;
|
||||
|
@ -73,6 +75,8 @@ import org.eclipse.rse.ui.actions.SystemSubMenuManager;
|
|||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.messages.SystemMessageDialog;
|
||||
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
|
||||
import org.eclipse.rse.ui.view.ContextObject;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
|
||||
import org.eclipse.rse.ui.view.ISystemSelectAllTarget;
|
||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||
|
@ -81,6 +85,7 @@ import org.eclipse.rse.ui.view.SystemViewDataDragAdapter;
|
|||
import org.eclipse.rse.ui.view.SystemViewDataDropAdapter;
|
||||
import org.eclipse.rse.ui.view.SystemViewMenuListener;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.BusyIndicator;
|
||||
import org.eclipse.swt.dnd.DND;
|
||||
import org.eclipse.swt.dnd.FileTransfer;
|
||||
import org.eclipse.swt.dnd.TextTransfer;
|
||||
|
@ -90,6 +95,7 @@ import org.eclipse.swt.events.KeyEvent;
|
|||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Item;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
@ -1402,5 +1408,167 @@ public class SystemScratchpadView
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overridden so that we can pass a wrapper IContextObject into the provider to get children instead
|
||||
* of the model object, itself
|
||||
*/
|
||||
protected void createChildren(final Widget widget)
|
||||
{
|
||||
if (widget instanceof TreeItem)
|
||||
{
|
||||
final Item[] tis = getChildren(widget);
|
||||
if (tis != null && tis.length > 0) {
|
||||
Object data = tis[0].getData();
|
||||
if (data != null) {
|
||||
return; // children already there!
|
||||
}
|
||||
}
|
||||
|
||||
BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
|
||||
public void run() {
|
||||
// fix for PR 1FW89L7:
|
||||
// don't complain and remove all "dummies" ...
|
||||
if (tis != null) {
|
||||
for (int i = 0; i < tis.length; i++) {
|
||||
if (tis[i].getData() != null) {
|
||||
disassociate(tis[i]);
|
||||
Assert.isTrue(tis[i].getData() == null,
|
||||
"Second or later child is non -null");//$NON-NLS-1$
|
||||
|
||||
}
|
||||
tis[i].dispose();
|
||||
}
|
||||
}
|
||||
Object d = widget.getData();
|
||||
if (d != null)
|
||||
{
|
||||
Object parentElement = getContextObject((TreeItem)widget);
|
||||
Object[] children = getSortedChildren(parentElement);
|
||||
if (children != null)
|
||||
{
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
createTreeItem(widget, children[i], -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
super.createChildren(widget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the containing filter reference for an item
|
||||
* @param item the item to get the filter reference for
|
||||
* @return the filter reference
|
||||
*/
|
||||
public ISystemFilterReference getContainingFilterReference(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingFilterReference(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISystemFilterReference)
|
||||
{
|
||||
return (ISystemFilterReference)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the containing subsystem from an item
|
||||
* @param item the item to get the subsystem for
|
||||
* @return the subsystem
|
||||
*/
|
||||
public ISubSystem getContainingSubSystem(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
if (data instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)data;
|
||||
}
|
||||
else
|
||||
{
|
||||
TreeItem parent = item.getParentItem();
|
||||
if (parent != null)
|
||||
{
|
||||
return getContainingSubSystem(parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Object input = getInput();
|
||||
if (input instanceof ISubSystem)
|
||||
{
|
||||
return (ISubSystem)input;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the context object from a tree item
|
||||
* @param item the item to get the context for
|
||||
* @return the context object
|
||||
*/
|
||||
public IContextObject getContextObject(TreeItem item)
|
||||
{
|
||||
Object data = item.getData();
|
||||
ISystemFilterReference filterReference = getContainingFilterReference(item);
|
||||
if (filterReference != null)
|
||||
{
|
||||
return new ContextObject(data, filterReference.getSubSystem(), filterReference);
|
||||
}
|
||||
else
|
||||
{
|
||||
ISubSystem subSystem = getContainingSubSystem(item);
|
||||
if (subSystem != null)
|
||||
{
|
||||
return new ContextObject(data, subSystem);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new ContextObject(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the standard viewer method to get the model object from the context object
|
||||
*/
|
||||
public void add(Object parentElementOrTreePath, Object[] childElements) {
|
||||
Assert.isNotNull(parentElementOrTreePath);
|
||||
assertElementsNotNull(childElements);
|
||||
|
||||
if (parentElementOrTreePath instanceof IContextObject)
|
||||
{
|
||||
parentElementOrTreePath = ((IContextObject)parentElementOrTreePath).getModelObject();
|
||||
}
|
||||
super.add(parentElementOrTreePath, childElements);
|
||||
}
|
||||
}
|
|
@ -21,11 +21,13 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.ui.view.IContextObject;
|
||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.ui.model.IWorkbenchAdapter;
|
||||
|
@ -120,12 +122,24 @@ public class SystemScratchpadViewProvider implements ILabelProvider, ITreeConten
|
|||
{
|
||||
Object[] results = null;
|
||||
|
||||
if (object instanceof IAdaptable)
|
||||
Object element = object;
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(object);
|
||||
if (adapter != null && adapter.hasChildren(object))
|
||||
element = ((IContextObject)object).getModelObject();
|
||||
}
|
||||
if (element instanceof IAdaptable)
|
||||
{
|
||||
results = adapter.getChildren(object);
|
||||
ISystemViewElementAdapter adapter = getAdapterFor(element);
|
||||
if (adapter != null && adapter.hasChildren(element))
|
||||
{
|
||||
if (object instanceof IContextObject)
|
||||
{
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IContextObject)object);
|
||||
}
|
||||
else
|
||||
{
|
||||
results = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)object);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view.search;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.SystemAdapterHelpers;
|
||||
|
@ -55,7 +56,7 @@ public class SystemSearchViewContentProvider implements ITreeContentProvider {
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
return adapter.getChildren(parentElement);
|
||||
return adapter.getChildren(new NullProgressMonitor(), (IAdaptable)parentElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +125,7 @@ public class SystemSearchViewContentProvider implements ITreeContentProvider {
|
|||
return null;
|
||||
}
|
||||
else {
|
||||
return adapter.getChildren(inputElement);
|
||||
return adapter.getChildren(new NullProgressMonitor(), (IAdaptable)inputElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
package org.eclipse.rse.ui.view.team;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.IRSEUserIdConstants;
|
||||
|
@ -139,7 +141,7 @@ public class SystemTeamViewCategoryAdapter
|
|||
/**
|
||||
* Return the children of this profile.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
SystemTeamViewCategoryNode category = (SystemTeamViewCategoryNode)element;
|
||||
ISystemProfile profile = category.getProfile();
|
||||
|
@ -151,6 +153,8 @@ public class SystemTeamViewCategoryAdapter
|
|||
else
|
||||
return createSubSystemConfigurationNodes(profile, category);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create subsystem factory child nodes for expanded category node
|
||||
*/
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.eclipse.rse.ui.view.team;
|
|||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
|
@ -64,7 +65,7 @@ public class SystemTeamViewContentProvider extends WorkbenchContentProvider
|
|||
{
|
||||
ISystemViewElementAdapter adapter = getSystemViewAdapter(element);
|
||||
if (adapter != null)
|
||||
children = adapter.getChildren(element);
|
||||
children = adapter.getChildren(new NullProgressMonitor(), (IAdaptable)element);
|
||||
else
|
||||
children = super.getChildren(element);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.eclipse.rse.ui.view.team;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -209,7 +210,7 @@ public class SystemTeamViewProfileAdapter
|
|||
/**
|
||||
* Return the children of this profile.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
ISystemProfile profile = (ISystemProfile)element;
|
||||
return getCategoryChildren(profile);
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
package org.eclipse.rse.ui.view.team;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
|
||||
|
@ -165,7 +167,7 @@ public class SystemTeamViewSubSystemConfigurationAdapter
|
|||
/**
|
||||
* Return the children of this profile.
|
||||
*/
|
||||
public Object[] getChildren(Object element)
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element)
|
||||
{
|
||||
SystemTeamViewSubSystemConfigurationNode ssfNode = (SystemTeamViewSubSystemConfigurationNode)element;
|
||||
SystemTeamViewCategoryNode category = ssfNode.getParentCategory();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.rse.tests.internal.testsubsystem;
|
||||
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -124,7 +125,7 @@ public class TestSubSystemNodeAdapter extends AbstractSystemViewAdapter
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.ui.view.AbstractSystemViewAdapter#getChildren(java.lang.Object)
|
||||
*/
|
||||
public Object[] getChildren(Object element) {
|
||||
public Object[] getChildren(IProgressMonitor monitor, IAdaptable element) {
|
||||
if (isTestSubSystemNodeContainer(element))
|
||||
return ((ITestSubSystemNodeContainer)element).getChildNodes();
|
||||
return null;
|
||||
|
|
Loading…
Add table
Reference in a new issue