diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index 4ea3a678f8f..de0cca9142a 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java @@ -34,6 +34,7 @@ * Kevin Doyle (IBM) - [204810] Saving file in Eclipse does not update remote file * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems * Kevin Doyle (IBM) - [186125] Changing encoding of a file is not reflected when it was opened before + * David McKnight (IBM) - [208803] add exists() method ********************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -519,6 +520,26 @@ public class SystemViewRemoteFileAdapter return getType(element) + ": " + getAbsoluteName(element); //$NON-NLS-1$ } + /** + * Returns whether the specified element is represented as existing. Note that + * it's possible that the represented element will been seen to exist when on + * a remote host it may not - that is because this call does not query the host. + * Returns whether the remote file representation exists. + * + * @param element the element to check + * @return true if the element exists + * + */ + public boolean exists(Object element) + { + IRemoteFile file = (IRemoteFile) element; + if (file != null) + { + return file.exists(); + } + return false; + } + /** * Return the parent of this object */ diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java index c418e98c995..8d5e0cf3287 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java @@ -21,6 +21,7 @@ * Martin Oberhuber (Wind River) - [189163] Update IActionFilter constants from subsystemFactory to subsystemConfiguration * Tobias Schwarz (Wind River) - [173267] "empty list" should not be displayed * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core + * David McKnight (IBM) - [208803] add exists() method ********************************************************************************/ package org.eclipse.rse.ui.view; @@ -471,6 +472,23 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda return getType(element) + ": " + getName(element); //$NON-NLS-1$ } + /** + * Returns whether the specified element is represented as existing. Note that + * it's possible that the represented element will been seen to exist when on + * a remote host it may not - that is because this call does not query the host. + * By default, this method returns true - override this method to customize the + * behavior + * + * @param element the element to check + * @return true if the element exists + * + */ + public boolean exists(Object element) + { + return true; + } + + /** * Abstract. Must be overridden by subclasses.
* Return the parent of this object. This is required by eclipse UI adapters, but diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java index 8b16197b276..67daf9fea1c 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/ISystemViewElementAdapter.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [190271] Move ISystemViewInputProvider to Core + * David McKnight (IBM) - [208803] add exists() method ********************************************************************************/ package org.eclipse.rse.ui.view; @@ -173,11 +174,25 @@ public interface ISystemViewElementAdapter extends IPropertySource, ISystemDragD * Return the string to display in the status line when the given object is selected */ public String getStatusLineText(Object element); + + + /** + * Returns whether the specified element is represented as existing. Note that + * it's possible that the represented element will been seen to exist when on + * a remote host it may not - that is because this call does not query the host. + * + * @param element the element to check + * @return true if the element exists + */ + public boolean exists(Object element); + /** * Return the parent of this object */ public Object getParent(Object element); + + /** * Return the children of this model object. *